Skip to content

Instantly share code, notes, and snippets.

@dohyunkim
Last active December 31, 2015 01:39
Show Gist options
  • Select an option

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

Select an option

Save dohyunkim/7915319 to your computer and use it in GitHub Desktop.
사용자가 지시한 폰트에 들어있는 모든 글리프를 박스를 둘러 보여준다.
\message{^^JName of the font to test = }
\bgroup
\endlinechar-1
\global\read-1 to\myfontname
\egroup
\ifx\empty\myfontname
\def\myfontname{ec-lmr12}
\fi
\font\myfont=\myfontname\space at 15pt
\def\numtohex{%
\ifcase\count255
0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or A\or B\or C\or D\or E\or F\fi
}
\parindent=0pt
\nopagenumbers
\hfuzz\maxdimen
\tentt \fontname\myfont
\smallskip
\myfont
\newdimen\unitwd \unitwd=1.7em
\baselineskip=\unitwd plus .2em minus.1em
\lineskip=0.5em
\count255=0
\leavevmode\hbox to\unitwd{\hss}%
\loop
\hbox to\unitwd{\tenrm\numtohex\hss}%
\ifnum\count255<15
\advance\count255 by1 \repeat
\count255=0
\loop
\count254=\count255
\divide\count254 by 16
\multiply\count254 by 16
\ifnum\count255=\count254
\endgraf
\pdfliteral{0 0.5 1 RG}%
\leavevmode\vrule width 17\unitwd height.1pt depth.1pt
\endgraf
\vskip-\baselineskip
\pdfliteral{1 0.5 0 RG}%
\leavevmode\hbox to\unitwd{%
\tenrm
\divide\count255 by16
\llap{0}x\numtohex
\hss
}%
\fi
\setbox0\hbox{\char\count255}%
\chardef\existchar=1
\ifdim\wd0=0pt\ifdim\ht0=0pt\ifdim\dp0=0pt\chardef\existchar=0 \fi\fi\fi
\lower\dp0\hbox to\unitwd{%
\ifcase\existchar\box0\or\vbox{\hrule\hbox{\vrule\box0\vrule}\hrule}\fi
\hss
}%
\ifnum\count255<255
\advance\count255 by 1 \repeat
\bye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment