5

Some OpenType fonts provide several of their most intriguing glyphs in slots that cannot be accessed in Unicode (which is limited to 0x10FFFF). An example: the EB Garamond font family provides glyphs called f.short and f_f.short in slots 0x110367 and 0x110360, respectively. (In case you're curious: these glyphs are variants of the glyphs f and ff -- the latter being a ligature -- which have short "arms", i.e., arms which protrude much less to the right than the arms of the "regular" glyphs f and ff do.)

Aside: I obtained the slot numbers 0x110367 and 0x110360 by opening the otf file in FontForge.

If I try to access, say, f.short naively via either \symbol{"110367} or \symbol{1114983}, I get the following error message:

! Bad character code (1114983)

Short of lobbying font designers to stop placing glyphs such as f.short and ff.short in slots that are beyond the Unicode range, how might one access these glyphs?

Just in case it isn't clear: I'm interested in LuaLaTeX-based solutions. If the solution is compatible with the fontspec package, the better.


A full MWE (to be compiled with LuaLaTeX):

\documentclass{article}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\begin{document}
\symbol{"110367} % "f.short" 
\end{document}
  • 4
    As far as I know, Unicode is limited to 0x10FFFF and UTF8 has nothing to do with this, being just a way to access Unicode code points with multibyte combinations. – egreg Sep 1 '17 at 20:17
  • 1
    I looked in the lua of ebgaramond and there is nothing at 1114983, f_f.short e.g. is at 983904 and \symbol{983904} worked fine. – Ulrike Fischer Sep 1 '17 at 20:24
  • @egreg - Thanks. I realize I may have been using unicode terminology a bit (too!) loosely. The question should maybe be rephrased as: "Since 0x110367 is beyond the UTF8 range, how does one access the glyph located in that slot, given that \symbol{"110367} throws an error message?" – Mico Sep 1 '17 at 20:25
  • @UlrikeFischer - Thanks. I'm afraid I don't quite understand the phrase "the lua of ebgaramond". :-( Is there a specific file I should be looking for? – Mico Sep 1 '17 at 20:27
  • 5
    @Mico UTF8 might easily be extended to use up to seven bytes (now it uses up to four), addressing many more code points than Unicode does. It is Unicode which is currently limited to 0x10FFFF. Both XeTeX and LuaTeX convert UTF8 input into Unicode before tokenization. – egreg Sep 1 '17 at 20:31
6

I cannot reproduce your issue. The last character in EB Garamond 12 Regular is in slot 0xF0477, whereas f.short and f_f.short are in slots 0xF0367 and 0xF0360 respectively. Indeed,

\documentclass{article}
\usepackage{fontspec}

\setmainfont{EB Garamond}

\begin{document}

f \symbol{"F0367} ff \symbol{"F0360}

\end{document}

produces

enter image description here

Here are the relevant excerpts from ebgaramond12-regular.lua:

  [983904]={
   ["boundingbox"]=449,
   ["index"]=2822,
   ["name"]="f_f.short",
   ["unicode"]={ 102, 102 },
   ["width"]=579,
  },

  [983911]={
   ["boundingbox"]={ 24, -3, 332, 706 },
   ["index"]=2829,
   ["name"]="f.short",
   ["unicode"]=102,
   ["width"]=317,
  },

   ["f.short"]=983911,

   ["f_f.short"]=983904,

The same input compiled with XeLaTeX does not show the “short” glyphs. One can get the glyphs with XeLaTeX by addressing them by name:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{EB Garamond}

\begin{document}

f \XeTeXglyph\XeTeXglyphindex"f.short"\ %
ff \XeTeXglyph\XeTeXglyphindex"f_f.short"

\end{document}
  • 1
    Very interesting. I had obtained the slot numbers 0x110367 and 0x110360 by opening the opentype font file in FontForge and looking for glyphs with .short in their names. Apparently, luaotfload maps these too-large numbers into smaller numbers that can be accessed via \symbol and \char! – Mico Sep 1 '17 at 20:53

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.