0

Is it possible to use the comfortaa font for just a selected section of a document in XeLaTeX? I am quite inexperienced and am not sure how fonts work, and can currently only get it to work for either all of the document or none of it.

2
  • The truetype font files are part of the package, so you can use the font with fontspec under xelatex or lualatex: \documentclass{article} \usepackage{fontspec} \newfontfamily\fmyc{Comfortaa} \begin{document} Default text 123456789. {\fmyc Comfortaa font text 123456789.} \end{document} – Cicada Dec 13 '20 at 9:56
  • The above code finds the ttf files in the texmf tree: texlive/2020/texmf-dist/fonts/truetype/aajohan/comfortaa/Comfortaa-Regular.ttf – Cicada Dec 13 '20 at 10:03
1

You can copy the settings from the style:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\comfortaa{Comfortaa}[
    Extension=.ttf,%
    Ligatures={TeX,Common},%
    FontFace={l}{n}{*-Light},%
    FontFace={l}{it}{Font=*-Light,FakeSlant=0.167},%
    UprightFont={*-Regular},%
    ItalicFont={*-Regular},%
    ItalicFeatures={FakeSlant=0.167},%
    FontFace={b}{n}{*-Bold},%
    FontFace={b}{it}{Font=*-Bold,FakeSlant=0.167},%
    BoldFont={*-Bold},%
    BoldItalicFont={*-Bold},%
    BoldItalicFeatures={FakeSlant=0.167}]
 
\begin{document}

Some normal text, \textit{italic} and \textbf{bold}.

{\comfortaa Some text in Comfortaa, \textit{italic} and \textbf{bold}.}

Some normal text, \textit{italic} and \textbf{bold}.
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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