5

In the .otf fonts where they are present, the Contextual Alternate (calt) and Localized Forms (locl) functions work fine in LibreOffice.

Experiment: I create a quoteright.fr glyph with a large bearing and impose a calt because quoteright glyph in Italian and in French is replaced by quoteright.fr glyph.

With LibreOffice the difference is evident: for the first line I set the Italian language, for the second line the English language (without bearing):

enter image description here

Instead with Xetex I can not enable these functions.

If I do not specify anything in the font features, the contextual substitution rule does not work.

If I enter Contextuals = Alternate I receive the message:

Package fontspec Warning: OpenType feature 'Contextuals = Alternate' (calt) not
(fontspec) available for font 'GaramondPremPro' with script
(fontspec) 'Latin' and language 'Default'.

and again the contextual replacement rule does not work.

Here is Xetex (first line in Italian, second in English

enter image description here

with the following code:

\documentclass {article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{Garamond Premier Pro}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguages{english}

\begin{document}

I'I N'P

\begin{english}I'I N'P\end{english}
\end {document}

What can you depend on? Is there an error or a lack in my code?

Thank you

PS

otfinfo -f recognizes only system-wide features, and not localized ones (neither calt nor locl), that are also present in the font if I check it with FontLab or FontForge:

samiel@darkstar:~/work$ otfinfo --features font.otf

aalt    Access All Alternates
c2sc    Small Capitals From Capitals
cpsp    Capital Spacing
dnom    Denominators
frac    Fractions
kern    Kerning
liga    Standard Ligatures
lnum    Lining Figures
numr    Numerators
onum    Oldstyle Figures
pnum    Proportional Figures
smcp    Small Capitals
sups    Superscript
tnum    Tabular Figures
zero    Slashed Zero

PS2

I tried various possibilities. The following one:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Numbers=OldStyle,Language=Italian,RawFeature={+calt}]{Garamond Premier Pro}
\usepackage{polyglossia}
%\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguages{english}

\begin{document}

I'I N'P

\begin{english}I'I N'P\end{english}

\end{document}

produces the calt all over the document, not only for Italian and French languages (as in the font localized calt rule).

If I set

\setmainfont[Ligatures=TeX,Numbers=OldStyle,RawFeature={+calt}]{Garamond Premier Pro}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}

the replacement is never produced

Added answer to wrong question:

I tried various possibilities. The following one:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Numbers=OldStyle,Language=Italian,RawFeature={+calt}]{Garamond Premier Pro}
\usepackage{polyglossia}
%\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguages{english}

\begin{document}

I'I N'P

\begin{english}I'I N'P\end{english}

\end{document}

produces the calt all over the document, not only for Italian and Frenc (as inthe font cal rule.

If I set

\setmainfont[Ligatures=TeX,Numbers=OldStyle,RawFeature={+calt}]{Garamond Premier Pro}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}

the replacement is never produced

  • 1
    did you try to change the language? \setmainfont[Ligatures=TeX,Numbers=OldStyle,Language=Italian]{GaramondPremPro}? – Ulrike Fischer Dec 30 '18 at 19:50
  • Yes, but nothing chages. It takes general font settings and not calt – user41063 Dec 30 '18 at 20:04
  • Well without the font it is difficult to test. If your feature needs locl you could activate it with the RawFeature key. – Ulrike Fischer Dec 30 '18 at 20:13
  • I happens with all other otf I tried – user41063 Dec 30 '18 at 20:21
  • 2
    If you know a free font which can be used for tests, add the info to the question. – Ulrike Fischer Dec 30 '18 at 20:36
5

The font in your comment works fine for me:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Language=Italian]{SamielPro.otf}
\setsansfont[]{SamielPro.otf}

\begin{document}

I'I N'P

\sffamily 
I'I N'P


\end{document}

enter image description here

With lualatex it doesn't work, there one need to add the calc-feature explicitly:

\setmainfont[Language=Italian,RawFeature=+calt]{SamielPro.otf}

A language depending call could be setup with babel and \babelfont:

\documentclass{article}
\usepackage{fontspec}
\usepackage[english,italian]{babel}
\babelfont{rm}[Ligatures=TeX]{SamielPro.otf}

% for luatex:
%\babelfont[italian]{rm}[RawFeature=+calt,Ligatures=TeX]{SamielPro.otf}

\begin{document}

I'I N'P

\selectlanguage{english}
I'I N'P

\end{document}
  • sorry, I don't understand your usage of \sfamily – user41063 Dec 30 '18 at 21:19
  • I simply wanted the two variant under different commands. – Ulrike Fischer Dec 30 '18 at 21:20
  • but if I've an Italian or French text and an English one? Why specifying the languages as in my exemples above it doesn't work? It's not a sans but a serif font.... I'm rather confused – user41063 Dec 30 '18 at 21:21
  • 1
    Well the warning seems to be wrong, the numbers are oldstyle. Make a bug report at the fontspec site. – Ulrike Fischer Dec 30 '18 at 23:30
  • 1
    but I've no more smallcaps, no more oldstyle proportional numbers (only monospaced), no more lining numbers... Ok, I'll write to the fontspec site – user41063 Dec 30 '18 at 23:38

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.