diff options
Diffstat (limited to 'tex/context/base/font-aux.mkvi')
-rw-r--r-- | tex/context/base/font-aux.mkvi | 81 |
1 files changed, 3 insertions, 78 deletions
diff --git a/tex/context/base/font-aux.mkvi b/tex/context/base/font-aux.mkvi index 50cc4a258..bd655e41c 100644 --- a/tex/context/base/font-aux.mkvi +++ b/tex/context/base/font-aux.mkvi @@ -18,84 +18,9 @@ \unprotect -%D \macros -%D {normalizefontheight,normalizefontwidth,normalizedfontsize} -%D -%D Next we introduce some font manipulation macros. When we -%D want to typeset some text spread in a well defined area, it -%D can be considered bad practice to manipulate character and -%D word spacing. In such situations the next few macros can be -%D of help: -%D -%D \starttyping -%D \normalizefontheight \name {sample text} {height} {font} -%D \normalizefontwidth \name {sample text} {width} {font} -%D \stoptyping -%D -%D Consider for instance: -%D -%D \startbuffer[a] -%D \NormalizeFontHeight \TempFont {X} {2\baselineskip} {Serif} -%D \stopbuffer -%D -%D \startbuffer[b] -%D \ruledhbox{\TempFont To Be Or Not To Be} -%D \stopbuffer -%D -%D \typebuffer[a,b] \getbuffer[a] -%D -%D This shows up as: -%D -%D \startlinecorrection -%D \ruledhbox{\getbuffer[b]} -%D \stoplinecorrection -%D -%D The horizontal counterpart is: -%D -%D \startbuffer[a] -%D \NormalizeFontWidth \TempFont {This Line Fits} {\hsize} {Serif} -%D \stopbuffer -%D -%D \startbuffer[b] -%D \ruledhbox{\TempFont This Line Fits} -%D \stopbuffer -%D -%D \typebuffer[a,b] \getbuffer[a] -%D -%D This gives: -%D -%D \startlinecorrection -%D \ruledhbox{\getbuffer[b]} -%D \stoplinecorrection -%D -%D The calculated font scale is avaliable in \type {\normalizedfontsize}. +%D Leftovers: -\unexpanded\def\font_helpers_normalize_size#what#cs#text#width#specification% - {\bgroup - \setbox\scratchbox\hbox{\definedfont[#specification at 10pt]#text}% - \normalexpanded{\egroup\edef\noexpand\normalizedfontsize - {\the\dimexpr\ifdim\wd\scratchbox>\zeropoint - \luaexpr{\number\dimexpr10pt\relax*\number\dimexpr#width\relax/\number#what\scratchbox}\scaledpoint - \else - \bodyfontsize - \fi\relax}}% - \definefont[\strippedcsname#cs][#specification at \normalizedfontsize]} - -\def\NormalizedFontSize{\bodyfontsize} - -\unexpanded\def\normalizefontwidth {\font_helpers_normalize_size\wd} -\unexpanded\def\normalizefontheight{\font_helpers_normalize_size\ht} -\unexpanded\def\normalizefontdepth {\font_helpers_normalize_size\dp} -\unexpanded\def\normalizefontline {\font_helpers_normalize_size\htdp} - -\unexpanded\def\widthspanningtext #text#width#specification{\hbox{\normalizefontwidth \temp{#text}{#width}{#specification}\temp#text}} -\unexpanded\def\heightspanningtext#text#width#specification{\hbox{\normalizefontheight\temp{#text}{#width}{#specification}\temp#text}} -\unexpanded\def\depthspanningtext #text#width#specification{\hbox{\normalizefontdepth \temp{#text}{#width}{#specification}\temp#text}} -\unexpanded\def\linespanningtext #text#width#specification{\hbox{\normalizefontline \temp{#text}{#width}{#specification}\temp#text}} - -\let\NormalizeFontHeight \normalizefontheight -\let\NormalizeFontWidth \normalizefontwidth -\let\WidthSpanningText \widthspanningtext -\def\TheNormalizedFontSize{\normalizefontsize} +\unexpanded\def\xbox {\bgroup\aftergroup\egroup\hbox\bgroup\tx \let\next=} +\unexpanded\def\xxbox{\bgroup\aftergroup\egroup\hbox\bgroup\txx\let\next=} \protect \endinput |