Parsing information from TrueType font
Moderator: General Moderators
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
Parsing information from TrueType font
I have a question on stackoverflow about parsing data from TrueType font. Has anyone done that before? I need to extract as much as possible data, most importantly the cmap. Can anyone explain me how do I proceed from the point as described in the stackoverflow?
http://stackoverflow.com/questions/5290 ... etype-font
http://stackoverflow.com/questions/5290 ... etype-font
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
Re: Parsing information from TrueType font
Could I possibly call freetype2 on linux system using PHP to get info about the font?
Re: Parsing information from TrueType font
can't you use a command-line utility like this: http://packages.debian.org/sid/fonttools ?
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
Re: Parsing information from TrueType font
an I use it with PHP?
Re: Parsing information from TrueType font
shell_exec + simplexml ?
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
Re: Parsing information from TrueType font
I used the code that you have suggested. Now I am able to access the cmap, which is great. Now, how do I convert these characters to image generated with GD or whatever.
Code: Select all
object(SimpleXMLElement)#4 (3) {
["tableVersion"]=>
object(SimpleXMLElement)#5 (1) {
["@attributes"]=>
array(1) {
["version"]=>
string(1) "0"
}
}
["cmap_format_4"]=>
array(2) {
[0]=>
object(SimpleXMLElement)#6 (3) {
["@attributes"]=>
array(3) {
["platformID"]=>
string(1) "0"
["platEncID"]=>
string(1) "3"
["language"]=>
string(1) "0"
}
["map"]=>
array(222) {
[0]=>
object(SimpleXMLElement)#9 (1) {
["@attributes"]=>
array(2) {
["code"]=>
string(4) "0x20"
["name"]=>
string(5) "space"
}
}
[1]=>
object(SimpleXMLElement)#11 (1) {
["@attributes"]=>
array(2) {
["code"]=>
string(4) "0x21"
["name"]=>
string(6) "exclam"
}
}
[..]
Re: Parsing information from TrueType font
What are you trying to do? It might be that there's better approach.
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
Re: Parsing information from TrueType font
Basically I need to generate Character/Glyph Map of all available characters in the font.
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
Re: Parsing information from TrueType font
There is this discussion on stackoverflow that might be of a help for someone to help me to solve this issue.
Code: Select all
http://stackoverflow.com/questions/5313474/otf-ttf-font-cmap-table/5313566#5313566