Compile with pdflatex or xelatex?
2025年8月10日The fonts used in a latex document affects the compilation engine.
void IsFontCompatibleToXeLatex(string fontFamilyName, string latexFileContent) {
if (latexFileContent.Contains("\usepackage{fontspec}"))
{
Console.WriteLine($"{fontFamilyName} will be loaded from font files of your operating system.");
return;
}
string package = FindPackage(fontFamilyName);
var files = LoadPackage(package);
bool hasTU = files.Contains($"TU{fontFamilyName}.fd");
bool hasLegacy = files.Contains($"T1{fontFamilyName}.fd") || files.Contains($"OT1{fontFamilyName}.fd");
if (!hasTU && hasLegacy)
Console.WriteLine($"{package} provides {fontFamilyName} only in 8-bit encoding; use with pdfLaTeX.");
else
Console.WriteLine($"{fontFamilyName} can be used with XeLaTeX.");
}
TODO: kpsewhich
See also https://tex.stackexchange.com/questions/373617/latex-fonts-for-dummies