Introduction Text encodings Math font encodings OpenType math Summary

Do we need a ‘Cork’ math font encoding?

Dr. Ulrik Vieth

Stuttgart, Germany

TUG 2008, Cork, Ireland Introduction Text font encodings Math font encodings OpenType math Summary

What’ in this talk?

• Some history of font encodings • Some review of recent developments • Some discussion of future plans

• Font encodings () • Font technology (OpenType)

• New math for new TEX engines Introduction Text font encodings Math font encodings OpenType math Summary

Situation at Cork 1990

• TEX was undergoing major transition phase in 1989–90 • TEX version 3.0 just released in early 1990 • Support for multiple languages added • Support for 8-bit font encodings added • European TEX users groups founded in 1989–90 • European users strongly interested in new features • Better hyphenation of accented languages • Better font support of accented languages • European users started to work on fonts and encodings • European users agreed font encoding for 8-bit fonts ⇒ ‘Cork’ encoding, named after conference site Introduction Text font encodings Math font encodings OpenType math Summary

Benefits of the ‘Cork’ encoding

• Success of the ‘Cork’ encoding • provided model for further 8-bit text font encoding • provided support for many/most European languages • started further developments in font encodings

• Some design decisions done right • provided complete 7-bit ASCII subset (no exceptions) • consistent encoding for all font shapes (no variations) • consistent organization of uppercase/lowercase codes • no inter-dependencies between text and math fonts Introduction Text font encodings Math font encodings OpenType math Summary

Shortcomings of the ‘Cork’ encoding

• Some design shortcomings and their consequences • did not follow any standards (.. ISO Latin 1 or 2) ⇒ discrepancies between input and output encodings ⇒ solved in 1993–94 by LATEX 2ε inputenc, fontenc • tried to support many languages, but couldn’ support all ⇒ local encodings (QX, , L7X) used besides ‘Cork’ ⇒ solved in recent years by Latin Modern/TEX Gyre fonts • did not leave room for text symbols in font table ⇒ workarounds involving encoding switches to 7-bit fonts ⇒ solved in 1995 by adding text encoding (TS1) • did not consider available set of fonts ⇒ virtual fonts needed to fake some ⇒ 2 virtual fonts (T1, TS1) needed on top of real fonts ⇒ alternative encodings (LY1) proposed besides ‘Cork’ Introduction Text font encodings Math font encodings OpenType math Summary

Summary of text font encodings today

• What became of the ‘Cork’ encoding • adopted and followed by additional encodings (Tn) • supplemented by text symbol encoding (TS1) • complemented by local encodings (QX, CS, L7x) • complemented by alternative encodings (LY1) • Font encoding mess in current TEX systems • no single 8-bit font encoding can serve all needs • many different 8-bit font encodings needed instead • resolved only by moving to Unicode/OpenType • Latin Modern and TEX Gyre fonts • provide consistent implementations of many encodings • full glyph set available only in Unicode/OpenType fonts • many subsets available in 8-bit encodings/Type 1 fonts Introduction Text font encodings Math font encodings OpenType math Summary

Situation at Cork 2008

• TEX is undergoing another major transition phase • Recent developments • PDF output has largely replaced DVI and PS output • Scalable fonts have largely replaced bitmap PK fonts • Ongoing developments • Unicode and OpenType are starting to replace 8-bit fonts • Unicode and OpenType supported by new fonts and engines • New TEX fonts (Latin Modern, TEX Gyre) widely adopted • New TEX engines ( TE EX, LuaTEX) are becoming available • What’s missing? • Support for OpenType math in new TEX engines • Development of math fonts for Latin Modern, TEX Gyre Introduction Text font encodings Math font encodings OpenType math Summary

History of math font encodings

• Developments of math fonts • 7-bit text and math fonts developed simultaneously, driven by need to typeset books like TAOCP • 8-bit text font encodings developed by themselves, driven by need to support European languages • Need for 8-bit math fonts recognized early on, but not driven by specific user needs

• Reasons for new math fonts • remove inter-dependencies between text and math fonts • improve organization of new 8-bit math font encodings • support more symbols in same number of fonts (16 x 256) • provide consistent encodings for different font families Introduction Text font encodings Math font encodings OpenType math Summary

Progress on math font encodings

• The ’Aston’ proposal (1993) • Research work on math fonts organized by LATEX3 project • Results presented at TUG 1993 (Aston University, UK) • Proposal for organization of 8-bit math font encodings • Activities discontinued after a few months

• The ‘newmath’ prototype (1997–98) • Development work driven by some individual volunteers • Implementation based on ideas of ‘Aston’ proposal • Prototype based on METAFONT and fontinst work • Several font families supported (CM, Euler, MathTime) • Results presented at EuroTEX 1998 (St. Malo, France) • Activities side-tracked by other developments Introduction Text font encodings Math font encodings OpenType math Summary

Progress on math font encodings

• The Unicode math efforts (1998–2002) • Project to bring math symbols into Unicode (driven by AMS) • Research work to collect references of math symbol • Committee work to get symbols accepted in Unicode • Results are part of Unicode standard since 3.2

• The STIX fonts (1998–current) • Project to develop Unicode math fonts by science publishers • 1st beta in late 2007, 2nd beta expected in mid 2008 • Organization of fonts still under development • TEX support still missing, still to be developed Introduction Text font encodings Math font encodings OpenType math Summary

Recent developments on math font technology

• OpenType math in MS Office 2007 • Outside developments continued while waiting for STIX fonts • Microsoft implemented math support in MS Office 2007 • OpenType font format extended by new MATH table • Cambria Math font commissioned as reference implementation

