[ft] checking national glyhs
Good morning! I'd like to detect whether a glyph (e.g. 0x0150) is part of the font. Actually detect Hungarian language support of webpages. Font file names are extracted from CSS. Is it OK? ftdump -v /usr/share/fonts/truetype/msttcorefonts/verdana.ttf | grep 0x0151 Or should I care about these? charmaps 0: platform 1, encoding 0, language 0 1: platform 3, encoding 1, language 0 (active) ..any of them could contain that glyph. It would be great to have an automated shell (CLI) tool. Please help me. Szépe Viktor -- +36-20-4242498 s...@szepe.net skype: szepe.viktor Budapest, XX. kerület ___ Freetype mailing list Freetype@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype
Re: [ft] checking national glyhs
I'd like to detect whether a glyph (e.g. 0x0150) is part of the font. Actually detect Hungarian language support of webpages. Font file names are extracted from CSS. You rather want to detect whether Unicode input character U+0150 has a mapping to a non-zero glyph index. Is it OK? ftdump -v /usr/share/fonts/truetype/msttcorefonts/verdana.ttf | grep 0x0151 No, it isn't, you need flag `-V' for that :-) Or should I care about these? charmaps 0: platform 1, encoding 0, language 0 1: platform 3, encoding 1, language 0 (active) Yes, you normally need a (3,1) encoding, as described in the OpenType specification. There are other Unicode mappings, but those are very rare today. However, I strongly suggest that you use already existing solutions like the `fontconfig' library, which contains code to scan a font for detecting the supported scripts and languages. A single glyph doesn't make up a font for Hungarian... Werner ___ Freetype mailing list Freetype@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype
Re: [ft] checking national glyhs
Is it OK? ftdump -v /usr/share/fonts/truetype/msttcorefonts/verdana.ttf | grep 0x0151 No, it isn't, you need flag `-V' for that :-) Thank you for your support! # ftdump -V /usr/share/fonts/truetype/msttcorefonts/verdana.ttf ftdump: invalid option -- V ftdump: simple font dumper -- part of the FreeType project --- Usage: ftdump [options] fontname -nprint SFNT name tables -vbe verbose It seems there is no -V in my ftdump. However, I strongly suggest that you use already existing solutions like the `fontconfig' library, which contains code to scan a font for detecting the supported scripts and languages. A single glyph doesn't make up a font for Hungarian... Is it what you suggested? $ fc-scan --format '%{lang}\n' /usr/share/fonts/truetype/msttcorefonts/verdana.ttf Its output is aa|af|av|ay|be|bg|bi|bin|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|ki|kl|kum|la|lb|lez|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|se|sel|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za Is it stored in the font, or calculated? fc doc says This is computed by comparing the Unicode coverage of the font with the orthography of each language. So I think it's calculted, so font cannot lie. Szépe Viktor -- +36-20-4242498 s...@szepe.net skype: szepe.viktor Budapest, XX. kerület ___ Freetype mailing list Freetype@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype
Re: [ft] checking national glyhs
Hi, For the codepoint scanning of ftdump, -v is OK, I think. In general speaking, you should exclude the cmap subtable with non-Unicode mapping (e.g. some east asian fonts and some MacOS fonts have non-Unicode mapping table - there is a possibility that the codepoint you're looking for is used for different character). But as Werner recommended, also I recommend fontconfig as a considerable option. Because crawling all available font files is time consuming work (file open close is already time consuming), and you might have another problem - how to find a fallback font? Such issues could be solved by fontconfig, if you have no problem in the settings of fontconfig in your platform (many people complain the default setting of fontconfig, manufactured by unix distributors, as they return unwanted substitutions). Anyway, I recommend fontconfig as a considerable option, not as better solution, because yet I'm not understanding your task completely. # in fact, I think, fontconfig cannot search the font file # by its filename. Szépe Viktor wrote: However, I strongly suggest that you use already existing solutions like the `fontconfig' library, which contains code to scan a font for detecting the supported scripts and languages. A single glyph doesn't make up a font for Hungarian... Is it what you suggested? $ fc-scan --format '%{lang}\n' /usr/share/fonts/truetype/msttcorefonts/verdana.ttf Its output is aa|af|av|ay|be|bg|bi|bin|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|ki|kl|kum|la|lb|lez|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|se|sel|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za I guess Werner recommended to search the font aslike: $ fc-query serif:lang=hu Maybe you wonder oh, I have not specified the character to be searched. fontconfig has their own charset database to detect the supported charset. For example, please check http://cgit.freedesktop.org/fontconfig/tree/fc-lang/hu.orth for the database for Hungarian. Is it stored in the font, or calculated? fc doc says This is computed by comparing the Unicode coverage of the font with the orthography of each language. So I think it's calculted, so font cannot lie. Szépe Viktor Regards, mpsuzuki ___ Freetype mailing list Freetype@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype
Re: [ft] checking national glyhs
Oops, I made a mistake. $ fc-query serif:lang=hu I meant: $ fc-match serif:lang=hu. fc-match can accept the charset specification, but its expression is not easy for human eye (see discussion http://comments.gmane.org/gmane.comp.fonts.fontconfig/4916 ) Regards, mpsuzuki suzuki toshiya wrote: Hi, For the codepoint scanning of ftdump, -v is OK, I think. In general speaking, you should exclude the cmap subtable with non-Unicode mapping (e.g. some east asian fonts and some MacOS fonts have non-Unicode mapping table - there is a possibility that the codepoint you're looking for is used for different character). But as Werner recommended, also I recommend fontconfig as a considerable option. Because crawling all available font files is time consuming work (file open close is already time consuming), and you might have another problem - how to find a fallback font? Such issues could be solved by fontconfig, if you have no problem in the settings of fontconfig in your platform (many people complain the default setting of fontconfig, manufactured by unix distributors, as they return unwanted substitutions). Anyway, I recommend fontconfig as a considerable option, not as better solution, because yet I'm not understanding your task completely. # in fact, I think, fontconfig cannot search the font file # by its filename. Szépe Viktor wrote: However, I strongly suggest that you use already existing solutions like the `fontconfig' library, which contains code to scan a font for detecting the supported scripts and languages. A single glyph doesn't make up a font for Hungarian... Is it what you suggested? $ fc-scan --format '%{lang}\n' /usr/share/fonts/truetype/msttcorefonts/verdana.ttf Its output is aa|af|av|ay|be|bg|bi|bin|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gn|gv|ho|hr|hu|ia|ig|id|ie|ik|io|is|it|ki|kl|kum|la|lb|lez|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|se|sel|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za I guess Werner recommended to search the font aslike: $ fc-query serif:lang=hu Maybe you wonder oh, I have not specified the character to be searched. fontconfig has their own charset database to detect the supported charset. For example, please check http://cgit.freedesktop.org/fontconfig/tree/fc-lang/hu.orth for the database for Hungarian. Is it stored in the font, or calculated? fc doc says This is computed by comparing the Unicode coverage of the font with the orthography of each language. So I think it's calculted, so font cannot lie. Szépe Viktor Regards, mpsuzuki ___ Freetype mailing list Freetype@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype ___ Freetype mailing list Freetype@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype
Re: [ft] checking national glyhs
Is it what you suggested? $ fc-scan --format '%{lang}\n' Yes. But please read Toshiya's replies :-) Werner ___ Freetype mailing list Freetype@nongnu.org https://lists.nongnu.org/mailman/listinfo/freetype