7

I'd like to have different settings for small caps letter space as a function of font size by using the appropriate fontspec settings when the compilation is done over XeLaTeX. So far I haven't been successful. This is my MWE:

\documentclass[12pt]{memoir}

\usepackage{xcolor,fontspec}

\setmainfont[
  UprightFont = *-Regular,
  BoldFont = *-Bold,
  SizeFeatures = {
    {
      Size = { -10},
      Color = green,
      SmallCapsFeatures = {
                            LetterSpace  =  30.0,
                            WordSpace  =  { 1.5, 1.5, 1.5 },
                          },
    },
    {
      Size = {10-14}, 
      Color = red,
      SmallCapsFeatures = {
                            LetterSpace  =  9.0,
                            WordSpace  =  { 1.5, 1.5, 1.5 },
                           },
   },
   {
     Size = {14- },
     Color = yellow,
     SmallCapsFeatures = {
                            LetterSpace  =  6.0,
                            WordSpace  =  { 1.5, 1.5, 1.5 },
                         },
   }
  }] {BulmerMTStd} %<- Any OpenType font of your choice

\pagestyle{empty}

\begin{document}
\noindent\scshape
{\tiny A tiny line.}\\
{\normalsize A normalsize line.}\\
{\LARGE A LARGE line.}
\end{document}

Colors are just for size range identification and letter space values are set as they are just for the sake of making the difference clear.

I've tried with different fonts, and I always get the same result, namely, letter space seems to be right for "intermediate" and "large" sizes, but it is wrong for the "smallest" sizes (with no apparent letter space at all). I guess I'm doing something wrong. What is the right way to achieve what I want?

EDIT: Actually, by playing with the LetterSpace key values and by explicitly closing in the Size key the open ranges from below or above I get different kinds of apparently weird behavior, in the guise of the letter spacings being intermingled among the different font size ranges.

1

I can't figure out why fontspec is acting so, but here is a workaround: add another size-feature, and so every SmallCapsFeatures will apply to the next size. A MWE:

\documentclass[12pt]{article}
\usepackage{xcolor,fontspec}
\setmainfont[
SizeFeatures = {
    {
        Size = { -1},
        Color = blue,
        SmallCapsFeatures = {
            LetterSpace=200.0, % <-- These features will apply to the next font size
            WordSpace={1.5,1.5,1.5 },% <-- These features will apply to the next font size
        },
    },
    {
        Size = { -10},
        Color = green,
        SmallCapsFeatures = {
            LetterSpace=9.0,% <-- These features will apply to the next font size
            WordSpace={1.5,1.5,1.5},% <-- These features will apply to the next font size
        },
    },
    {
        Size = {10-14}, 
        Color = red,
        SmallCapsFeatures = {
            LetterSpace=9.0,% <-- These features will apply to the next font size
            WordSpace={1.5,1.5,1.5},% <-- These features will apply to the next font size
        },
    },
    {
        Size = {14- },
        Color = yellow,
        SmallCapsFeatures = {
            LetterSpace  =  6.0,
            WordSpace  =  { 1.5, 1.5, 1.5 },
        },
    }
}] {Minion Pro} %<- Any OpenType font of your choice

\begin{document}
    \noindent\scshape
    {\tiny A tiny line.}\\
    {\normalsize A normalsize line.}\\
    {\Huge A LARGE line.}
\end{document}

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.