freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] [EXTERNAL] RE: get all glyphs


From: armin
Subject: Re: [ft] [EXTERNAL] RE: get all glyphs
Date: Tue, 9 Apr 2019 10:52:33 +0100

Hi Thomas,

have you tried to iterate over every charmap, as Laco suggested?  Basically
keeping your loop but putting something like that around it:

```
for ( int c = 0, cc = face->num_charmaps; c < cc; ++c ) {
  FT_Error  err = FT_Set_Charmap( face, face->charmaps[c] );
  if ( !err ) {
    // ... your loop from below ...
  }
}
'''

Also mind Laco's note about `FT_Load_Glyph';  you don't want to load
anything if you don't have to.

Best
Armin

> I did try FT_Load_Glyph as well.  The only problem is, I also need to know
the
> character code. I don't know how to get the character code from the slot??
> =Thomas
>
>> Note: Consider use FT_Load_Glyph to enumerate all glyphs, i tis slow.
>>
>> - Laco.
>>
>>> Hello Thomas,
>>>
>>> From documentation about FT_Get_First_Char:
>>>
>>> Return the first character code in the current charmap of a given face,
...
>>> 
>>> This mean you get only trough glyphs in current charmap. Try use
FT_Load_Glyph.
>>>
>>> - Laco.
>>>>
>>>> I'm attempting to extract all glyphs from a TTF in order to create a
table
>>>> of each glyph's width. I'm using a Chinese TTF, that reports it has
36k+
>>>> glyphs (via face->num_glyphs). When I use the following code, I only
get
>>>> 497 glyphs. Clearly, I'm doing something wrong... Any ideas?
>>>>
>>>> Thanks,
>>>> -Thomas
>>>>
>>>> charcode = FT_Get_First_Char( Face, &gindex );
>>>> while ( gindex != 0 )
>>>> {
>>>>     printf("count: %d, charcode: 0x%X, gindex: %d\n", count, charcode,
gindex);
>>>>     charcode = FT_Get_Next_Char( Face, charcode, &gindex );
>>>>     count++;
>>>> }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]