Fonts & Character SetsNewbie help with fontspec

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
BernieC
Posts: 11
Joined: Sat Jan 11, 2020 10:36 pm

Newbie help with fontspec

Post by BernieC »

I'm trying to learn to use fontspec on win10 with XeLaTeX. I've got a little test file:

Code: Select all

\documentclass[12pt]{article}

\usepackage{fontspec}

\setmainfont{BKANT.ttf}
% also tried \setmainfont{BKANT}
% and \setmainfont{Book Antiqua}

\begin{document}
hello world
\end{document}
And the font exists [it is my default windows font for most everything] but when I try to run that little file, usig XeLaTeX, I get

Code: Select all

! Package fontspec Error: The font "BKANT" cannot be found.

For immediate help type H <return>.
 ...
When I tried just BKANT it was looking for BKANT.mf, and when I looked for the .ttf file I got the above error. Do I have to do something specail to get fontspec to open a truetype font?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
BernieC
Posts: 11
Joined: Sat Jan 11, 2020 10:36 pm

Newbie help with fontspec

Post by BernieC »

I have located the problem, and it may be a bug in fontspec. The missing .ttf files are all in

C:\Users\win10\AppData\Local\Packages\DB6EA5DB.PowerMediaPlayerforDell_mcezb6ze687jp\LocalCache\Local\Microsoft\Windows\Fonts

I have no idea why the hell they're there and not in c:\windows\fonts, but that's where they are. and indeed, there it is:

Directory of C:\Users\win10\AppData\Local\Packages\DB6EA5DB.PowerMediaPlayerforDell_mcezb6ze687jp\LocalCache\Local\Microsoft\Windows\Fonts

11/12/1998 07:18 AM (155,528) BKANT.TTF

Now comes the question: how do I get fontspec to look in that bizarre directory for fonts?
BernieC
Posts: 11
Joined: Sat Jan 11, 2020 10:36 pm

Newbie help with fontspec

Post by BernieC »

I've been thinking about it and I can 'install' the BKANT.TTF font file from its weird/strange place. BUT: how do font-families work in LaTeX? the BKANT.TTF is just the 'regular' boot antiqua font.but the I/b/ib font files are ANTIQU{i|b|ib].ttf in that same, remote directory. How would LaTeX find the variant font files if it can only find the main file?

This is very confusing. What seems to be the case is that "Book Antiqua" is a "font family" in windows and it has four .ttf files associated with it [mentioned above]. I'd think that if the XeTeX fontspec machinery were working properly, I should be able just to specify "Book Antiqua" and from there it ought to be able to locate the four .ttf files the same way word, excel, my email client, my address book, etc, all manage to
Post Reply