summaryrefslogtreecommitdiff
path: root/tex/context/base/s-fnt-11.tex
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-07-04 15:32:09 +0300
committerMarius <mariausol@gmail.com>2010-07-04 15:32:09 +0300
commit85b7bc695629926641c7cb752fd478adfdf374f3 (patch)
tree80293f5aaa7b95a500a78392c39688d8ee7a32fc /tex/context/base/s-fnt-11.tex
downloadcontext-85b7bc695629926641c7cb752fd478adfdf374f3.tar.gz
stable 2010-05-24 13:10
Diffstat (limited to 'tex/context/base/s-fnt-11.tex')
-rw-r--r--tex/context/base/s-fnt-11.tex61
1 files changed, 61 insertions, 0 deletions
diff --git a/tex/context/base/s-fnt-11.tex b/tex/context/base/s-fnt-11.tex
new file mode 100644
index 000000000..8f855cc72
--- /dev/null
+++ b/tex/context/base/s-fnt-11.tex
@@ -0,0 +1,61 @@
+%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
+ tex.sprint(tex.ctxcatcodes,"\\start\\nonknuthmode\\starttabulate[|T|T|T|T|T|]")
+ tex.sprint(tex.ctxcatcodes,"\\NC hashname\\NC type\\NC fontname\\NC 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
+ tex.sprint(tex.ctxcatcodes,string.format("\\NC %s\\NC %s\\NC %s\\NC %s\\NC\\NR",v,kind,name,file))
+ else
+ logs.report("font table", "skipping %s", v)
+ end
+ end
+ end
+ tex.sprint(tex.ctxcatcodes,"\\stoptabulate\\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