I am curious to know which font extensions works better when using XeLaTeX to compile a TeX document. I have just downloaded the font Alegreya from CPAN, and it comes with a fonts
folder that includes folders with the font in several formats:
FOLDER FONT FILE EXTENSION
afm *.afm
enc *.enc
map just one file: Alegreya.map
pfm *.pfm
tfm *.tfm
truetype *.ttf
type1 *.pfb
vf *.vf
I know nothing about fonts and I didn't even know there were so many font formats out there in the wild, I have no idea what are they used for.
I tried type1
and truetype
formats in my TeX document by adding:
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[ Path = ./alegreya/fonts/truetype/huerta/alegreya/,
Extension = .ttf,
BoldFont = Alegreya-Bold,
ItalicFont = Alegreya-Italic,
BoldItalicFont = Alegreya-BoldItalic,
SmallCapsFont = AlegreyaSC-Regular,
SmallCapsFeatures = {Letters = SmallCaps},
Numbers = OldStyle
]{Alegreya-Regular}
to the preamble of my document (same for type1
using Path = ./alegreya/fonts/truetype/huerta/alegreya/
and Extension = .pfb
). Both formats work in the sense that I don't get any compilation errors and the PDF looks fine.
My question is: is there a preferred font to work with XeLaTeX that I should be using? What's the best practice regarding font embedding, if there is any? What should I use, ttf, pfb or other?
Cheers!
Best Answer
First let's have a look on all the files. Here is, what I guess they are (but I am no expert here...). Please also have a look on Mrs. Beeton's comment below which discusses some of my misinterpretations and gives more information on certain extensions:
.tfm
fonts relate to actual type1/truetype/metafont fontsThe question on
.ttf
vs. T1 is treated here and for sure somewhere on this site as well..vf
files are roughly TeX font metric files for 'virtual' fonts. These may be composed from characters taken from different fonts. For example, you could create a font including oldstyle figures using letters from a regular font and figures from a supplementary font. They may also tell TeX how to construct characters not present in the original font, including ligatures (e.g.ffi
) and accented characters (e.g.é
). Like.tfm
files, they also include metric information needed for bounding boxes, italic correction, the use of ligatures (e.g.f
+i
->fi
) etc. Please see here for very good information on this topic.Finally as a clear answer to your question: You should use the
.ttf
file here. As XeLaTeX is able to handle these fonts, you should use it. Even better would be.otf
, but I do not want to open a redundant font discussion here.