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: dudasl
Subject: Re: [ft] [EXTERNAL] RE: get all glyphs
Date: Tue, 9 Apr 2019 17:18:44 +0200

Good point Armin,

If you go trough every charmap in FT_Face then you should be able iterate
all glyphs. And this is definitely faster than using FT_Load_Glyph. In rare
cases there can be glyphs in font which are not referenced by any charmap,
but then many program cannot work with it.

Best
- Laco.

-----Original Message-----
From: address@hidden <address@hidden> 
Sent: Tuesday, April 9, 2019 11:53
To: 'Dryden, Thomas' <address@hidden>;
address@hidden; address@hidden
Subject: RE: [ft] [EXTERNAL] RE: get all glyphs

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]