summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/font-run.mkiv
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-04-22 22:14:39 +0000
committerKarl Berry <karl@freefriends.org>2016-04-22 22:14:39 +0000
commitfc4466b32ed330a956ac603b00fd145524cff49a (patch)
tree2c50e2b8de13aa9233b2c76dffe201558f169e86 /Master/texmf-dist/tex/context/base/mkiv/font-run.mkiv
parent50e2368597d5f6fe2057195d0ae6a9f2044923e4 (diff)
context (22apr16)
git-svn-id: svn://tug.org/texlive/trunk@40691 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/font-run.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/font-run.mkiv403
1 files changed, 403 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/font-run.mkiv b/Master/texmf-dist/tex/context/base/mkiv/font-run.mkiv
new file mode 100644
index 00000000000..e9a6f9ddb7b
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/mkiv/font-run.mkiv
@@ -0,0 +1,403 @@
+%D \module
+%D [ file=font-run,
+%D version=1998.09.11, % (second)
+%D version=2001.02.20, % (third)
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=Runtime Macros,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D [This code is hooked into the core macros and saves some format
+%D space. It needs a cleanup as it's real old derioved \MKII\ code]
+
+\unprotect
+
+\gdef\font_show_only_english#1%
+ {\blank{\tttf \type {#1} is only available in the english interface}\blank}
+
+\gdef\font_show_title#1%
+ {\tabskip\zeropoint
+ \parindent\zeropoint
+ \setlocalhsize
+ \doifelsenothing{#1}
+ {\def\title{[\the\bodyfontsize]}}
+ {\switchtobodyfont[#1]\def\title{[#1]}}
+ \doifsomething\fontclass
+ {\doifnot{[\fontclass]}\title
+ {\edef\title{[\fontclass]\space\title}}}}
+
+\unexpanded\gdef\showbodyfont
+ {\dosingleempty\font_show_bodyfont}
+
+\gdef\font_show_bodyfont[#1]%
+ {\ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox
+ {\font_show_title{#1}%
+ \def\bigstrut##1##2%
+ {\hbox{\vrule
+ \s!height##1\strutht
+ \s!depth ##2\strutdp
+ \s!width \zeropoint}}
+ \def\next##1##2##3%
+ {&&##1&&##2\tf##3&&##2\sc##3%
+ &&##2\sl##3&&##2\it##3&&##2\bf##3&&##2\bs##3&&##2\bi##3%
+ &&##2\tfx##3&&##2\tfxx##3%
+ &&##2\tfa##3&&##2\tfb##3&&##2\tfc##3&&##2\tfd##3&\cr}%
+ \halign to \localhsize
+ {\bigstrut{1.5}{2}##&\vrule##
+ \tabskip\zeropoint \s!plus 1\s!fill
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&##\vrule
+ \tabskip=\zeropoint\cr
+ \noalign{\hrule}
+ &\multispan{29}{\vrule\hfil\tttf\strut\title\hfil
+ \llap{\string\mr\hpack to \emwidth{\hss:\hss}\normalstartimath\mr\languageparameter\c!text\normalstopimath\quad}\vrule}\cr
+ \noalign{\hrule}\next{}{\tt\string}{}
+ \noalign{\hrule}\next{\tt\string\rm}\rm{\languageparameter\c!text}
+ \noalign{\hrule}\next{\tt\string\ss}\ss{\languageparameter\c!text}
+ \noalign{\hrule}\next{\tt\string\tt}\tt{\languageparameter\c!text}
+ \noalign{\hrule}}}
+ \ifinsidefloat\else\stopbaselinecorrection\fi}
+
+\unexpanded\gdef\showbodyfontenvironment
+ {\dosingleempty\font_show_bodyfont_environment}
+
+\gdef\font_show_bodyfont_environment[#1]%
+ {\ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox
+ {\font_show_title{#1}%
+ \def\next##1%
+ {&&\bodyfontsizevariable{##1}\s!text
+ &&\bodyfontsizevariable{##1}\s!script
+ &&\bodyfontsizevariable{##1}\s!scriptscript
+ &&\bodyfontsizevariable{##1}\s!x
+ &&\bodyfontsizevariable{##1}\s!xx
+ &&\bodyfontsizevariable{##1}\v!small
+ &&\bodyfontsizevariable{##1}\v!big
+ &&\bodyfontsizevariable{##1}\c!interlinespace
+ &\cr
+ \noalign{\hrule}}
+ \halign to \localhsize
+ {##&\vrule##\strut
+ \tabskip=\zeropoint \s!plus 1\s!fill
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##&\hfil##\hfil&\vrule##
+ &\hfil##\hfil&\vrule##&\hfil##\hfil&##\vrule
+ \tabskip\zeropoint\cr
+ \noalign{\hrule}
+ &\multispan{17}{\vrule\hfil\tttf\strut\title\hfil}\vrule\cr
+ \noalign{\hrule}
+ &&\tttf\tx\s!text&&\tttf\tx\s!script&&\tttf\tx\s!scriptscript
+ &&\tttf\tx\s!x&&\tttf\tx\s!xx&&\tttf\tx\v!small&&\tttf\tx\v!big
+ &&\tttf\tx\c!interlinespace&\cr
+ \noalign{\hrule}%
+ \processbodyfontenvironmentlist\next}}
+ \ifinsidefloat\else\stopbaselinecorrection\fi}
+
+\unexpanded\gdef\showfont
+ {\dodoubleempty\font_show_font}
+
+\gdef\font_show_font[#1][#2]% doing this in lua is much faster
+ {\bgroup
+ \iffirstargument
+ \definefont[\s!dummy][#1]\dummy
+ \fi
+ \doifelsenothing{#2}
+ {\font_show_font_indeed{#1}\zerocount}
+ {\doifelse{#2}\v!all
+ {\dostepwiserecurse\zerocount{255}\plusone
+ {\scratchcounterone \recurselevel
+ \scratchcountertwo \numexpr\scratchcounterone*256\relax
+ \scratchcounterthree\numexpr\scratchcountertwo+255\relax
+ \doloop
+ {\iffontchar\font\scratchcountertwo
+ \font_show_font_indeed{#1}\scratchcounterone
+ \exitloop
+ \else\ifnum\scratchcountertwo=\scratchcounterthree
+ \exitloop
+ \else
+ \advance\scratchcountertwo\plusone
+ \fi\fi}}}
+ {\processcommalist[#2]{\font_show_font_indeed{#1}}}}%
+ \egroup}
+
+\gdef\font_show_font_indeed#1#2% made some 50% faster but still slow
+ {\bgroup
+ \iffirstargument
+ % \definefont[\s!dummy][#1]\dummy
+ \else\ifdim2.5\emwidth>.05\hsize \tx
+ \ifdim2.5\emwidth>.05\hsize \txx
+ \fi\fi\fi
+ \ifinsidefloat\else\startbaselinecorrection\fi
+ \vbox\bgroup
+ \scratchdimenone 2.5\emwidth
+ \scratchdimentwo 2.4\emwidth
+ \scratchdimenthree2.3\emwidth
+ \edef\charplane{\number#2}%
+ \forgetall
+ \startoverlay % easier in cld
+ {\vbox
+ {\tf
+ \setstrut
+ \dummy
+ \offinterlineskip
+ \unexpanded\def\wrapbox##1%
+ {\vpack to \scratchdimenone
+ {\vss
+ \hpack to \scratchdimenone
+ {\dummy
+ \ifdim\interwordspace=\zeropoint
+ \setbox##1\hpack
+ {\raise.5\dp##1\hpack
+ {\lower.5\ht##1\copy##1}}%
+ \ht##1\zeropoint
+ \dp##1\zeropoint
+ \else
+ \ht##1\strutht
+ \dp##1\strutdp
+ \strut
+ \fi
+ \hss\copy##1\hss}
+ \vss}}%
+ \unexpanded\def\textbox##1%
+ {\vpack to \scratchdimentwo
+ {\hsize\scratchdimenthree
+ ##1%
+ \par}}%
+ \unexpanded\def\scratchnum
+ {\blue
+ \tinyfont
+ \hfill
+ \number\scratchcounter
+ \vfill
+ \octnumber\scratchcounter
+ \hfill
+ \lchexnumbers\scratchcounter}%
+ \setbox\scratchboxone\hpack{\tf\textbox{}}%
+ \setbox\scratchboxtwo\hpack{\tf\gray\vrule\s!width\exheight\s!height.5\exheight\s!depth.5\exheight}%
+ \setbox\scratchboxtwo\wrapbox\scratchboxtwo
+ \setbox\scratchboxthree\hpack
+ {\startoverlay
+ {\box\scratchboxtwo}
+ {\box\scratchboxone}
+ \stopoverlay}%
+ \dostepwiserecurse\zerocount{15}\plusone
+ {\scratchcounterone\recurselevel
+ \hpack
+ {\dostepwiserecurse\zerocount{15}\plusone
+ {\scratchcountertwo \recurselevel
+ \scratchcounter \numexpr\scratchcounterone*16+\scratchcountertwo\relax
+ \scratchcounterthree\numexpr\charplane*256+\scratchcounter\relax
+ \iffontchar\font\scratchcounterthree
+ \setbox\scratchbox\ruledhpack{\char\scratchcounterthree}%
+ \tf
+ \startoverlay
+ {\wrapbox\scratchbox}
+ {\textbox\scratchnum}
+ \stopoverlay
+ \else
+ \copy\scratchboxthree
+ \fi}}}%
+ \par}}
+ {\tf\basegrid[\c!nx=16,\c!ny=16,\c!dx=2.5,\c!dy=2.5,\c!unit=em]}
+ \stopoverlay
+ \nointerlineskip
+ \vskip2\points
+ % the \noexpand before \blank is needed for non etex
+ \edef\theshowfontspecs{name: {\noexpand\black\fontname\font}\quad plane: \charplane\enspace"\hexnumber\charplane}%
+ \tf % also sets em
+ \hbox to 40\emwidth{\blue\hfill\tinyfont\setstrut\strut\theshowfontspecs}
+ \egroup
+ \ifinsidefloat\else\stopbaselinecorrection\fi
+ \egroup}
+
+% \showfontstyle[modern][rm][tf][all] % #2, #3 and #4 can be 'all'
+
+\unexpanded\gdef\showfontstyle {\dodoubleempty \font_show_style}
+\unexpanded\gdef\font_show_style_a{\dotripleempty \font_show_style_b}
+\unexpanded\gdef\font_show_style_c{\doquadrupleempty\font_show_style_d}
+
+% no lists any more, so no 'all' any longer
+
+\gdef\font_show_style[#1][#2]%
+ {\doifelsenothing{#2}
+ {\font_show_style_a[#1][\s!rm,\s!ss,\s!tt,\s!mm]}
+ {\font_show_style_a[#1][#2]}}
+
+\gdef\font_show_style_b[#1][#2][#3]%
+ {\doifelsenothing{#3}
+ {\font_show_style_c[#1][#2][\s!tf,\s!bf,\s!it,\s!sl,\s!bs,\s!bi]}
+ {\font_show_style_c[#1][#2][#3]}}
+
+\gdef\font_show_style_d[#1][#2][#3][#4]%
+ {\font_show_style_e[#1][#2][#3][#4]}
+
+% so far
+
+\gdef\font_show_style_e[#1][#2][#3][#4]%
+ {\bgroup
+ \raggedright
+ \switchtobodyfont[#1]
+ \def\dododocommand##1%
+ {\dostepwiserecurse\zerocount{255}\plusone
+ {\scratchcounter\numexpr##1*256+\recurselevel\relax
+ \iffontchar\font\scratchcounter\relax
+ \char\scratchcounter
+ \space
+ \fi}}%
+ \def\dodocommand##1##2%
+ {\starttextrule{\tttf #1 ##1 ##2}
+ \nobreak\getvalue{##2}%
+ \doifelsenothing{#4}
+ {\dododocommand\zerocount}
+ {\doifelse{#4}\v!all
+ {\dostepwiserecurse\zerocount{255}\plusone{\expanded{\dododocommand{\recurselevel}}}}
+ {\processcommalist[#4]{\dododocommand}}}%
+ \par \nobreak
+ \stoptextrule}
+ \def\docommand##1%
+ {\getvalue{##1}%
+ \processcommacommand[#3]{\dodocommand{##1}}}
+ \processcommalist[#2]\docommand
+ \egroup}
+
+\unexpanded\gdef\showligature#1%
+ {\hbox{\type{#1}\enspace\red\ruledhbox{\black#1}}}
+
+\unexpanded\gdef\showligatures[#1]% we keep it around for compatibility reasons
+ {\ifx\starttabulate\undefined
+ \font_show_only_english\showligatures
+ \else
+ \bgroup
+ \def\font_show_ligature##1{\hbox{\red\ruledhbox{\black##1}}}%
+ \definedfont[#1*default]%
+ %starttabulate[|*{9}{c|}]
+ \starttabulate[|*{7}{c|}]
+ \NC\type{ff}
+ \NC\type{fi}
+ \NC\type{fl}
+ \NC\type{ffi}
+ \NC\type{ffl}
+ %NC\type{``}
+ %NC\type{''}
+ \NC\type{--}
+ \NC\type{---}
+ \NC\NR
+ \NC\font_show_ligature{ff}
+ \NC\font_show_ligature{fi}
+ \NC\font_show_ligature{fl}
+ \NC\font_show_ligature{ffi}
+ \NC\font_show_ligature{ffl}
+ %NC\font_show_ligature{``}
+ %NC\font_show_ligature{''}
+ \NC\font_show_ligature{--}
+ \NC\font_show_ligature{---}
+ \NC\NR
+ \stoptabulate
+ \egroup
+ \fi}
+
+\unexpanded\gdef\showfontstrip
+ {\dosingleempty\font_show_strip}
+
+\gdef\font_show_strip[#1]%
+ {\ifx\starttabulate\undefined
+ \font_show_only_english\showfontstrip
+ \else
+ \bgroup
+ \def\font_show_strip_a##1##2%
+ {\tttf\string##1}
+ \def\font_show_strip_b##1##2%
+ {\ruledhbox{\switchtobodyfont[#1]##1{##2}}}
+ \def\font_show_strip_c##1##2%
+ {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
+ \tt\tfx\the\ht\scratchbox}%
+ \def\font_show_strip_d##1##2%
+ {\setbox\scratchbox\hbox{\switchtobodyfont[#1]##1{##2}}%
+ \tt\tfx\the\wd\scratchbox}%
+ \def\font_show_strip_indeed##1##2##3%
+ {\NC##2\rm{##3}\NC
+ ##2\ss{##3}\NC
+ ##2\tt{##3}\NC
+ ##2\mathematics{##3}\NC
+ \tttf##1\NR}
+ \starttabulate[|c|c|c|c|c|]
+ \font_show_strip_indeed\relax\font_show_strip_a\empty
+ \TB
+ \font_show_strip_indeed\relax\font_show_strip_b{xxxx}
+ \font_show_strip_indeed\relax\font_show_strip_b{12345}
+ \font_show_strip_indeed\relax\font_show_strip_b{(Agw)}
+ \TB
+ \font_show_strip_indeed{(x height)}\font_show_strip_c{x}
+ \font_show_strip_indeed{(m width)}\font_show_strip_d{m}
+ \stoptabulate
+ \egroup
+ \fi}
+
+\ifdefined\databox \else \newbox\databox \fi
+
+\unexpanded\gdef\testminimalbaseline#1% to be used in a 10 column tabulate
+ {\setbox\databox\ruledhbox{#1}%
+ \scratchdimen\htdp\databox
+ \normalexpanded {
+ \NC \ruledhbox{#1}%
+ \NC ->
+ \NC \the\htdp\databox
+ \NC =
+ \NC \the\ht\databox
+ \NC +
+ \NC \the\dp\databox
+ \NC \ifdim\scratchdimen<\baselineskip <
+ \else\ifdim\scratchdimen=\baselineskip =
+ \else > \fi\fi
+ \NC \the\baselineskip
+ \NC (\ifdim\scratchdimen>\baselineskip not \fi ok)
+ \NC \NR}
+ }
+
+\unexpanded\gdef\showminimalbaseline
+ {\ifx\starttabulate\undefined
+ \font_show_only_english\showminimalbaseline
+ \else
+ \starttabulate[|l|T|T|T|T|T|T|T|T|T|]
+ \testminimalbaseline{\hbox to \emwidth{\hss\showstruts\strut\hss}}%
+ \testminimalbaseline{(/)}%
+ \testminimalbaseline{\normalstartimath\frac{1}{2}x\normalsuperscript2\normalsubscript3\normalstopimath}
+ \stoptabulate
+ \fi}
+
+\unexpanded\gdef\showkerning#1%
+ {\bgroup
+ \let\MPfshowcommand\ruledhbox
+ \setMPtext\s!dummy{#1}%
+ \startMPcode draw textext(\MPstring\s!dummy);\stopMPcode
+ \egroup}
+
+\unexpanded\gdef\showcharratio
+ {\dowithnextboxcontent
+ {\switchtobodyfont[10pt]}%
+ {(\withoutpt\the\nextboxht,\withoutpt\the\nextboxdp)}%
+ \hbox}
+
+\unexpanded\gdef\showfontparameters
+ {\starttabulate[|tl|l|]
+ \NC slantperpoint \NC \the\fontslantperpoint \font \NC\NR
+ \NC interwordspace \NC \the\fontinterwordspace \font \NC\NR
+ \NC interwordstretch\NC \the\fontinterwordstretch\font \NC\NR
+ \NC interwordshrink \NC \the\fontinterwordshrink \font \NC\NR
+ \NC exheight \NC \the\fontexheight \font \NC\NR
+ \NC emwidth \NC \the\fontemwidth \font \NC\NR
+ \NC extraspace \NC \the\fontextraspace \font \NC\NR
+ \stoptabulate}
+
+\protect \endinput