
So, to get this script running, you need the file shown in Binary file reading and writing. Some exceptions: using "Normal" or "Medium" instead of "Regular", and some font family names being an abbreviated version of the font name.
TRUETYPE FONT VIEWER CODE
I found that in all tested cases, I found the font name, so I dropped this backup solution to simplify code and accelerate the processing.Īlso note that in most cases, font name is really identical to font family + font subfamily. Note that the CodeProject code had a backup strategy: if the font name wasn't found, it tried to build it from the font family and subfamily (should not add it if it is "Regular"). If you find a font where this scheme fails, let me know.
TRUETYPE FONT VIEWER MAC
Note that it is more frequent to have a Mac name and no MS name (old fonts) than the reverse. To cope with these problems, I only read Macintosh font name if Roman and English (I could read if French, etc., but I think in 99.9% of cases, English is available.) and if not available, I read Microsoft US English font name, which seems to be always in Unicode encoding. Unlike its MS Mincho counterpart, it wrongly store the Macintosh platform strings, using Roman (0) encoding ID instead of Japanese (1) and Microsoft Japanese (1041) langage ID instead of Macintosh code (11). On my old system, I found some other fonts with this problem. They don't follow OpenType's strong recommendation ("we strongly recommend that the 'name' table of all fonts include Macintosh platform strings") and only have Microsoft platform strings. Kartika & Vrinda are fonts for Indic scripts. It contains some window decorations for older systems, and seems to have no name inside. Marlett.ttf is a particular system font, that some font utilities like Arjan Mels' Font Viewer even skip. It works in WinXP and in Win98 (at least) and even achieve decent performance on my old Pentium II 300MHz. I may have not covered all cases, but at least most of them: I analysed more than 400 fonts, recents and old, officials and amateur, and I got quite consistent results. I had to deal with some oddities to be able to get relevant informations in all cases.


Then, it was quite easy (almost!) to parse TrueType headers and figure out the relevant informations. I had first to be able to read binary files, and since AHK doesn't provide natively such facility, I had to adapt Laszlo routines for my needs. Since it was a nice challenge and a domain which interest me, I tried and made a pure AutoHotkey solution to this problem. He found a solution using a FreeType DLL but it seems to have lot of holes, and the additional DLL is a constraint.

TRUETYPE FONT VIEWER HOW TO
He provided a link to a CodeProject article showing how to do this.Īctually, I was familiar with this article as I used this code to provide a file tip giving nice information on the font below the cursor in Explorer (see first comment). Goyyah was interested in retreiving the font name from a TrueType (.ttf) file.
