sfnt-housed is a term summarising several related font formats, including TrueType (.ttf, .ttc), OpenType (.otf), and OFF (Open Font Format); the name refers to the general container format all of these rely on. While this has mostly replaced the plethora of platform-specific font formats that were previously common, it is also a very complex format, and few programs make use of its full capabilities. This project aims to provide Tcl scripts access to the wealth of information present in these fonts.
Areas | Fonts |
Good (though not essential) if student knows | binary, Postscript, a non-LGC language, XML, LaTeX |
Priority | Low |
Difficulty | Easy to Medium |
Benefits to the student | Learn about font technologies. Experience of working with binary data formats. |
Benefits to Tcl | Access to fonts and font metrics, for e.g. generating PS/PDF output, without having to have a GUI running. Access to more advanced typographic information. |
Mentor | Lars H |
A starting point for this project could be the code existing in the sfntutil program available here:
The primary functions present there is to dump data from sfnt-housed font files in text files that are both human- and machine-readable. For example, it can produce the following output (see TDL for an explanation of the basix syntax; XML output is also available):
% sfntutil.tcl dump LinLibertineFont/Biolinum_Re-0.4.1.otf -only=head,OS/2 sfnt-font tag OTTO { sfnt-table tag head start 236 length 54 { FontRevision hex 00006666 bcd 0.6666 num 0.4000 shortshort 0.26214 /flag {Has strong right-to-left} /flag {Force ppem to integer} /flag {Left sidebearing point at x=0} /flag {Baseline at y=0} /setint designunits 1000 /when created 1237593688 /when modified 1237593688 /FontBBox -1082.0 -247.0 6171.0 896.0 /dontsetint lowestRecPPEM 8 /dontsetint fontDirectionHint 0 } sfnt-table tag OS/2 start 336 length 96 { /setint averagewidth 560.0 /setint ascender 894.0 /setint descender_neg -246.0 /setint linegap 0.0 /setint maxheight 894.0 /setint maxdepth 246.0 /setint xheight 432.0 /setint capheight 648.0 /setint sub1 140.0 /setint sup2 479.0 /scriptsizepos sub 650.0 699.0 0.0 -140.0 /scriptsizepos super 650.0 699.0 0.0 479.0 /Panose 2 0 5 3 0 0 0 0 0 0 } /datum funit 1.0 /datum indexToLocFormat 0 sfnt-table tag {CFF } start 4580 length 265758 sfnt-table tag FFTM start 290480 length 28 sfnt-table tag GDEF start 270340 length 1032 sfnt-table tag GPOS start 276300 length 14178 sfnt-table tag GSUB start 271372 length 4928 sfnt-table tag cmap start 2508 length 2038 sfnt-table tag hhea start 292 length 36 sfnt-table tag hmtx start 290508 length 9664 sfnt-table tag kern start 300172 length 760110 sfnt-table tag maxp start 328 length 6 sfnt-table tag name start 432 length 2073 sfnt-table tag post start 4548 length 32 }
Another starting point (as YS points out) would be the existing TTF support in pdf4tcl. Features that does not currently support are:
Other directions for further work are:
TrueType/OpenType is a format with a complicated history (involving at least three major software vendors), so there is no source which tells the whole story. Important sites are:
Some comments here, and discussion of the idea
abu 13 march 2011
See [L2 ] for some astonishing results. It's a library written in Processing for parsing and rendering true-type fonts in an amazing way.
Lars H, 17 march 2011: And that is relevant how, precisely?
abu 18 march 2011 - This is very close to what you listed in point 2 of "Other directions for further work are" section.
The above picture has been generated with just two "parameters" : a string ("Caligraft") a font-file (TimesRoman.ttf .. or maybe another font-file) The hard work was to extract from the font-file the geometry of the "C" "a" "l" ... letters, and then, draw the curves in a new 'artistically-corrected' way. I think that at least the first part this work (extracting the letters geometry) should be one of the goals of this project.
YS 2011-03-14 pdf4tcl0.7 also includes .ttf and postscript fonts parser. It also does font subsetting for them.