summaryrefslogtreecommitdiff
path: root/tex/context/base/s-fnt-11.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/s-fnt-11.mkiv')
-rw-r--r--tex/context/base/s-fnt-11.mkiv73
1 files changed, 73 insertions, 0 deletions
diff --git a/tex/context/base/s-fnt-11.mkiv b/tex/context/base/s-fnt-11.mkiv
new file mode 100644
index 000000000..f2171ecd0
--- /dev/null
+++ b/tex/context/base/s-fnt-11.mkiv
@@ -0,0 +1,73 @@
+%D \module
+%D [ file=s-fnt-11,
+%D version=2006.02.01, % or so
+%D title=\CONTEXT\ Style File,
+%D subtitle=Listing Installed Fonts,
+%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.
+
+%D This code usd to be in the kernel but since it's hardly used
+%D it's now a module.
+%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
+
+\startluacode
+function fonts.names.table(pattern,reload,all)
+ local t = fonts.names.list(pattern,reload)
+ if t then
+ local NC, NR, HL = context.NC, context.NR, context.HL
+ context.start()
+ context.nonknuthmode()
+ context.starttabulate { "|T|T|T|T|T|" }
+ NC(false,hashname)
+ NC(false,type)
+ NC(false,fontname)
+ NC(false,filename)
+ NC() NR() HL()
+ for v,tv in table.sortedpairs(t) do
+ local kind, name, file = tv[1], tv[2], tv[3]
+ if all or v == string.lower(name) then
+ if kind and name and file then
+ NC(false,v)
+ NC(false,kind)
+ NC(false,name)
+ NC(false,file)
+ NC() NR()
+ else
+ logs.report("font table", "skipping %s", v)
+ end
+ end
+ end
+ context.stoptabulate()
+ context.stop()
+ end
+end
+\stopluacode
+
+\unprotect
+
+\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}
+
+\protect \endinput