3

I am trying to create a fontspec definition file for Minion3 which includes all the optical sizes. I have it working when I define every thing in one single defaultfontfeatures definition:

\defaultfontfeatures[Minion3]
{
    UprightFont  = Minion3-Regular,
    BoldFont     = Minion3-Bold,
    ItalicFont   = Minion3-Italic,
    BoldItalicFont = Minion3-BoldItalic,
    %Numbers      = {Proportional,OldStyle},
    Numbers      = {Proportional},
    SizeFeatures = {
        { Size   = -9.9, Font = Minion 3 Caption },
        { Size   = 9.9-13.9 },
        { Size   = 13.9-25.9, Font = Minion 3 Subhead},
        { Size   = 25.9-, Font = Minion 3 Display},
    },
    BoldFeatures = {
        SizeFeatures = {
            { Size   = -9.9, Font = Minion 3 Caption Bold},
            { Size   = 9.9-13.9 },
            { Size   = 13.9-25.9, Font = Minion 3 Subhead Bold},
            { Size   = 25.9-, Font = Minion 3 Display Bold},
        },
    },
    ItalicFeatures = {
        SizeFeatures = {
            { Size   = -9.9, Font = Minion 3 Caption Italic},
            { Size   = 9.9-13.9 },
            { Size   = 13.9-25.9, Font = Minion 3 Subhead Italic},
            { Size   = 25.9-, Font = Minion 3 Display Italic},
        },
    },
    BoldItalicFeatures = {
        SizeFeatures = {
            { Size   = -9.9, Font = Minion 3 Caption Bold Italic},
            { Size   = 9.9-13.9 },
            { Size   = 13.9-25.9, Font = Minion 3 Subhead Bold Italic},
            { Size   = 25.9-, Font = Minion 3 Display Bold Italic},
        },
    },
}

However, according to the fontspec manual (page 12--13) I should be able to have in the same file a declaration for each Regular, Bold, Italic and BoldItalic fonts, like so:

\defaultfontfeatures[Minion3]{
    UprightFont     = {Minion3R},
    BoldFont        = {Minion3B},
    ItalicFont      = {Minion3I},
    BoldItalicFont  = {Minion3BI},
    %Numbers      = {Proportional,OldStyle},
    Numbers      = {Proportional},
}
\defaultfontfeatures[Minion3R]{
    Extension       = .otf,
    Font            = Minion3-Regular,
    SizeFeatures = {
        { Size   = -9.9, Font = Minion3Caption-Regular },
        { Size   = 9.9-13.9 },
        { Size   = 13.9-25.9, Font = Minion3Subhead-Regular},
        { Size   = 25.9-, Font = Minion3Display-Regular},
    },
}
\defaultfontfeatures[Minion3B]{
    Font            = Minion3-Bold,
    SizeFeatures = {
        { Size   = -9.9, Font = Minion3Caption-Bold },
        { Size   = 9.9-13.9 },
        { Size   = 13.9-25.9, Font = Minion3Subhead-Bold},
        { Size   = 25.9-, Font = Minion3Display-Bold},
    },
}
\defaultfontfeatures[Minion3I]{
    Font            = Minion3-Italic,
    SizeFeatures = {
        { Size   = -9.9, Font = Minion3Caption-Italic },
        { Size   = 9.9-13.9 },
        { Size   = 13.9-25.9, Font = Minion3Subhead-Italic},
        { Size   = 25.9-, Font = Minion3Display-Italic},
    },
}
\defaultfontfeatures[Minion3BI]{
    Font            = Minion3-BoldItalic,
    SizeFeatures = {
        { Size   = -9.9, Font = Minion3Caption-BoldItalic },
        { Size   = 9.9-13.9 },
        { Size   = 13.9-25.9, Font = Minion3Subhead-BoldItalic},
        { Size   = 25.9-, Font = Minion3Display-BoldItalic},
    },
}

Unfortunately the second version doesn't work and the compilation fails with the error

! Package fontspec Error: The font "Minion3R" cannot be found.

the fontspec definition file is called Minion3.fontspec

and an test tex file to demonstrate the features is taken from http://tex.stackexchange.com/q/126096/14066 (https://bitbucket.org/phg/lua-la-tex-tests/src/default/latex/ltx-fontspec-optical-size-3.tex):

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

%% set your font here

%\setmainfont {Arno Pro}
\setmainfont{Minion3}

%% helper for extracting the font name name, please ignore

\def\fontinfo{%
  \directlua {
    local f = fonts.hashes.identifiers [font.current ()]
    if f then
      tex.sprint (f.fullname, " ", string.sub (tostring (f.size / 2^16), 1, 4), "pt")
    end
  }%
}

%% testing macro

\def\test#1{%
  #1\section {\detokenize {#1}}
  \begin {itemize}
    \item {\rmfamily \upshape \fontinfo}
    \item {\rmfamily \upshape \bfseries \fontinfo}
    \item {\rmfamily \itshape \fontinfo}
    \item {\rmfamily \itshape \bfseries \fontinfo}
    \item {\rmfamily \scshape \fontinfo}
  \end {itemize}
}

\begin {document}

  testing family ``\rmdefault'' ...\par\vskip1cm

  \test\tiny
  \test\scriptsize
  \test\small
  \test\normalsize
  \test\large
  \test\Large
  \test\LARGE
  \test\Huge

\end {document}

I am certain I am missing something obvious but cannot figure out what.

Edit:

Since this is not a Minion3 issue and this font is proprietary, it may be hard to replicated. This issue is also currently reproducible without the SizeFeatures, so I adding a new MyXCharter.fontspec file which reproduce the first hurdle with a font set that comes with texlive:

\defaultfontfeatures[MyXCharter]{
   UprightFont     = {XCharterR},
   BoldFont        = {XCharterB},
   ItalicFont      = {XCharterI},
   BoldItalicFont  = {XCharterBI},
   SlantedFont      = {XCharterS},
   BoldSlantedFont  = {XCharterBS},
   %Numbers      = {Proportional,OldStyle},
   Numbers      = {Proportional},
}
\defaultfontfeatures[XCharterR]{
   Extension       = .otf,
   Font            = XCharter-Roman,
}
\defaultfontfeatures[XCharterB]{
   Extension       = .otf,
   Font            = XCharter-Bold,
}
\defaultfontfeatures[XCharterI]{
   Extension       = .otf,
   Font            = XCharter-Italic,
}
\defaultfontfeatures[XCharterBI]{
   Extension       = .otf,
   Font            = XCharter-BoldItalic,
}
\defaultfontfeatures[XCharterS]{
   Extension       = .otf,
   Font            = XCharter-Slanted,
}
\defaultfontfeatures[XCharterBS]{
   Extension       = .otf,
   Font            = XCharter-BoldSlanted,
}
  • Does it work if you declare Minion3R before you reference it? – Davislor Aug 5 '19 at 19:56
  • @Davislor I had tried that before and no, it doesn't make any difference. The weird thing is that if I tell the compiler to ignore the error and continue, it finds the fonts, although not the ones defined in the SizeFeatures (independently of the order). – ArTourter Aug 5 '19 at 20:49

Your Answer

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

Browse other questions tagged or ask your own question.