suzuki toshiya
2011-Jan-07 05:45 UTC
[Fontconfig] family_name for the font without ASCII names
Hi, Recently I found a group of Japanese fonts that requires hinting even for ASCII characters, for readable results: http://lists.gnu.org/archive/html/freetype-devel/2010-12/msg00021.html During the registration of them to tricky font lists, I found that these fonts lack ASCII family name. Their name tables are for MacJapanese (ShiftJIS) and Microsoft Unicode. In both names, the family names are in Japanese, not English. In such case, current FreeType2 replaces non-ASCII character in non-ASCII family name by "?". Thus, FT_Face->family_name is set by broken string. There is a possibility that the different fonts will have same broken family name. However, the PostScript name of the fonts I found are still in ASCII. I think, a few improvements would be possible. A) If we cannot find ASCII family name from WWS family name, preferred family name and (original) family name, try to find ASCII name in PostScript name. B) Non-ASCII characters should not be replaced by "?", but escaped, like "\OOO" or "\xXX" or "U+XXXX". # Using both is possible. Such changes will invalidate the fontconfig database, so I want to ask the comment from fontconfig developers/users. Regards, mpsuzuki
Behdad Esfahbod
2011-Jan-07 05:50 UTC
[Fontconfig] [ft-devel] family_name for the font without ASCII names
On 01/07/11 00:45, suzuki toshiya wrote:> Hi, > > Recently I found a group of Japanese fonts that requires > hinting even for ASCII characters, for readable results: > http://lists.gnu.org/archive/html/freetype-devel/2010-12/msg00021.html > > During the registration of them to tricky font lists, > I found that these fonts lack ASCII family name. Their > name tables are for MacJapanese (ShiftJIS) and Microsoft > Unicode. In both names, the family names are in Japanese, > not English. > In such case, current FreeType2 replaces non-ASCII > character in non-ASCII family name by "?". Thus, > FT_Face->family_name is set by broken string. There > is a possibility that the different fonts will have > same broken family name. However, the PostScript name of > the fonts I found are still in ASCII. > > I think, a few improvements would be possible.Generally, we don''t care if a font does not have an ASCII name. What we care about is that the name and the name encoding are consistent and hence we can decode and meaningfully represent the name in Unicode. Why would that fail with these fonts? behdad> A) If we cannot find ASCII family name from WWS family name, > preferred family name and (original) family name, try to > find ASCII name in PostScript name. > > B) Non-ASCII characters should not be replaced by "?", > but escaped, like "\OOO" or "\xXX" or "U+XXXX". > > # Using both is possible. > > Such changes will invalidate the fontconfig database, > so I want to ask the comment from fontconfig developers/users. > > Regards, > mpsuzuki > > _______________________________________________ > Freetype-devel mailing list > Freetype-devel at nongnu.org > http://lists.nongnu.org/mailman/listinfo/freetype-devel >
Jerry Casiano
2011-Jan-07 23:56 UTC
[Fontconfig] family_name for the font without ASCII names
On Fri, 2011-01-07 at 14:45 +0900, suzuki toshiya wrote:> During the registration of them to tricky font lists, > I found that these fonts lack ASCII family name. Their > name tables are for MacJapanese (ShiftJIS) and Microsoft > Unicode. In both names, the family names are in Japanese, > not English. > In such case, current FreeType2 replaces non-ASCII > character in non-ASCII family name by "?". Thus, > FT_Face->family_name is set by broken string. There > is a possibility that the different fonts will have > same broken family name. However, the PostScript name of > the fonts I found are still in ASCII.This happens with a lot of fonts. I think the issue is that you''re using FT_Face->family_name by default rather than as a last resort. At least that was my mistake. ;-) I''m not sure what you''re trying to do or what your requirements are but wouldn''t it be better to get the info you need directly from FontConfig? or at least as much of it as possible. For example, using FcConfigAppFontAddFile() and FcFreeTypeQueryFace()
mpsuzuki at hiroshima-u.ac.jp
2011-Jan-08 17:24 UTC
[Fontconfig] family_name for the font without ASCII names
On Fri, 07 Jan 2011 18:56:37 -0500 Jerry Casiano <jerrycasiano at gmail.com> wrote:>On Fri, 2011-01-07 at 14:45 +0900, suzuki toshiya wrote: > >> During the registration of them to tricky font lists, >> I found that these fonts lack ASCII family name. Their >> name tables are for MacJapanese (ShiftJIS) and Microsoft >> Unicode. In both names, the family names are in Japanese, >> not English. >> In such case, current FreeType2 replaces non-ASCII >> character in non-ASCII family name by "?". Thus, >> FT_Face->family_name is set by broken string. There >> is a possibility that the different fonts will have >> same broken family name. However, the PostScript name of >> the fonts I found are still in ASCII. > >This happens with a lot of fonts. I think the issue is that you''re using >FT_Face->family_name by default rather than as a last resort. At least >that was my mistake. ;-) > >I''m not sure what you''re trying to do or what your requirements are but >wouldn''t it be better to get the info you need directly from FontConfig? >or at least as much of it as possible.Ah, I''m sorry for poor explanation. What I''m trying to do is: a patch for FreeType2 library to change the default FT_Face->family_name when a TrueType/OpenType font without ASCII family name is given. My concern was that such change may have any bad impact to fontconfig. But, as Behdad and you told, it seems that the names handled by fontconfig are copied from "name" table and not a copy of FT_Face->family_name. So, I understand as there is no impact at all. It is good news! I have to check other applications which write FT_Face->family_name as a persistent font identifier into their output files. Regards, mpsuzuki
Behdad Esfahbod
2011-Jan-08 18:16 UTC
[Fontconfig] family_name for the font without ASCII names
On 01/08/11 12:24, mpsuzuki at hiroshima-u.ac.jp wrote:> What I''m trying to do is: a patch for FreeType2 library to change > the default FT_Face->family_name when a TrueType/OpenType font > without ASCII family name is given. My concern was that such > change may have any bad impact to fontconfig. > > But, as Behdad and you told, it seems that the names handled by > fontconfig are copied from "name" table and not a copy of > FT_Face->family_name. So, I understand as there is no impact at all. > It is good news!If you check fcfreetype.c, fontconfig uses face->family_name as a last resort. At any rate, improving it can''t be bad. If FreeType produces question marks for unknown family names, maybe we should filter those out in fontconfig. Can you do that? behdad