12

Similar to the question:

Lualatex: Font table with examples

I have several ornamental fonts and I'd like to create key maps. That is, I want to know what symbol the letter a maps to by having a nice table. The problem is, many of these fonts don't include all the characters and I don't know, a priori, which ones are included. I'd rather not have a mess of empty boxes filling up the table. Is it possible to iterate through the valid characters in a font and just display them? Any (Lua, Con, Xe, La, etc...)-Tex solution is welcome.

Hooked
  • 4,046

2 Answers2

18

can be done with luatex. \OD is the font face of the ornament font (needed on TeX level)

\documentclass[a5paper]{article}
\usepackage{luacode}
\usepackage[margin=0.5cm]{geometry}
\usepackage{fontspec}
\usepackage{multicol}
\setlength{\columnsep}{0.3cm} \setlength{\columnseprule}{1pt}
\setmainfont{Linux Libertine O}

\newfontface\OD{OrnamentalDecoration.otf}
\begin{document}

\begin{multicols}{4}\noindent
\begin{luacode*}
local f = fontloader.open('OrnamentalDecoration.otf')
local glyphs = {}
for i = 0, f.glyphmax - 1 do
   local g = f.glyphs[i]
   if g then
       table.insert(glyphs, {name = g.name, unicode = g.unicode})
   end
end
table.sort(glyphs, function (a,b) return (a.unicode < b.unicode) end)
for i = 1, #glyphs do
   tex.sprint(glyphs[i].unicode .. ": ")
   if (glyphs[i].unicode > 0) then
       tex.sprint("{\\OD\\char" .. glyphs[i].unicode .. "}");
   end
   tex.print(" {\\small(")
   tex.print(-2, glyphs[i].name )
   tex.sprint(')}\\\\')
end
fontloader.close(f)
\end{luacode*}
\end{multicols}

\end{document}

enter image description here

9

In ConTeXt you can use the fnt-10 module to display a list of the glyphs of a particular font. See also my answer to “Accessing font ornaments” for a more detailed description of how to use the symbols.

\usemodule [fnt-10]
\starttext
    \ShowCompleteFont{name:minionproregular}{10pt}{1}
\stoptext

result

Marco
  • 26,055