Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Knuth's original Tex implementation uses TFM files to use font information for typesetting. Since XeTeX supports TrueType and OpenType fonts through fontspec package, how does it use these type of fonts? Does it produce TFM file level information on the fly during typesetting? Also, is TFM format enough to represent all necessary information required for typesetting documents using OpenType or TrueType fonts? As a side question, if TFM files in generated on the fly, does it mean that unless a font is available on both in Linux and Mac, I can't compile a .dvi file on Linux and see it in Mac?

share|improve this question
1  
“Since XeTex supports TrueType and OpenType fonts through fontspec package”. It’s not through the LaTeX package that it has support for the TT/OT fonts! –  morbusg Apr 8 '13 at 5:15
    
2  
Run this minimal with xetex: \font\arial="Arial"\arial Foo\bye and notice how it doesn’t use any packages. –  morbusg Apr 8 '13 at 5:21
add comment

2 Answers

up vote 6 down vote accepted

Does it produce TFM file level information on the fly during typesetting?

No, XeTeX reads font metrics directly during typesetting (with the support of third party libraries), no “internal” TFM is generated for what XeTeX calls native fonts.

is TFM format enough to represent all necessary information required for typesetting documents using OpenType or TrueType fonts?

No, apart from the limitation on the number of glyphs represented by TFM files (which can be, more or less, eliminated e.g. Omega’s OFM files), OpenType provide more advanced typographic features far beyond the ligaturing mechanisms supported by TFM format.

… does it mean that unless a font is available on both in Linux and Mac, I can't compile a .dvi file on Linux and see it in Mac?

That is true, unless you have the exact same font file on the exact same location on both systems, XeTeX’s generated XDV (eXtended DVI) can not be processed on the other system. However, XeTeX’s final output is PDF files which are portable, the XDV files are regarded as intermediate representation, a mere implementation detail. Note also that this is true for regular DVI files; if you don’t have the same metrics files and fonts on both systems the DVI files can not be processed, DVI is device independent but not portable.

share|improve this answer
    
Thanks for answering my question. As a follow up question to #2 above, does XeTeX use any of the advanced features of TT/OT fonts for typesetting or it just uses information similar to TFM files? –  codefx Apr 9 '13 at 3:10
    
@codefx: it does of course, not directly though but through the third party layout engines it uses. –  Khaled Hosny Apr 9 '13 at 11:13
add comment

When you load a font in TeX, with a primitive command

\font\foo=bar

to which all high level macros (of LaTeX, for instance) eventually reduce, TeX will read the bar.tfm file and store in memory the information it contains.

There's no need of TFM files for OpenType and TrueType fonts in XeTeX, because the necessary information is already in the fonts' tables, which XeTeX is able to examine.

Actually XeTeX stores much more metric information than the usual font in TeX, which have normally only seven parameters. With

\font\foo="Linux Libertine O"

XeTeX knows values up to \fontdimen65 for this font. However the limit to seven \fontdimen parameters is not hardwired in the TFM format and a font can have any number of them (seven is the minimum for a text font, though).

The output format of XeTeX is XDV, an extension of the DVI format, for which no previewer is available. It's impossible to preview an XDV file with Xdvi or other DVI previewers. Indeed the XDV file is handed to xdvipdfmx during processing for producing a PDF file, which contains all the necessary information to be read on any platform.

share|improve this answer
    
It's worth noting that XeTeX is able to read OpenType fonts as the binary makes use of a text shaper library (in the current release XeTeX this is ICU, but HarfBuzz is used in the development version and will be with us 'real soon now'). Contrast the LuaTeX approach, where the binary does not have a text shaper but instead this is loaded as Lua code (and thus a 'plain' LuaTeX can't read OpenType files). –  Joseph Wright Apr 8 '13 at 8:43
    
@JosephWright Isn't harfBuzz Linux based? How is Windows accommodated? –  Yiannis Lazarides Apr 8 '13 at 9:11
    
@YiannisLazarides It's come from that background, but they provide stand-alone Windows binaries so presumable the correct deps are in the code. On TLContrib there are XeTeX v0.9999.0 builds for Mac and Win as well as Linux, so it seems to build for everyone :-) –  Joseph Wright Apr 8 '13 at 9:36
    
XeTeX does not actually use any of the extra \fontdimens it populates, they are there for macro packages to use them. –  Khaled Hosny Apr 8 '13 at 23:15
    
@YiannisLazarides: HarfBuzz is a portable library with no hard wired dependencies and has been used on non-Unix systems for years (e.g. in Firefox). –  Khaled Hosny Apr 8 '13 at 23:17
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.