• Acceptance of OpenType math • many concepts and ideas from TEX adopted by Microsoft • officially still experimental, but already de facto standard • widely deployed to installations of MS Office 2007 • adopted by independent font developers (Asana Math) • adopted and supported by FontForge font editor • adopted and supported by new TEX engines (X TE EX) Introduction Text font encodings Math font encodings OpenType math Summary

Recent developments on math font technology

• OpenType math support in new TEX engines • X TE EX support for OpenType math added since late 2007 • X TE EX support widely available soon with TEX Live 2008 • LuaTEX support still to be developed, but likely to follow

• OpenType math support in new TEX fonts ? • likely agreement to adopt OpenType math in new TEX engines • likely agreement to adopt OpenType math in new TEX fonts • font encoding becomes non-issue with Unicode math ⇒ no more need for a ‘Cork’ math font encoding • font technology becomes all-important with OpenType math Introduction Text font encodings Math font encodings OpenType math Summary

Features of OpenType math

• OpenType font format • developed jointly by Adobe and Microsoft • not really open, but vendor-controlled format • based on concepts from PS (CFF) and TT fonts • uses extensible table structure from TT fonts • supports ‘advanced’ typographic features • glyph positioning (GPOS table) • glyph substitutions (GSUB table) • options controlled at user-level by feature tags • encoding based on glyph names from Unicode • possible to have unencoded glyph variants • MATH table just another optional table meaningful only by interpretation in software Introduction Text font encodings Math font encodings OpenType math Summary

OpenType MATH table

• Font-specific (global) parameters • essential for spacing of big operators, fractions, indices, etc • similar to fontdimen parameters in TEX fonts (Appendix G) • some OpenType parameters correspond to TEX parameters • some OpenType parameters generalize TEX default values • a few TEX parameters don’t have clear correspondence • internal mapping in TEX engines some workarounds

• Glyph-specific metric information • encoded in TEX math fonts by overloading existing TFM fields • provided in OpenType MATH table in clear data structures • some generalization of TEX concepts (cut-ins in 4 corners) Introduction Text font encodings Math font encodings OpenType math Summary

Horizontal and vertical constructions

• Math extension fonts use special TFM features • one code point = series of next-larger glyph variants • optionally followed by recipe for extensible symbol • TFM features used only in limited contexts in TEX • big operators: 2 vertical sizes • big delimiters: vertical sizes + extensible version • wide accents: n horizontal sizes, but no extensible • Concepts generalized in OpenType math • vertical variants and constructions (operators, delimiters) • horizontal variants and constructions (wide accents) • also applicable to overbrace/underbrace or long arrows • variant glyphs remain unencoded, accessed only indirectly Introduction Text font encodings Math font encodings OpenType math Summary

Math alphabets

• Math fonts in TEX organized into 16 families of 8-bit fonts • one alphabet per family (roman, italic, script, etc) • selection of symbols distributed across remaining slots • Math alphabets in TEX • geometric symbols: fixed code in fixed family • alphabetic letters: fixed code, but changeable family • switch of font shapes = switch of math family = font switch • Math alphabets in Unicode • geometric symbols: Unicode slots in plane 0 (U+02xxx) • alphabetic letters: Unicode slots in plane 1 (U+1Dxxx) • different font shapes = different meaning = different slots • switch of font shapes = switch of Unicode slots = code switch Introduction Text font encodings Math font encodings OpenType math Summary

Optical sizes of superscripts/subscripts

• Math families in TEX loaded at 3 sizes (10/7/5 pt) • typical MF fonts: 3 optical sizes, adjusted for readablility • typical PS fonts. 1 design size, scaled-down, not adjusted • OpenType math supports optical sizes via features tags • feature "ssty=0,1" selects GSUB font substition for scripts • design variants for optical sizes packaged in one font • variant glyphs remain unencoded, accessed only indirectly • Math families in X TE EX implementation • math families in X TE EX still loaded at 3 sizes • could be loaded with 3 different fonts (LM Math 10/7/5) • could be loaded with same font, but different feature sets Introduction Text font encodings Math font encodings OpenType math Summary

OpenType feature tags

• Typical examples of OpenType features • small caps vs. regular lowercase • oldstyle figures vs. lining figures • optical design sizes (if availabe) • Use of OpenType features for variants • traditonal TEX and PS fonts use different fonts • modern OpenType fonts use features in same font • Use of OpenType features in TEX fonts • Latin Modern fonts use traditional model (based on MF) • TEX Gyre fonts don’t have variants yet (based on PS) • math fonts for LM/TG might start to use features Introduction Text font encodings Math font encodings OpenType math Summary

Summary and conclusions

• Future of math fonts • Unicode math replaces need for math new font enocding • OpenType math best candidate for math font technology

• Unicode/OpenType math support in new TEX engines • X TE EX support already available, but somewhat limited • LaTEX support still to be developed, but likely to follow

• Unicode/OpenType math support in new TEX fonts • Support for Unicode text already available in LM/TG • Support for Unicode math still to be developed • many challenges ahead for font designers and implementors Introduction Text font encodings Math font encodings OpenType math Summary

Challenges in OpenType math fonts

• Scope of the project • many new geometric symbols to be designed • many font shapes for alphabets to be designed • Organizational issues • font extends across multiple Unicode planes (> 16 bits) • many different designs/shapes to be packaged in one font • many size variants to be packaged in unencoded slots • many optical variants to be packaged in unencoded slots • Technical issues • global parameters in MATH table to replace fontdimens • glyph-specific metrics to replace overloaded TFM fields • horizontal and vertical constructions to be defined • font substitutions for optical sizes to be defined