[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft] [EXTERNAL] RE: get all glyphs
From: |
Dryden, Thomas |
Subject: |
Re: [ft] [EXTERNAL] RE: get all glyphs |
Date: |
Tue, 9 Apr 2019 16:28:07 +0000 |
Laco/Armin,
Yes - I did the following iteration over all charmaps. It yielded 3607 'chars'.
Still, 10x less than expected. It occurred to me that maybe the 'chars' are
used together to make different Chinese characters?
-Thomas
for (int i=0; i<Face->num_charmaps; i++)
{
gindex = 0;
FT_Set_Charmap(Face, Face->charmaps[i]);
charcode = FT_Get_First_Char(Face, &gindex);
while ( gindex != 0 )
{
fprintf(fh, "count: %d, charcode: 0x%X, gindex: %d\n", count,
charcode, gindex);
printf("count: %d, charcode: 0x%X, gindex: %d\n", count, charcode,
gindex);
charcode = FT_Get_Next_Char( Face, charcode, &gindex );
count++;
}
}
-----Original Message-----
From: address@hidden <address@hidden>
Sent: Tuesday, April 9, 2019 8:19 AM
To: address@hidden; Dryden, Thomas <address@hidden>; address@hidden
Subject: RE: [ft] [EXTERNAL] RE: get all glyphs
CAUTION: This email originated from outside of the organization. Do not click
links or open attachments unless you recognize the sender and know the content
is safe.
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++;
>>>> }
________________________________
________________________________
Please be advised that this email may contain confidential information. If you
are not the intended recipient, please notify us by email by replying to the
sender and delete this message. The sender disclaims that the content of this
email constitutes an offer to enter into, or the acceptance of, any agreement;
provided that the foregoing does not invalidate the binding effect of any
digital or other electronic reproduction of a manual signature that is included
in any attachment.
- [ft] get all glyphs, Dryden, Thomas, 2019/04/08
- Re: [ft] get all glyphs, dudasl, 2019/04/08
- Re: [ft] get all glyphs, dudasl, 2019/04/08
- Re: [ft] [EXTERNAL] RE: get all glyphs, Dryden, Thomas, 2019/04/08
- Re: [ft] [EXTERNAL] RE: get all glyphs, Lawrence D'Oliveiro, 2019/04/08
- Re: [ft] [EXTERNAL] RE: get all glyphs, armin, 2019/04/09
- Re: [ft] [EXTERNAL] RE: get all glyphs, dudasl, 2019/04/09
- Re: [ft] [EXTERNAL] RE: get all glyphs,
Dryden, Thomas <=
- Re: [ft] [EXTERNAL] RE: get all glyphs, Werner LEMBERG, 2019/04/09
- Re: [ft] [EXTERNAL] RE: get all glyphs, Werner LEMBERG, 2019/04/09
- Re: [ft] [EXTERNAL] RE: get all glyphs, Werner LEMBERG, 2019/04/09
Re: [ft] get all glyphs, Lawrence D'Oliveiro, 2019/04/09