summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/font-ini.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-ini.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/font-ini.mkiv124
1 files changed, 124 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-ini.mkiv b/Master/texmf-dist/tex/context/base/font-ini.mkiv
new file mode 100644
index 00000000000..7d9a8e850bd
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/font-ini.mkiv
@@ -0,0 +1,124 @@
+%D \module
+%D [ file=font-ini,
+%D version=2007.01.10,
+%D title=\CONTEXT\ Font Macros,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\registerctxluafile{font-ini}{1.001}
+\registerctxluafile{font-enc}{1.001}
+\registerctxluafile{font-map}{1.001}
+\registerctxluafile{font-syn}{1.001}
+\registerctxluafile{font-tfm}{1.001}
+\registerctxluafile{font-afm}{1.001}
+\registerctxluafile{font-otf}{1.001}
+\registerctxluafile{font-vf} {1.001}
+\registerctxluafile{font-def}{1.001}
+\registerctxluafile{font-fbk}{1.001}
+\registerctxluafile{font-ext}{1.001}
+
+% \startruntimectxluacode
+% fonts.enc.make_unicode_vector() -- each time, brrr
+% \stopruntimectxluacode
+
+\unprotect
+
+\def\mkdefinefontfeature#1#2#3%
+ {\ctxlua{fonts.define.specify.preset_context("#1","#2","#3")}}
+
+% handy for manuals
+
+\def\otfchar#1{\ctxlua{fonts.otf.char("#1")}}
+
+%D: We cannot yet inherit because no colors are predefined.
+
+\definecolor[font:init][r=.75]
+\definecolor[font:medi][g=.75]
+\definecolor[font:fina][b=.75]
+\definecolor[font:isol][y=.75]
+\definecolor[font:mark][m=.75]
+\definecolor[font:rest][c=.75]
+
+%D goodies:
+%D
+%D \starttyping
+%D \showinstalledfonts[officinasans.*][all]
+%D \showinstalledfonts[officinaserif.*][all]
+%D \showinstalledfonts[officina.*itc.*][all]
+%D
+%D \showinstalledfonts[officina.*itc.*][all,new]
+%D \stoptyping
+
+\def\showinstalledfonts
+ {\dodoubleempty\doshowinstalledfonts}
+
+\def\doshowinstalledfonts[#1][#2]%
+ {\bgroup
+ \def\pattern{#1}%
+ \def\all{false}%
+ \def\reload{false}%
+ \doifnothing\pattern{\def\pattern{.*}}%
+ \processallactionsinset[#2][\v!new=>\def\reload{true},\v!all=>\def\all{true}]%
+ \ctxlua{fonts.names.table("#1",\reload,\all)}%
+ \egroup}
+
+%D Experimental!
+
+\def\installfontfeature
+ {\dodoubleargument\doinstallfontfeature}
+
+\def\doinstallfontfeature[#1][#2]%
+ {\ctxlua{fonts.install_feature("#1","#2")}}
+
+%D Not yet in \MKII.
+
+\def\fontfeatureslist
+ {\dodoubleargument\dofontfeatureslist}
+
+\def\dofontfeatureslist[#1][#2]% todo: arg voor type
+ {\ctxlua{tex.sprint(tex.ctxcatcodes,fonts.define.specify.context_tostring("#1","otf","\luaescapestring{#2}","yes","no",true,{"number"}))}}
+
+\def\definefontlocal#1%
+ {\expandafter\font\csname#1\endcsname\lastfontname\relax}
+
+\def\definefontglobal#1%
+ {\global\expandafter\font\csname#1:\endcsname\lastfontname\relax}
+
+\attribute\zerocount\zerocount % first in list, so fast match
+
+% \def\featureattribute#1{\ctxlua{tex.sprint(fonts.define.specify.context_number("#1"))}}
+% \def\setfontfeature #1{\attribute\zerocount\featureattribute{#1}\relax}
+% \def\resetfontfeature#1{\attribute\zerocount\zerocount}
+
+\let\currentfeature\empty
+
+\def\featureattribute#1{\ctxlua{tex.sprint(fonts.define.specify.context_number("#1"))}}
+\def\setfontfeature #1{\edef\currentfeature{#1}\attribute\zerocount\featureattribute{#1}\relax}
+\def\resetfontfeature#1{\let\currentfeature\empty\attribute\zerocount\zerocount}
+
+\appendtoks
+ \setfontfeature\currentfeature
+\to \everylanguage
+
+%D Simpler:
+
+\def\updatefontparameters
+ {\edef\@@fonthandling{\truefontdata\somefontname\s!handling}%
+ \edef\@@fontfeatures{\truefontdata\fontfile \s!features}%
+ \edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}}
+
+\def\setfontcharacteristics
+ {\the\everyfont}
+
+%D Predefined:
+
+% \installfontfeature[otf][tlig]
+% \installfontfeature[otf][trep]
+
+\protect \endinput