(2016), No. 3 317
Total Page:16
File Type:pdf, Size:1020Kb
TUGboat, Volume 37 (2016), No. 3 317 GUST e-foundry font projects fonts and their structure and puts forward a few proposals concerning future works. Bogusław Jackowski, Piotr Strzelczyk and This is not an overly strict report, but rather a Piotr Pianowski story about our technical work on fonts, illustrated What is a document? It is a sequence of rectangles by representative examples which, we hope, show containing a collection of graphic elements. the essence of the matter. In order to keep our nar- What is a font? It is a sequence of rectangles containing ration smooth, we decided not to use formal captions a collection of graphic elements. with explanations to figures and tables (only num- — Marek Ryćko bers of figures and tables are given). The relevant 1 Introduction detailed descriptions always appear in the main text. The Polish TEX Users Group (GUST) has paid at- 2 Historical background tention to the issue of the fonts since the begin- PostScript and T X are genetically related: their ning of its existence. In a way, it was a must, be- E common ancestor is the ingenious idea of a program- cause the repertoire of the diacritical characters of ming language for the description of documents un- the Computer Modern family of fonts (CM), “canon- derstood as a sequence of rectangular pages filled ical” T X family defined as the Metafont programs E with letters and graphics. Both projects were de- (see [5]), turned out to be insufficient for the Polish vised nearly at the same time — at the turn of the language. The efforts of the GUST font team (GUST 1970s to the 1980s.1 And both are still alive and e-foundry), led by Bogusław Jackowski, were kindly well, proving that the idea behind both projects was acknowledged by the professor Donald E. Knuth: indeed brilliant. From our perspective, the most important thing in common, and at the same time a key distinc- tive element, was the different handling of fonts and graphics; in other words, both systems clearly distin- guished illustrations from fonts. That approach was justified by the computer technology at that time. For both TEX and PostScript, fonts were exter- nal entities, both used metric files plus files defining glyph shapes, both defined contours as Bézier splines Obviously, our first fonts were PK bitmap fonts pro- (planar polynomials of the 3rd degree), and for both grammed using Metafont. Alas, the TEX/Metafont fonts were to be prepared separately with dedicated bitmap font format never became the world-wide font programs, prior to creating documents. standard. Therefore, the next step were fonts in the And this exhausts the list of similarities. PostScript Type 1 format which fairly soon became TEX worked with binary metric files, TFM; its obsolescent and was replaced by the OpenType for- output, a device independent file (DVI), was pro- mat (OTF, a joint enterprise of Microsoft and Adobe, cessed by so-called drivers which made use of the 1996, see [31]) which is actually a common container “proper” fonts, that is, the relevant bitmap collec- for the Adobe PostScript Type1 and Microsoft True- tions, and produced output that could be sent to a Type (TTF) formats. In 2007, Microsoft extended printer or to a screen. The bitmaps were prepared the OTF standard with the capability of typesetting independently with the Metafont program(s) which math formulas, largely based on ideas developed for interpreted scripts written in the Metafont language TEX, and implemented it in MS Office. Soon, TEX and generated TFM and bitmap files. engines were adapted to process such math OTF In Metafont, the shapes of glyphs are defined fonts. Therefore our recent fonts are released in the as Bézier curves, stroked with a “pen” and/or filled. OpenType format, which also makes them easily us- Basic PostScript fonts (i.e., Type 1; see [28]) able outside of the TEX realm. employ contours defined as non-intersecting closed So far, no OTF successor is in sight, which is Bézier outlines which can only be filled.2 The “filled both good and bad (cf. Section 7.4). 1 We published our partial results successively as Formally, TEX was released a little earlier—TEX in 1982, PostScript in 1984, both with earlier work. the work progressed. This paper provides an overall 2 summary of our work: it describes the collections of The PostScript Type 1 documentation [28], p. 34, men- tions the possibility of stroking: a Type 1 font program can fonts prepared by the GUST e-foundry, deals with also be stroked along its outline when the user changes the some technical issues related to the generation of PaintType entry in the font dictionary to 2. In this case, GUST e-foundry font projects 318 TUGboat, Volume 37 (2016), No. 3 outline” paradigm relates also to the Microsoft TTF 3.1 Our tools format and, thereby, to the OTF format. Our primary tool was MetaPost [4], a successor of PostScript Type1 fonts are usually (but not nec- Metafont, which promised well as a tool for mak- essarily) accompanied by corresponding ASCII met- ing PostScript Type 1 fonts due to its native Post- ric files (AFM), not used by the interpreters of the Script output. We called our MetaPost-based pack- PostScript language. In the Microsoft Windows op- age MetaType 1 [13]. It was instantiated as a set of erating system, making an already complex situa- scripts using, besides MetaPost, T1utils, that is, Lee tion even more complex, binary printer font met- Hetherington’s (dis)assembler for PostScript Type 1 ric files (PFM) were introduced for Windows drivers fonts (cf. [3, 4]). A few scripts written in Gawk and that used PostScript Type 1 fonts. Perl were also employed. For a long time, only commercial programs for On the one hand, such a simple approach turned generating PostScript Type 1 fonts were available. out to be insufficient for generating OTF fonts, in Only in 2001, George Williams released his remark- particular OTF math fonts. On the other hand, it able FontForge program (initially dubbed PfaEdit; turned out to be flexible enough to include an extra [25]). FontForge can generate outline fonts in many external step for making OTF fonts. For text fonts, formats, including PostScript Type 1 and OTF. we employed the Adobe Font Development Kit for PostScript was promptly (and rightly) hailed as OpenType (AFDKO [26]); for math fonts, the Font- the standard for printers and, more importantly, for Forge library governed by Python scripts [15, 25]. phototypesetters, therefore a driver converting DVI In the future, we want replace AFDKO by a Font- files to PostScript became necessary. Fortunately Forge+Python utility (cf. Section 7). for TEXies, PostScript is equipped also with Type 3 A set of MetaPost macros in the MetaType 1 fonts; glyphs in Type 3 fonts can be represented by package defines two important procedures, essential nearly arbitrary graphic objects, in particular, by for generating non-intersecting outlines and heavily bitmaps, therefore the making of a PostScript driver used in our font programs: finding a common outline for converting DVI files to PostScript was possible al- for overlapping figures, known also as removing over- ready in 1986, when Dvips, the first and still most laps, and finding the outline of a pen stroke, known popular driver was released by Tomas Rokicki. (It’s as expanding strokes or finding the pen envelope. a pity that the idea of Type 3 fonts was not sup- Another important feature, hinting, is imple- ported and developed by Adobe.) mented, but, in the end, we decided to avoid man- There were a few unsuccessful attempts to con- ual hinting, since it is difficult to control and yields vert the basic TEX font collection, CM, to the Post- mediocre results. Metafont has no notion of hint- Script Type 1 format automatically, thus preserving ing — the Metafont language simply offers rounding. the parameterization. The main hindrance was the Moreover, the language for describing outlines in excessive usage of stroked (both painted and erased) PostScript Type 1 fonts cannot express even as triv- elements in the CM font programs, while, as was ial a mathematical operation as rounding. mentioned previously, the PostScript Type 1 and For low-resolution devices, controlled rounding OTF formats accept only filled shapes. is crucial — hence the idea of “hinting”, that is, con- The “filled outline” paradigm was a convenient trolled rounding. Alas, hinting algorithms remain optimization at the beginning of the computer type- undisclosed, especially with regard to commercial setting era, when, for example, the generating of the typesetting devices such as phototypesetters. One complete collection of bitmaps for the CM fonts at can presume, however, that low-resolution devices resolution, say, 240 dots per inch (typical for dot are bound to disappear sooner rather than later: the matrix printers) took a few days. Nowadays, the resolution of display devices has reached almost 600 paradigm still thrives by virtue of tradition: there dpi and 1200 dpi (and more) for printers is nowa- is an abundance of such fonts and, and what is worse, days nothing special. Therefore, running with the all operating systems support only this kind of font. hare and hunting with the hounds, we decided to 3 First steps hint our recently released OTF fonts automatically with FontForge. Taking the above into account, we made up our minds to design our own programmable system for generating fonts in “world-compatible” formats. 3.2 Trying our tools out overlapping subpaths will be visible in the output; this yields undesirable visual results in outlined characters. In practice, We tested our newborn MetaType 1 engine against this possibility is not used.