diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-tra.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/font-tra.mkiv | 155 |
1 files changed, 118 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-tra.mkiv b/Master/texmf-dist/tex/context/base/font-tra.mkiv index 06b8613785d..1877c4904d7 100644 --- a/Master/texmf-dist/tex/context/base/font-tra.mkiv +++ b/Master/texmf-dist/tex/context/base/font-tra.mkiv @@ -13,6 +13,8 @@ \unprotect +\writestatus{loading}{ConTeXt Font Macros / Tracing} + %D \macros %D {showbodyfont} %D @@ -82,10 +84,8 @@ \fetchruntimecommand \showcharratio {\f!fontprefix\s!run} \fetchruntimecommand \showfontparameters {\f!fontprefix\s!run} -\unexpanded\def\checkcharactersinfont {\ctxcommand{checkcharactersinfont()}} -\unexpanded\def\removemissingcharacters{\ctxcommand{removemissingcharacters()}} -\unexpanded\def\showchardata #1{\ctxcommand{showchardata("#1")}} -\unexpanded\def\showfontdata {\ctxcommand{showfontparameters()}} +\unexpanded\def\showchardata #1{\ctxcommand{showchardata("#1")}} +\unexpanded\def\showfontdata {\ctxcommand{showfontparameters()}} %D \macros %D {doiffontpresentelse} @@ -95,7 +95,7 @@ %D \doiffontpresentelse{adam-lindsay-modern-serif}{YES}{NO} %D \stoptyping -\def\doiffontpresentelse#1{\ctxcommand{doifelse(fonts.names.exists("#1"))}} +\unexpanded\def\doiffontpresentelse#1{\ctxcommand{doifelse(fonts.names.exists("#1"))}} % experimental, maybe this becomes a module @@ -103,69 +103,140 @@ \unexpanded\def\startotfcollecting{\ctxlua{nodes.tracers.steppers.start()}} \unexpanded\def\stopotfcollecting {\ctxlua{nodes.tracers.steppers.stop()}} -\def\resetotfcollecting{\ctxlua{nodes.tracers.steppers.reset()}} +\unexpanded\def\resetotfcollecting{\ctxlua{nodes.tracers.steppers.reset()}} % Rather experimental: % % \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{الضَّرَّ} \page % \page \showotfcomposition{arabtype*arab-default at 48pt}{-1}{لِلّٰهِ} \page -\def\showotfstepglyphs#1% +\unexpanded\def\showotfstepglyphs#1% {\ctxlua{nodes.tracers.steppers.glyphs(\number\otfcollector,#1)}% \unhbox\otfcollector} -\def\otfstepcharcommand#1#2#3% font char class +\unexpanded\def\otfstepcharcommand#1#2#3% font char class {\removeunwantedspaces - \hskip.5em plus .125em\relax + \hskip.5\emwidth \s!plus .125\emwidth\relax \doif{#3}{mark}{\underbar}{U+\hexnumber{#2}}:\ruledhbox{\ctxlua{nodes.tracers.fontchar(#1,#2)}}% - \hskip.5em plus .125em\relax} + \hskip.5\emwidth \s!plus .125\emwidth\relax} + +\unexpanded\def\otfstepfontcommand#1#2#3% id font size + {\begingroup + \tttf #1: #2 @ \the\dimexpr#3\scaledpoint\relax + \endgroup} -\def\otfstepmessagecommand#1#2% +\unexpanded\def\otfstepmessagecommand#1#2% {\begingroup \tttf\language\minusone \veryraggedright \forgetparindent \forgeteverypar - \hangindent1em + \hangindent\emwidth \hangafter\plusone - \dontleavehmode\hbox{\detokenize{#1}}\removeunwantedspaces - \doifsomething{#2}{\break\detokenize{#2}}\endgraf + \dontleavehmode\detokenize{#1}\removeunwantedspaces + \doifsomething{#2}{,\space\detokenize{#2}}\endgraf \endgroup \blank} -\def\showotfstepchars#1% +\unexpanded\def\showotfstepfont + {\ctxlua{nodes.tracers.steppers.font("otfstepfontcommand")}} + +\unexpanded\def\showotfstepchars#1% {\ctxlua{nodes.tracers.steppers.codes(#1,"otfstepcharcommand")}} -\def\showotfstepmessages#1% +\unexpanded\def\showotfstepmessages#1% {\ctxlua{nodes.tracers.steppers.messages(#1,"otfstepmessagecommand",true)}} -\def\showotfstepfeatures +\unexpanded\def\showotfstepfeatures {\ctxlua{nodes.tracers.steppers.features()}} -\def\showotfsteps +\unexpanded\def\otfnoffeaturesteps + {\ctxlua{nodes.tracers.steppers.nofsteps()}} + +% \unexpanded\def\showotfsteps +% {\begingroup +% \veryraggedright +% \forgetparindent +% \forgeteverypar +% \dontleavehmode\bgroup\tttf \language\minusone features: \showotfstepfeatures\egroup +% \blank +% \dontleavehmode\bgroup\tttf result:\egroup +% \blank +% \startlinecorrection +% \ruledhbox\bgroup\box\otfcompositionbox\egroup +% \stoplinecorrection +% \dorecurse\otfnoffeaturesteps +% {\blank +% \showotfstepmessages\recurselevel +% \blank +% \startlinecorrection +% \dontleavehmode\bgroup\resetallattributes\pardir TLT\textdir TLT\relax\tttf\recurselevel: \showotfstepchars\recurselevel\egroup +% \stoplinecorrection +% \blank +% \startlinecorrection +% \ruledhbox % can be mode +% \bgroup\resetallattributes\showotfstepglyphs\recurselevel\egroup % reset is new, we don't want additional processing +% \stoplinecorrection +% \blank}% +% \endgroup} + +\unexpanded\def\showotfsteps {\begingroup \veryraggedright \forgetparindent \forgeteverypar - \dontleavehmode\bgroup\tttf \language\minusone features: \showotfstepfeatures\egroup + \tt + \hbox to \hsize \bgroup + \hbox to 6\emwidth{\bf font\hss}% + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \language\minusone + \bf + \showotfstepfont + \egroup + \egroup \blank - \dontleavehmode\bgroup\tttf result:\egroup + \hbox to \hsize \bgroup + \hbox to 6\emwidth{\bf features\hss}% + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \language\minusone + \showotfstepfeatures + \egroup + \egroup \blank - \startlinecorrection - \ruledhbox\bgroup\box\otfcompositionbox\egroup - \stoplinecorrection - \dorecurse{\ctxlua{nodes.tracers.steppers.nofsteps()}} + \scratchcounter\otfnoffeaturesteps\relax + \dorecurse\scratchcounter {\blank - \showotfstepmessages\recurselevel - \blank - \startlinecorrection - \dontleavehmode\bgroup\resetallattributes\pardir TLT\textdir TLT\relax\tttf\recurselevel: \showotfstepchars\recurselevel\egroup - \stoplinecorrection + \begingroup + \advance\leftskip6\emwidth + \showotfstepmessages\recurselevel + \par + \endgroup \blank - \startlinecorrection - \ruledhbox % can be mode - \bgroup\resetallattributes\showotfstepglyphs\recurselevel\egroup % reset is new, we don't want additional processing - \stoplinecorrection + \dontleavehmode + \hbox to \hsize \bgroup + \hbox to 6\emwidth \bgroup + \bf + \ifnum\recurselevel=\scratchcounter result\else step \recurselevel\fi + \hss + \egroup + \vtop \bgroup + \hsize\dimexpr\hsize-6\emwidth\relax + \resetallattributes + \pardir TLT\textdir TLT\relax + \dontleavehmode + \ifnum\recurselevel=\scratchcounter + \ruledhbox{\box\otfcompositionbox}% + \else + \ruledhbox{\showotfstepglyphs\recurselevel}% + \fi + \quad + \showotfstepchars\recurselevel + \hfill + \par + \egroup + \egroup \blank}% \endgroup} @@ -186,14 +257,24 @@ \newbox\otfcompositionbox -\def\showotfcomposition#1#2#3% {font*features at size}, rl=-1, text +% this should go in spac-ali: + +\installcorenamespace{otfcompositiondir} + +\letvalue{\??otfcompositiondir -1}\righttoleft +\letvalue{\??otfcompositiondir r2l}\righttoleft +\letvalue{\??otfcompositiondir l2r}\lefttoright +\letvalue{\??otfcompositiondir +1}\lefttoright +\letvalue{\??otfcompositiondir 1}\lefttoright + +\unexpanded\def\showotfcomposition#1#2#3% {font*features at size}, rl=-1, text {\begingroup - \veryraggedright \forgetparindent \forgeteverypar - \setupcolors[\c!state=\v!start]% can be option + % \setupcolors[\c!state=\v!start]% + \setupalign[\v!verytolerant,\v!flushleft]% \startotfsample - \global\setbox\otfcompositionbox\hbox{\definedfont[#1]\ifnum#2<0 \textdir TRT\else\ifnum#2>0 \textdir TLT\fi\fi\relax#3}% + \global\setbox\otfcompositionbox\hbox{\definedfont[#1]\relax\getvalue{\??otfcompositiondir#2}\relax#3}% \stopotfsample \endgroup} |