This is a FreeType/2 users' mini-FAQ
Table of Contents:
Q1: Where can I find the latest FreeType/2 release?
Q2: When will you add font-smoothing to the DLL? I really
want that!
Q3: Why does IBM's TrueType engine do such a poor job?
Q4: But there are still differences with the glyphs produced
by Windows or the Mac, right?
Q5: I've got TrueType Times New Roman installed but the
system still seems to be using the original ATM (Type 1) font. Why this
odd behaviour?
Q6: I noticed it takes a second or two before the Font
Palette object opens for the first time. Why?
Q7: I noticed the characters sometimes
have odd spacing. When will you fix it?
Q8: Could you explain the open fonts limit?
Q9: Can you recommend some fonts to use?
Q10: What's a 'broken glyph'?
Q11: Why do some fonts appear twice, once starting with
an '@'?
Questions & Answers:
Q1: Where can I find the latest FreeType/2 release?
A1: Links to the latest release can be found at the FreeType/2 homepage at http://www.freetype.org/ft_os2/index.html
Q2: When will you add font-smoothing to the DLL? I really want that!
A2: Short answer: We can't.
Long answer: The FreeType library already supports font-smoothing (or antialiasing
or grayscaling). The problem is that OS/2's font engine, in its current
incarnation, doesn't know anything about anti-aliased text and is only
able to manage monochrome bitmaps. Font smoothing support would require
some changes of PM/GPI/GRE components, which certainly is out of our scope,
and isn't planned by IBM (to our knowledge) in foreseeable future, if ever.
If you really need font smoothing in your application, you can still use the FreeType library itself. Be warned that it is a rather low-level engine and that you'll need to add a various number of text features on top of this code to get the equivalent of PM's font API.
And if you really want font smoothing in OS/2, ask IBM!
Q3: Why does IBM's TrueType engine do such a poor job?
A3: It'd be easy to throw one or two stones at IBM's engineers if this was the result of lazy coding or bad software engineering. However, the problem is more complex, and PSP programmers deserve little, if any, blame.
Trouble is that the TrueType specification, which can be found both on Microsoft and Apple sites, has severe lacks, as well as particularly fuzzy definitions. Part of the TT spec is the TrueType bytecode specification. This bytecode is used to write glyph programs that are used to explicitely hint each glyph to have it rendered perfectly on the screen (and on printers). It is made of approximately 200 opcodes, which relate to moving points on a pixel grid, measuring distances in any kind of direction, keeping widths and heights consistent across a single font, etc..
Some of these opcodes are simply un-documented, or lack precise and important details related to their exact implementation. As a consequence, when FreeType started, it's first bytecode interpreter exhibited results which were very similar to OS/2's one (i.e. bad baseline, incoherent widths, "swashs" and bad serifs, etc..). There are several commercial engines which provide the same kind of "erroneous" output, like the one in the BeOS for instance.
It took FreeType developers _many_ months and experimentation to discover the real meaning of some opcodes, and incorporate it into the library. This "spelunker" work has been painful and slow, which is why few commercial companies, if any, dared to do it, but it finally pays off ! Moreover, the FreeType library is released under a BSD-like free license. This means that _anyone_ is now able to take the work that has been done to rewrite or fix his own TrueType interpreter. (Of course, another good idea is to use FreeType as your core TrueType engine, to be able to benefit to ongoing fixes and "undocumented features" discoveries, etc...)
Q4: But there are still differences with the glyphs produced by Windows or the Mac, right?
A4: Right. Another feature of the TrueType specification is to use fixed float pixel coordinates. When measuring distances along diagonals, some rouding error usually occur. Also, some TrueType opcodes have a more or less "chaotic" behaviour, where a ridiculous difference in inputs can produce vastly different results. These factors mean that the only way to match bit-to-bit the glyphs produced by Windows or the Macintosh is to implement the _exact_ same computation routines, and reproduce all their rounding errors ! As FreeType is a clean-room implementation, this will never be possible. Note that the bitmaps match in 95% cases, at least, and that there are already differences between the Win 3.1 and Win95 TrueType renderers (i.e. look at the "m" of Arial at size 8 for example).
The FreeType team tries very hard to "catch" differences, but there is a point where this just isn't possible... However, we're very satisfied with its current quality, and we hope you'll be too :-)
Q5: I've got TrueType Times New Roman installed but the system still seems to be using the original ATM (Type 1) font. Why this odd behaviour?
A5: It seems in case of a name clash OS/2 is using the font that was installed later. Try removing and reinstalling the TrueType font. Alternately remove the ATM (Type 1) font (not recommended).
Q6: I noticed it takes a second or two before the Font Palette object opens for the first time. Why?
A6: Because FreeType/2 postpones as much work on the fonts as possible until it's really needed. This means the first opening of a font is a bit slower. But it also means no resources are unnecessarily wasted. And it's not really that bad :-) This behaviour is also noticeable when e.g. opening a document for the first time. Note that subsequent openings are OK because OS/2 caches as much information as possible.
Q7: I noticed the characters sometimes have odd spacing. When will you fix it?
A7: I won't. It's not really a bug, it's a feature. If they weren't spaced 'oddly', the result might look better, but only at the cost of Windows-style 'WYSIWYG', i.e. what you see on screen will almost certainly look totally different on any other device. Anyway, the spacing is controlled by OS/2 and not by the Font Driver itself, so if you still don't like it, IBM is the right one to ask :-)
This problem is particularly visible in Netscape. Most probably this happens because Netscape tries to use fractional pointsizes, but most fonts don't allow that. This means that Netscape sometimes positions characters as if they were e.g. 8.6 points while their actual size is only 8 points.
Q8: Could you explain the open fonts limit?
A8: Sure. If you install 50 fonts in OS/2, the system opens them all at startup and keeps them open until shutdown. While many users may want to have large number of fonts installed (like me), very few of them probably use all the fonts all the time. This of course wastes lots of memory and swap space. Just for your information, normal fonts take up 30-50 K of memory with FreeType/2, but for example Times New Roman MT 30 takes over 500K!
FreeType/2 overcomes this problem by only actually keeping in memory the last n most recently used fonts. The actual number is settable via entry in OS2.INI and there's an simple REXX script to do that. Good default might be 10-15 fonts, depending what you want to do with them.
Note that this process is totally transparent to the system. You won't have to do anything, FreeType/2 will take care of everything. The only things you will notice is dramatically reduced memory consumption and when working with large numbers of fonts there may be slight delay when reopening a font.
Q9: Can you recommend some fonts to use?
A9: Yes! I recommend to use Micro$oft's (oh no!) Core Fonts - Times New
Roman, Arial and Courier New, plus other MS fonts. There are several reasons:
the fonts have very good quality, stick to the TrueType spec prety well,
support many countries and are widely available. Moreover they're free.
You can certainly find some Win95 or NT machine in your neighbourhood (all
too easily I'm afraid). They should also be available from MS's Web site.
Note: If you want to copy the fonts from a Win95 machine, they're in \WINDOWS\FONTS.
Watch out, the directory is hidden!
Q10: What's a 'broken glyph'?
A10: Some fonts contain buggy or 'broken' glyphs that cannot be reliably
loaded and rendered. Those glyphs are usually very rarely used so you might
never notice. There was a problem with the first Beta of FreeType/2 that
if there was a single broken glyph in a font, the
whole font didn't work.
Q11: Why do some fonts appear twice, once starting with an '@'?
A11: It's because of DBCS systems. If you don't have one, you can safely
ignore these fonts. The DBCS characters in them are rotated 90 degrees
counterclockwise. It allows you to write vertical text (e.g. Chinese) with
a normal word processor. You write the text horizontally but if you turn
the resulting page 90 degrees clockwise, you've got vertical text.
It's not working perfectly yet.