From 85b7bc695629926641c7cb752fd478adfdf374f3 Mon Sep 17 00:00:00 2001
From: Marius <mariausol@gmail.com>
Date: Sun, 4 Jul 2010 15:32:09 +0300
Subject: stable 2010-05-24 13:10

---
 tex/context/base/s-fnt-11.tex | 61 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 tex/context/base/s-fnt-11.tex

(limited to 'tex/context/base/s-fnt-11.tex')

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
-- 
cgit v1.2.3

