Skip to content

Instantly share code, notes, and snippets.

@henryso
Created July 22, 2016 21:51
Show Gist options
  • Save henryso/d94e28ee96bf1e5d3b9f8832b723ccf3 to your computer and use it in GitHub Desktop.
Save henryso/d94e28ee96bf1e5d3b9f8832b723ccf3 to your computer and use it in GitHub Desktop.
local EXCLUDE = {
['.notdef'] = true,
['.null'] = true,
notdef = true,
nonmarkingreturn = true,
}
Mwe = {}
function Mwe.emit(csname)
local glyphs = font.fonts[font.id(csname)].resources.unicodes
local ignored = glyphs['___magic___']
local first = true
local odd = true
for name, cp in pairs(glyphs) do
if cp >= 0xe000 and not EXCLUDE[name] then
if first then
first = false
elseif odd then
tex.print([[\hline]])
end
tex.sprint(string.format([[{\scriptsize %s}&{\%s\char%d}]], name, csname, cp))
if odd then
tex.sprint([[&]])
else
tex.print([[\\]])
end
odd = not odd
if odd then break end
end
end
if not odd then
tex.print([[&\\]])
end
end
\documentclass[12pt,a4paper]{article}
\usepackage{fontspec}
\usepackage{libertine}
\usepackage{longtable}
\directlua{dofile('mwe.lua')}
\font\greextra = {name:greextra} at 1000000 sp\relax
\begin{document}
\begin{longtable}{lc|lc}
\directlua{Mwe.emit('greextra')}
\end{longtable}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment