Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting glyph-path information from ttf files

I'm trying to figure out a way to extract the information encoded in ttf files. namely: The char-to-glyph table and the individual glyph path data.

Does anyone have a good reference explaining the ttf file structure, or some other solution?

Keep in mind that I'm not interested in any libraries that can do it for me either (unless they are open source and I can see how they are doing it). The "master" goal is to implement it in Javascript.

Thanks!

like image 957
Anonymous Coward Avatar asked Jun 05 '10 17:06

Anonymous Coward


2 Answers

Take a look at OpenType.js at http://opentype.js.org/

opentype.js provides you with raw access to the glyphs so you can modify them as you please.

One can inspect all the tables in an OpenType and TrueType font using Font Inspector, and enumerate all the glyphs using Glyph Inspector

like image 60
kotpal Avatar answered Oct 24 '22 06:10

kotpal


This toolkit has an utility called ttf2svg, it is open source written in java. http://xmlgraphics.apache.org/batik/

You can try to extract the ttf parsing logic and implement it as you want.

In a past situation I used this utility to generate a svg file and use it in a web page targeting ipad users (@fontface css feature).

like image 30
Adilson de Almeida Jr Avatar answered Oct 24 '22 06:10

Adilson de Almeida Jr