Skip to content

Instantly share code, notes, and snippets.

@dohyunkim
Created September 9, 2015 12:17
Show Gist options
  • Select an option

  • Save dohyunkim/5c01762bfa97efa88ee4 to your computer and use it in GitHub Desktop.

Select an option

Save dohyunkim/5c01762bfa97efa88ee4 to your computer and use it in GitHub Desktop.
view all chars from current font (lualatex only)
\documentclass[a4paper]{article}
\usepackage{fontspec, luacode, xcolor}
%\setmainfont{HCR Batang LVT}[Script=Hangul, Language=Korean]
\setmainfont{Linux Libertine O}
%\setmainfont{TeX Gyre Pagella}
%\setmainfont{Source Han Sans K}[Script=Hangul, Language=Korean]
%\setmainfont{NanumMyeongjoOTF YetHangul}[Script=Hangul, Language=Korean]
%\setmainfont{NanumBarunGothicOTF YetHangul}[Script=Hangul, Language=Korean]
\pagestyle{myheadings} \markright{\footnotesize\fontname\font}
\def\tickblue{{\color{blue}\vrule width1pt height.05pt depth.05pt}}
\def\htstrut{\vrule width0pt height\ht\strutbox depth0pt}
\def\threestory#1#2#3{\oalign{%
\hss\scriptsize#1\hss\crcr
\hss\tickblue\fbox{\textcolor{red!70!blue}{\char#2}}\tickblue\htstrut\hss\crcr
\hss\textcolor{black!10}{\tiny#3}\hss\crcr
}}
\begin{document}
\newcount\n \n=\luatexfontid\font
\fboxrule=.1pt \fboxsep=-.5\fboxrule
\parindent=0pt \parfillskip=0pt \sloppy
\spaceskip.5em plus.5em minus.25em
\begin{luacode*}
local f = fonts.hashes.identifiers[tex.count["n"]]
local cnt = 1
for i,v in table.sortedhash(f.characters) do
if i < 1114112 then
tex.sprint( "\\threestory{",string.format("%X",i),"}{",i,"}{",v.index, "} ")
if cnt % 500 == 0 then tex.sprint("\\par ") end
cnt = cnt + 1
end
end
\end{luacode*}
\parfillskip0pt plus1fil\par
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment