Fonts & Character Setschange font with fontspec

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
sudanix
Posts: 5
Joined: Sat Feb 20, 2010 10:04 pm

change font with fontspec

Post by sudanix »

Hello,

I have a problem in changing my article font.
I want to use Consolas font, its installed in my Windows.

here is the tex file:

Code: Select all

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmainfont{Consolas} 

\begin{document}

hello,
How i can load consolas font ?
the font is installed in my system, and i can use it from other software.
Thanks.

\end{document}
i got the error:
Couldn't find `Consol.cfg'

miktex-maketfm: No creation rule for font Consolas.

! Font \zf@basefont=Consolas at 10.0pt not loadable: Metric (TFM) file or insta
lled font not found.
\zf@fontspec ...ntname \zf@suffix " at \f@size pt
\unless \ifzf@icu \zf@set@...
l.5 \setmainfont{Consolas}

?
How can i solve this problem?
I use Miktex 2.8 , and i compiled it with XeLaTeX.

Thanks in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: change font with fontspec

Post by meho_r »

1. Double-check if Consolas font resides in C:\Windows\Fonts, along other fonts.

2. After that try loading another font present in Fonts folder instead of Consolas in your code (which works fine on Linux, btw) and see if it works.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

change font with fontspec

Post by frabjous »

Are you sure you're compiling with XeLaTeX? Those errors look like the kind you get if you try compile a fontspec document with regular latex.

If you wanted to stick with regular latex or pdflatex, consider the inconsolata package, which provides a font that is almost indistinguishable from Consolas, if I remember what consolas looks like anyway.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{inconsolata}


\begin{document}
\ttfamily
hello,
How i can load consolas font ?
the font is installed in my system, and i can use it from other software.
Thanks.

\end{document}
sudanix
Posts: 5
Joined: Sat Feb 20, 2010 10:04 pm

Re: change font with fontspec

Post by sudanix »

@ meho_r :
I checked again , and i found it in C:\WINDOWS\Fonts .
and i try to use another installed font (Calibri) but i get the same error !
but its work fine for some fonts..


@ frabjous:
yes im sure, and i should use XeLaTex because my article will contain non-latin sentence.

Any Suggestions ?

Thanks for helping.
sudanix
Posts: 5
Joined: Sat Feb 20, 2010 10:04 pm

Re: change font with fontspec

Post by sudanix »

it solved now :D
i re-installed the Miktex again, and it work now .

Thanks again.
Post Reply