Fonts & Character SetsTurning on an alternate Glyph

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Turning on an alternate Glyph

Post by AleCes »

Hello everybody,

there's a particular Serbian glyph I want to turn on: this glyph, in FreeSerif Italic & BoldItalic, appears in the "salt" look up 10. I know I can turn on Style=Alternate, but the fact is "salt" is useful only with Language=Serbian and Script=Cyrillic and in the italic and bold italic versions, because this glyph doesn't appear in the regular (upright) or bold versions. Therefore I get tons of error messages and compiling takes aeons, all hassles I'd like to skip.

Code: Select all

\documentclass[a4paper]{book}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{FreeSerif}

\usepackage{polyglossia}
\setmainlanguage{serbian}

\usepackage{xunicode}
\usepackage{xltxtra}

\begin{document}
  \emph{ш}
\end{document}
Thank you for your cooperation.

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Turning on an alternate Glyph

Post by AleCes »

I found out I must add to \defaultfontfeatures {Alternate=0} to get the glyph, yet salt is only active in italic and italic bold, otherwise it gives me error messages, how can I let XeLaTeX know that he must enable the salt table only with italic and italic bold in Cyrillic script (not other scripts)?
AleCes
Posts: 286
Joined: Sat Nov 13, 2010 9:54 pm

Turning on an alternate Glyph

Post by AleCes »

The solution is this.

Code: Select all

\defaultfontfeatures{
  Mapping=tex-text,
  ItalicFeatures={
    Script=Cyrillic,
    Language=Serbian,
    Style=Alternate
  },
  BoldItalicFeatures={
    Script=Cyrillic,
    Language=Serbian,
    Style=Alternate
  }
}
Post Reply