I would like to examine the instructions of some TrueType fonts in FontLab in order to learn from it.
The FL manual shows this example:

What do I have to do to see the TT hints like this? It doesn't work for me.
Hello Tim,
FontLab can't decompile TT instructions from generated TTF fonts. If you do TrueType hinting in FontLab you destroy the existing (binary) instructions. If you want to see something like the picture above you have to apply (PostScript) autohinting and convert this to TT instructions.
The kind of TT instructions is indicated as icon in the font window. If you see a blue 'T' in the lower left corner you have binary instructions which can't be edited. A yellow 'T' indicates visible and editable TT instructions.
Eigi
Let me add to what Eigi wrote that there are probably two reasons why existing TT instructions cannot be imported and edited in FLS:
You can however decompile TT instructions using ttx on a font, but then you would see the raw instruction code and not a visual representation like in FLS.
>...this is the original hinting in the official Times TTF...
That would be 20 year-old hinting.
>...it's all just numbers
True, but there is no choice in a binary program;)
The tricks are really to know first how the tables interact, technically, that you are looking at a well-maintained graphics state and a good stack of glyph instructions, and finally knowing what the instructions are trying generally to do typographically. That helps a lot to make the numbers go away.
You can decompile TT and find out which value, e.g. in the cvt table, stands for what, if you have a font that you know works, as opposed perhaps to absolutely, like if you gave it garbage to figure out.
Cheers!
The visual TrueType instructions in FontLab Studio (or VTT) are kind of like source code, while the binary TrueType instructions in a TTF font are, well, like binary code. You can decompile the binary into assembly code (e.g. using TTX) but it's not at all trivial to decompile into the visual source code, especially since the source code in FontLab Studio provides a particular set of functions that does not necessarily represent all of situations that you can code using the TrueType assembly.
Unlike, say, the syntax that is used in OpenType Layout tables (GPOS, GSUB) -- which is a very simple language and is actually more like data than like programming code -- the TrueType assembly language is a real programming language in which, for example, you have GOTO-like jumps.
FontForge has a TrueType instruction debugger that lets you step through the native TrueType instructions and watch how the outline gets modified by the TT instruction code.
If you look at the relevant Fontforge Doc, on top of the question whether you can, it appears there is also the question whether you may.
Edit ... or may have a version of FontForge that can (?)
According to the PfaEdit (prececessor to FontForge) changelog file (with date 10-Mar-2003), the TrueType instruction debugger is actually an interface to the FreeType truetype bytecode interpreter. To have access to the debugger, you need to compile FreeType with the byte code interpreter enabled. That would infringe patents in the US, Canada, France, the UK, Germany and Japan as described in this link of the FreeType project: FreeType & Patents. Here is an extract:
However, the source code for the bytecode interpreter is still available and can be toggled on at compile time, for those that want to use it anyway (because they purchased a license from Apple, or because they are in a country where the patents do not apply, etc.). For details please check the documentation that comes with your FreeType source package (it normally involves changing one configuration macro).
[...]
Licensing:
In the case where you need a patent license from Apple, please contact directly their legal department. We are unable to give you any pricing information, so please do not ask us about it.
Michel
>...on top of the question whether you can, it appears there is also the question whether you may.
Academic myth.
Professionally, I have never licensed anything from Apple and I've written any kind of instruction for anyone I've wanted, and that situation just turned 21.
This does not mean I can understand what Fontforge of Fontlab write, but that's another issue.
Cheers!
Note that while FontForge gives you a visual representation of what's happening due to hinting, it is still decompiling into assembly code. Those MIRPs and MDAPs are the native TrueType instructions.
Of the people in the world who do serious, high-end TrueType hinting, I'll bet less than 10% are at all fluent in TT assembly code. Sure, folks like Rickner or Bosma are, but most... not so much.
I would expect that learning TT assembly code is likely easier if one starts with a tool that works in a higher-level language, and compiles that to TT assembly which you can then inspect. Microsoft's Visual TrueType, for example, will show you those MIRPs and MDAPs, but allows you to work at a higher level as well. Maybe it's because I already know a couple of higher-level TT hinting tools, but it seems to me that would be a much easier approach to learning the low level stuff.
Regards,
T
John> But, as far as I know, you have not written a TrueType rasteriser. . .
There are no patents or legal issues stopping me from writing a TrueType rasteriser, which I'm not saying I've done or not done.
Rich> I'm assuming I won't have to jump through as many hoops as in Windows.
No, you just plug in the Mac and everything works fine, you don't need glasses anymore, and if you couldn't walk you can now.
Don't spill any water on the keyboard though unless you like wine.
Thomas> Of the people in the world who do serious, high-end TrueType hinting, I'll bet less than 10%...
You're getting into population too small to divide like that, or are there more than 10 now?
Cheers!
David, I'm basing my comments on the statements made by the FreeType developers here. FreeType 1 implemented a full set of hint interpretation routines. FreeType was then contacted by Apple's legal department and informed of some patents relating to specific hint types. FreeType 2 disabled support for interpretation of these hints (not all hints, just a subset).
The TT instructions you are looking at is just like a stack crawl.
The numbers you see are the point numbers, cvts, or other numeric values that are pushed onto the stack first then what follows are the instructions that use (or pop) these values. The MDAP is what is commonly called an Anchor and the MIRP is what could be called a link.
If the MDAP is the first instruction that pops values it will take the first value (which is probably a 1 for 'round the value'). It also pops the next value which will be the outline point number. It does not push anything back on the stack so the third value is now at the top of the stack.
The TrueType specification (originally from Apple) explains what each instructions does and what the Boolean values are for.
John Hudson,
I have read Freetype's wail several times now. It says incorrectly among many misrepresentations, "It is important to understand that the patents do not prevent anyone from reading, converting or generating TrueType fonts. As they only concern the subtle art of hinting TrueType glyphs."
And I said: Academic myth. Professionally, I have never licensed anything from Apple and I've written any kind of instruction for anyone I've wanted, and that situation just turned 21.
Then you said: "As I understand it, the concern about the Apple patents relates to the FreeType rasteriser, not to fonts."
Then I said: "There are no patents or legal issues stopping me from writing a TrueType rasteriser, which I'm not saying I've done or not done."
Then you pointed back to the BS myth making at Freetype.
There, the image of the ugly diagonals in a font hinted by mistake, according to legend, gets trotted out to scare the bejeezus out of anyone wanting to make web fonts that swing. It's myth.
Then TerminalDesign came and sang the plague song. Then Vinnie came to save us all from darkness.
And now the future happened.
Cheers!
I had noticed that odd wording on the FreeType side before, and I always figured the source of the confusion might be this:
I wonder if perhaps the FreeType folks are using the word "hinting" to mean "rasterization based on hint code that is in a font." Of course, those of us on the type design side use "hinting" to mean "adding hint code to fonts."
Plausible?
T
@Richard Fink
The Fontforge executable from the Fontforge site installed in seconds on my mini with OS X 10.6 but it is without the truetype debugger.
The Unofficial FontForge-mingw also installed in seconds on a version of Windows without frills (no cygwin, nothing) and has the debugger.
To get a mac version with the debugger, you need to compile from the Fontforge and Freetype sources. For the freetype sources, you follow the instructions in the file freetype-2.3.12/docs/TRUETYPE, compile and install. Then you build from the FontForge sources (better use the --with-freetype-src=dir configure option, else configure wastes a lot of time searching for the freetype sources) and install. That takes about fifteen minutes, provided pango, cairo etc are already installed. So, for someone that just wants to look at the debugger, fontforge-mingw looks like the best choice.
As for the more general question concerning the "Linux box", to avoid disturbing too much the mood of this thread I started a new one here.
Michel
With Macports you can install a version of fontforge with the truetype instruction debugger by typing the following commands in a terminal window (the % being the prompt, they are not part of the command)
% sudo port install freetype +bytecode
% sudo port install fontforge +with_freetype_bytecode
The installation took about 8 minutes on my MacBook pro since I already have all the libraries on which fontforge depends. Else those libraries will be fetched, compiled and installed, and that requires much more time (and patience).
First and most important — as it has been pointed out e.g. here on Typophile — the two main Apple patents on TrueType hinting expired six months ago.
The U.S. patent 5155805 (“Method and apparatus for moving control points in displaying digital typeface on raster output devices”) was filed on May 8, 1989 and issued on October 13, 1992, and it expired on October 13, 2009.
The U.S. patent 5159668 (same title) was filed on May 8, 1989 and issued on October 27, 1992, and it expired on October 27, 2009.
The U.S. patent 5325479 was filed on May 28, 1992 and issued on June 28, 1994. It is likely to expire on May 28, 2012. However, this was the second filing of the same patent as 5155805, and the first one was granted only after the second filing was done. As far as I understand, the term of expiration of the very first (oldest) filing counts.
So it can be assumed that all the relevant patents have expired now.
Second, patents typically describe a “method and apparatus for something”. The patents in question did not describe a particular arrangement of software programming instructions that would be the “method and apparatus”. The patented “method and apparatus” was, simply speaking, the TrueType instructions programming language (or aspects of how it works). In other words, the interpreter, not any particular code that should be interpreted, was patented.
Writing instructions for the interpreter did not infringe the patents. Writing an interpreter that would execute those instructions did.
But as I said, those patents expired now, so the discussion about myths is kind of moot :)
Best,
Adam
David, it isn't important to me at all. I just like to know what is the case of a thing. So when one set of people are saying 'We were contacted by Apple's legal department' and as a result of that contact have disabled aspects of their own software because of legal concerns about patent licenses, and someone else is saying its all a myth/lie, I'd like to know what is the truth of the thing. Either the FreeType people are wrong or you are wrong, or you are both in some way wrong, but since your statements are incompatible you can't both be right. As Adam points out, this is now an historical question, not because ‘the myths must be lies’ but because the patents in question have expired. But historical questions are still questions.
>-- whereas you apparently thought they meant nothing --
Yes, for 21 years, I've not only thought, but acted and documented to others that the patented instructions meant nothing. Use absence of this duo was never a problem for any user I ever heard of, despite the continued trotting out the main icon of this myth, the same unattributed font that's diagonally challenged without one of the patented instructions. The TT hinting language is complete and practical for hinting without a license to the once patented duo, and interpreters can skip those instructions to this day, if they ever find them, and no one will be the less readable.
So now that that's solved,) should we go on to the ClearType patents?
Cheers!
@michel boyer
Re: The ins and outs of installing FontForge on various platforms
Thanks a lot.
Downloaded the unofficial Windows version yesterday and today I might actually take a deep breath and click the installation batch file today.
Or, I might try installing it on an older XP machine I have in a few days. (Just being cautious.)
Thanks again for the explanation. Greatly appreciated.
Rich
Captured from web.archive.org on 17 Oct 2013. view this capture