# Use font in XeTeX not installed on my system

Using XeLaTeX, how can I use a font that I have downloaded in a folder, but have not installed on my system? I have tried to specify the path in setmainfont{Path = C:/MyFolder/MyFonts/, but I receive the error message fontspec error: "font-not-found"

Based on what I have found googling, I have tried these options, but they all give the same error message:

\setmainfont{Path = C:/MyFolder/MyFonts/}{LinLibertine_Rah.ttf}
\setmainfont{Path = C:/MyFolder/MyFonts/LinLibertine_Rah.ttf}
\setmainfont{Path = C:/MyFolder/MyFonts/}{LinLibertine}
\setmainfont{Path = C:/MyFolder/MyFonts/LinLibertine}
\setmainfont{Path = C:/MyFolder/MyFonts/}{Linux Libertine}
\setmainfont{Path = C:/MyFolder/MyFonts/Linux Libertine}
\setmainfont[Path = C:/MyFolder/MyFonts/]{LinLibertine_Rah.ttf}
\setmainfont[Path = C:/MyFolder/MyFonts/LinLibertine_Rah.ttf]
\setmainfont[Path = C:/MyFolder/MyFonts/]{LinLibertine}
\setmainfont[Path = C:/MyFolder/MyFonts/LinLibertine]
\setmainfont[Path = C:/MyFolder/MyFonts/]{Linux Libertine}
\setmainfont[Path = C:/MyFolder/MyFonts/Linux Libertine]

-
Shouldn't path in Windows be using backslashes as directory delimiters? Should it be C:\MyFolder\Myfonts\ ? –  ArTourter Jul 18 '12 at 21:56
I tried (on win xp with miktex 2.9.) \setmainfont[Path = J:/Install/Schriften/]{Inconsolata.otf} and the font was found. Are your folders really called "MyFolder" and "MyFonts" or do the real names contain things like space or unusual chars which could lead to problems? –  Ulrike Fischer Jul 19 '12 at 9:16
I've stopped using spaces in names of folders and files, and replaced them with underscores. It turns out that was what XeTeX couldn't read. Once I removed the underscores, it worked. –  Sverre Jul 19 '12 at 14:15
@ArTourter: For many years, Windows accepts paths with /. –  Paul Gaborit Jul 19 '12 at 20:00
show 1 more comment

Based on the comments and suggestions I received, I'm providing the solution here.

\setmainfont[   Path              = C:/MyStuff/Fonts/LinLibertineTTF/,
Extension         = .ttf,
BoldFont          = LinLibertine_RBah,
ItalicFont        = LinLibertine_RIah,
BoldItalicFont    = LinLibertine_RBIah,
SmallCapsFeatures = {Letters = SmallCaps},
Numbers           = OldStyle
]{LinLibertine_Rah}


Avoid spaces and underscores in your path.

-
\setmainfont[Path=C:/MyFolder/MyFonts/]{LinLibertine_Rah.ttf}

@Sverre I agree with Ekin. Presumably if you have a file at C:/MyFolder/MyFonts/LinLibertine_Rah.ttf then your (currently) 7th example should have worked. Your other attempts are largely gibberish. –  Will Robertson Jul 19 '12 at 5:42