Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 15 down vote accepted

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

share|improve this answer
    
Just so I understand, the check is in (glyphs[i].unicode > 0)? Great work, this is perfect! –  Hooked Feb 18 '13 at 19:18
    
This is much nicer than my code in tex.stackexchange.com/questions/98188/… –  Charles Stewart Feb 18 '13 at 19:19
    
@Hooked: and also if g then ... –  Herbert Feb 18 '13 at 19:20
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.