MiKTeX and proTeXtMiktex and fontspec

Information and discussion about MikTeX distribution for Windows and the related proTeXt: Installing, updating, configuring
Post Reply
Leo__
Posts: 28
Joined: Thu Oct 28, 2010 4:33 pm

Miktex and fontspec

Post by Leo__ »

Hello,

I am on Miktex 2.9, Windows 7 and am trying to get (new) hebrew fonts to work with polyglossia and fontspec. My pb looks very similar to that of Arieh (http://latex.org/forum/viewtopic.php?f= ... eh#p101904), except that he's on TexLive and Ubuntu.

I used cardo as the new font.

I installed the fonts in a local directory: c:/localtexf/fonts/cardo/,
and I used the specification
Path = localtexf/fonts/cardo/,
as seems recommended by the fontspec manual.

Here is a MWE:

Code: Select all

\documentclass{article}
    \usepackage{fontspec} 
    \setmainfont[Path = localtexf/fonts/cardo/,
    UprightFont = *-Regular,
    ItalicFont = *-Italic,
    BoldFont = *-Bold]{Cardo} 
    \usepackage{polyglossia}
    \setdefaultlanguage{english}
    \setotherlanguage{hebrew}
    \newfontfamily\hebrewfont[Script=Hebrew]{Cardo}
    \begin{document}
    This hebrew text is Gen.1:1 from BHS\\
    \RL{בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים}\\ % result: misplaced vowels & diacritics
    \begin{hebrew}
      \RL{בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים}
    \end{hebrew}\\ % result: right placed vowels & diacritics 
    Text again.
    \end{document}

I get the error message:
! fontspec error: "font-not-found"
!
! The font "Cardo-Regular" cannot be found.
!
! See the fontspec documentation for further information.

If the issue is specific to Miktex (as I see that it was successfully resolved under Ubuntu with TexLive), please let me know.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Miktex and fontspec

Post by rais »

Well, according to fontspec's manual, you've reversed the positions of mandatory and optional arguments to \setmainfont...
texdoc fontspec wrote: \setmainfont{texgyrepagella}[
Path
= /Users/will/Fonts/ ,
UprightFont
= *-regular ,
BoldFont
= *-bold ,
... ]
Furthermore: where do you think ``Path = localtexf/fonts/cardo/'' leads to? Mayhap it's leading to ./localtexf/fonts/cardo---which would be underneath your (.tex) document's folder...

Perhaps you'd be better off putting the font into your Window's font folder and omit the optional argument to \setmainfont, it should be found there by XeLaTeX and friends out-of-the-box.

Personally, I'd drop the font in ~/.fonts, run `fc-cache ~/.fonts', after which I should be able to use the font using XeLaTeX (and friends).
But then, I'm under Linux, not Win$...

KR
Rainer
Arieh
Posts: 4
Joined: Wed Aug 23, 2017 3:50 pm

Miktex and fontspec

Post by Arieh »

Hello Leo__,

Try specifying the extension of the font:

Code: Select all

\setmainfont[
  Path = /localtexf/fonts/truetype/cardo/,
  UprightFont = *-Regular ,
  BoldFont = *-Bold ,
  ItalicFont = *-Italic ,
  Extension = .ttf
 ]{Cardo} %Cardo
Leo__
Posts: 28
Joined: Thu Oct 28, 2010 4:33 pm

Miktex and fontspec

Post by Leo__ »

It works ! Thanks Arieh. But I'll try rais' suggestion nevertheless.
Post Reply