On 21 Sep 2011, at 21:39, Nikita Egorov wrote:
>
> off topic: I'm not sure the word "glyph" is a proper one in our case.
> IIRC the "glyph" can be only part of character. A few glyphs can be at
> one character cell and make up grapheme, symbol. So I'm interested in
> how many character cells will
> If the intent is to trim glyphs off the end of a string until it only has the
> required number of glyphs left, then I think you could do something useful
> using:
>
> /* F2: Move backward to the previous valid UTF8 sequence start */
> FL_EXPORT const char* fl_utf8back(const char* p, const char
> This should work (untested):
>
> int findFirstNCharacters(const char *str, int n)
> {
> int bytes = 0;
> int maxBytes = strlen(str);
> while (n>0 != *str!=0) {
> int bytesInChar = fl_utf_nb_char(*str, maxBytes);
> if (bytesInChar==-1) break; // error in UTF-8
> bytes += bytesInChar;
>
On 21 Sep 2011, at 18:20, Matthias Melcher wrote:
>
> This should work (untested):
>
> int findFirstNCharacters(const char *str, int n)
> {
> int bytes = 0;
> int maxBytes = strlen(str);
> while (n>0 != *str!=0) {
>int bytesInChar = fl_utf_nb_char(*str, maxBytes);
>if (bytesInChar==
This should work (untested):
int findFirstNCharacters(const char *str, int n)
{
int bytes = 0;
int maxBytes = strlen(str);
while (n>0 != *str!=0) {
int bytesInChar = fl_utf_nb_char(*str, maxBytes);
if (bytesInChar==-1) break; // error in UTF-8
bytes += bytesInChar;
maxBytes
> OK. I have string with some length (m = strlen(s);) and I have n -
> quantity of characters which I can print.
> I can calculate k = fl_utf_nb_char(s, m);
>
> If k <= n then no problem : fl_draw(s,x,y);
>
> Otherwise?
> In cycle decrease the source text by one byte and check for
> length, ye
> characters > 0x2e80 for example have a width of two monospace chars. These
> are mostly Chinese, Japanese and Korean. Basically, for monospaced font in
> Unicode, you can have non-spacing, single-width or double-width characters or
> ligatures.
I know about the double-width characters. Fortun
On 21.09.2011, at 16:52, Nikita Egorov wrote:
>> No, even if you use monospace fonts, you can not assume that the number of
>> characters times the width of the font will give you the width of the string
>> that will be rendered on screen. There are characters and character
>> combinations in
> No, even if you use monospace fonts, you can not assume that the number of
> characters times the width of the font will give you the width of the string
> that will be rendered on screen. There are characters and character
> combinations in Unicode that need more or less pixels, even in monos
> The only reliable way to get the width of whatever is printed
> is using fl_width() after setting the font and size.
Or my preferred option of fl_text_extents()
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in Engl
> But in UTF-16 all symbols have size two bytes. There is no problem to
> set specified size of string as opposed to UTF8 where every symbol can
> have own size (from 1 up to 5?) .
Not true I'm afraid - only glyphs from the BMP are sure to be two bytes
in UTF16.
Any glyph from a higher plane will
On 21.09.2011, at 14:50, Nikita Egorov wrote:
>> Without looking into it in more detail, I'm going to say docs problem -
>> it should not say "n characters" but should probably say something like
>> "the number of bytes needed to represent n characters in UTF8" or some
>> such thing... Or...?
> Y
> Without looking into it in more detail, I'm going to say docs problem -
> it should not say "n characters" but should probably say something like
> "the number of bytes needed to represent n characters in UTF8" or some
> such thing... Or...?
Yes, description should be replaced to "number of bytes
> I'm not sure is it a bug or wrong docs, but there is a problem.
Without looking into it in more detail, I'm going to say docs problem -
it should not say "n characters" but should probably say something like
"the number of bytes needed to represent n characters in UTF8" or some
such thing... Or
Hi, all!
I'm not sure is it a bug or wrong docs, but there is a problem.
I tried to use fl_draw() with explicit length of UTF-8 text (MS Win).
Comments in fl_draw.H say "Draws an array of n characters starting at the given
location." But in fact it doesn't work correctly, because the function
f
15 matches
Mail list logo