[XeTeX] fontspec and Nikosh font

Jonathan Kew jfkthame at gmail.com
Mon Jun 20 23:55:41 CEST 2016

On 20/6/16 22:34, maxwell wrote:
> With the version of fontspec that comes with TeXLive 2016, I'm getting
> some warnings that I wasn't getting from the previous version, with the
> 'gargi' font (and another font).  If you want to try it, I'm not sure
> where the best (safest) place is to get the gargi font from, but one
> place is here:
>    https://www.azfonts.net/load_font/gargi-1-3.html
> (If you think that's unsafe, I could email you a copy of the file.)
> The command I've been using to load the font is this:
>    \newfontfamily\sanskritfont[Script=Devanagari]{gargi}
> but now fontspec gives me the warning
>    * fontspec warning: "script-not-exist"
>    *
>    * Font 'gargi' does not contain script 'Devanagari'.
> If I run otfinfo --scripts on the font, I get this:
>    deva            Devanagari
> IIUC, the first field is the script code that appears in the font file,
> while the second field is a human-readable version of that.  On the
> assumption that the code is what the font knows about, I tried this
> command to load it:
>    \newfontfamily\sanskritfont[Script=deva]{gargi}
> But then I get this error from fontspec:
>    ! LaTeX error: "kernel/key-choice-unknown"
>    !
>    ! Key 'fontspec/Script' accepts only a fixed set of choices.
>    l.528 ...ntfamily\sanskritfont[Script=deva]{gargi}
> Fontspec does load this font without complaint if I do this:
>    \newfontfamily\sanskritfont[Language=Devanagari]{gargi}
> but I'm lying to it, because Devanagari is a script, not a language.
> (And elsewhere I'm successfully using Script= with the name of a script,
> e.g 'Script=Thaana', where Thaana is the name of a script, Dhivehi is
> the name of the language that uses the Thaana script.)
> Is this font using a non-standard way of tagging scripts?  Or am I
> misunderstanding the way these codes are supposed to work?

My guess is that this might be a bug in the TL'16 version of fontspec, 
which looks like it is intended to support both the "new Indic spec" 
OpenType tags such as 'dev2', 'bng2', etc, as well as the "old Indic" 
versions 'deva', 'beng', etc, with preference being given to the v.2 
tags. Perhaps that feature is broken?

Without the correct [Script=...] support, you won't be getting proper 
Devanagari shaping, as you've probably observed.

One way to check what's wrong would be to search for the


declaration around line 2247 in fontspec-xetex.sty, and remove "dev2," 
from it so that it only looks for the old-style 'deva' tag. If that 
makes Gargi work without complaint (using [Script=Devanagari] as 
before), then you've identified a bug in fontspec and should report it 
to Will.

(I don't have a TL'16 installation on hand to try this myself just now; 
but looking at fontspec-xetex.sty in the TL repository, it appears this 
support was added between TL'15 and '16 releases.)


More information about the XeTeX mailing list