[Tex/LaTex] Strange latex font warnings with fontsize, tikz, fontspec

fontsizefontspectikz-pgfxetex

This is mostly the same code as in:

… but with a few changes – notably, it uses fontspec with Junicode font, and so needs to be compiled with xelatex. This is the MWE:

\documentclass[12pt,a4paper]{article}

\usepackage[pass]{geometry}
\usepackage{tikz,enumitem}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Junicode}


\begin{document}

\pdfpagewidth=148mm \pdfpageheight=210mm % for PDF output
\paperwidth=148mm \paperheight=210mm     % for TikZ


\begin{tikzpicture}[overlay,remember picture,y=0.80pt,x=0.80pt,yscale=-1, inner sep=0pt, outer sep=0pt,anchor=north west]

  \begin{scope}[shift={(0,0.34461553)}]% layer1

  \fontspec[Scale=0.83]{Junicode}
  \fontsize{21}{27.3}\selectfont % introduces: "LaTeX Font Warning:"...

  \path[fill=blue] (10,10) node[below right] (text3134) {%
      \begin{minipage}{150pt}%
        \begin{itemize}[leftmargin=*,topsep=0pt,itemsep=0pt]%
          \setlength{\parskip}{0pt}%
          \item[\textcolor{red}{\textbullet}] Hello
          \item 2\textsuperscript{\fontsize{9}{11.7}\selectfont nd} {\scshape Entry}
        \end{itemize}%
      \end{minipage}
  }%path
  ;

  \end{scope}

\end{tikzpicture}
\end{document}

When I run xelatex test.tex; when the line \fontsize{21}{27.3}\selectfont the following warnings are generated:

[...]
*geometry* detected driver: xetex
ABD: EveryShipout initializing macros

LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <10.5> not available
(Font)              size <10.95> substituted on input line 29.


LaTeX Font Warning: Font shape `OMS/cmsy/m/n' in size <10.5> not available
(Font)              size <10.95> substituted on input line 29.


LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <10.5> not available
(Font)              size <10.95> substituted on input line 29.

[1] (./test.aux)

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 0.45pt have occurred.

 )
Output written on test.pdf (1 page).
Transcript written on test.log.

Now, as far as I can read font warnings, shapes like OT1/cmr/m/n would refer to Computer Modern font – and yet, I never requested that font; I though Junicode was now default? Where did this warning come from, then – and why does it appear only when the very first \fontsize{21}{27.3}\selectfont is enabled?

My idea with the code above was to specify a default font scale first (as in "global scale") with \fontspec[Scale=0.83]{Junicode}; then specify default font size with \fontsize{21}{27.3}\selectfont – then possibly override the default font size (like with \fontsize{9}{11.7}). (I'd expect both fontsize, 21 and 9, to be scaled by 0.83).

I'd say, the generated PDF does look like what I expect it to (though I haven't precisely measured whether the sizes are really scaled as I expect them) – however, these warnings confuse me – why do they appear and how to eliminate them?

Many thanks in advance for any answers,
Cheers!

Best Answer

For quite intricate reasons, the math fonts are still loaded (and at fixed sizes); the warnings are actually completely innocuous, but annoying. You can get rid of them by loading

\usepackage{fix-cm}

Note

I don't understand the line

\fontspec[Scale=0.83]{Junicode}\fontsize{21}{27.3}\selectfont

Wouldn't

\fontsize{17.5}{27.3}\selectfont

do just the same? In any case, \fontspec is a heavy macro to use and it's best to use \newfontfamily in the preamble; but, in this case, \addfontfeatures{Scale=0.83} would do the same.