summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-04-03 22:35:21 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-04-03 22:35:21 +0200
commit1e5d7f41ddede5e6400a2a7762032823d3545df4 (patch)
treebf53397fbdd2b85c94db72321e7d0e466d02acd5 /tex/context/modules/mkiv
parent0175a693fcb853ecce7d49f6564895c2dbfd11f1 (diff)
downloadcontext-1e5d7f41ddede5e6400a2a7762032823d3545df4.tar.gz
2018-04-03 22:30:00
Diffstat (limited to 'tex/context/modules/mkiv')
-rw-r--r--tex/context/modules/mkiv/m-punk.mkiv6
-rw-r--r--tex/context/modules/mkiv/s-fonts-basics.mkiv15
-rw-r--r--tex/context/modules/mkiv/s-fonts-overlay.mkiv107
-rw-r--r--tex/context/modules/mkiv/s-tugboat.mkiv15
-rw-r--r--tex/context/modules/mkiv/x-asciimath.lua13
-rw-r--r--tex/context/modules/mkiv/x-asciimath.mkiv17
6 files changed, 163 insertions, 10 deletions
diff --git a/tex/context/modules/mkiv/m-punk.mkiv b/tex/context/modules/mkiv/m-punk.mkiv
index b72abd64d..08a066359 100644
--- a/tex/context/modules/mkiv/m-punk.mkiv
+++ b/tex/context/modules/mkiv/m-punk.mkiv
@@ -11,6 +11,12 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+%D You can actually turn a punk font into music (wintergatan):
+%D
+%D \starttyping
+%D https://www.youtube.com/watch?v=g5c2Htj8Vtw
+%D \stoptyping
+
\startluacode
local concat = table.concat
local round = math.round
diff --git a/tex/context/modules/mkiv/s-fonts-basics.mkiv b/tex/context/modules/mkiv/s-fonts-basics.mkiv
index f90009789..e9d0a21a2 100644
--- a/tex/context/modules/mkiv/s-fonts-basics.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-basics.mkiv
@@ -52,6 +52,17 @@ local arabicscripts = table.sorted {
local allindic = true
local allarabic = true
+local dotted = utf.char(0x25CC)
+
+local left = table.setmetatableindex (
+ { r = dotted, b = dotted, t = dotted, s = dotted },
+ function(t,k) local v = "" if k then t[k] = v end return v end
+)
+
+local right = table.setmetatableindex (
+ { l = dotted },
+ function(t,k) local v = "" if k then t[k] = v end return v end
+)
for i=1,#indicscripts do
local script = indicscripts[i]
@@ -90,8 +101,10 @@ for i=1,#indicscripts do
local indicmark = d.indicmark
local indicorder = d.indicorder
if allindic or indic == "d" or indicmark or indicclass or indicorder then
+ local l = left [indicmark]
+ local r = right[indicmark]
context.NC() context("%U",i)
- context.NC() context("\\showstruts\\strut\\TestFont %c",i)
+ context.NC() context("\\showstruts\\strut\\TestFont %s%c%s",l,i,r)
context.NC() context(category)
context.NC() context(indic or "?")
context.NC() context(indicmark or "")
diff --git a/tex/context/modules/mkiv/s-fonts-overlay.mkiv b/tex/context/modules/mkiv/s-fonts-overlay.mkiv
new file mode 100644
index 000000000..fccc977d4
--- /dev/null
+++ b/tex/context/modules/mkiv/s-fonts-overlay.mkiv
@@ -0,0 +1,107 @@
+%D \module
+%D [ file=s-fonts-overlay,
+%D version=2018.03.25,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Show Glyph Similarity,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% begin info
+%
+% title : overlay glyphs in fonts
+%
+% comment : show glyphs in two fonts
+% status : experimental, used for font feature development
+%
+% end info
+
+%D This module is for Luigi/Idris as part of the Husayni development where the
+%D gpos pair, single, mark and cursive features are just linear transformations.
+
+\startmodule[fonts-coverage]
+
+\unprotect
+
+\definecolor[ColorOne][r=1,t=.5,a=1]
+\definecolor[ColorTwo][b=1,t=.5,a=1]
+
+\startluacode
+ moduledata.fonts = moduledata.fonts or { }
+ moduledata.fonts.overlay = moduledata.fonts.overlay or { }
+
+ function moduledata.fonts.overlay(id)
+ for k, v in table.sortedhash(fonts.hashes.identifiers[id or true].characters) do
+ context.showoverlayedglyphs(k)
+ end
+ end
+\stopluacode
+
+\starttexdefinition unexpanded showoverlayedglyphs#1
+ \startTEXpage[offset=.25\scratchdimentwo,height=10\scratchdimentwo,width=4\scratchdimenone]
+ \ruledhbox to \hsize\bgroup
+ \hss
+ \FontOne\setstrut\strut\showglyphs
+ \startoverlay
+ {\ColorOne\ruledhbox{\FontOne\char#1}}
+ {\ColorTwo\ruledhbox{\FontTwo\char#1}}
+ \stopoverlay
+ \hss
+ \egroup
+ \vfill
+ \dontleavehmode
+ \hbox to \hsize\bgroup
+ \hss
+ \infofont0x\uchexnumbers{#1}
+ \hss
+ \egroup
+ \stopTEXpage
+\stoptexdefinition
+
+\starttexdefinition unexpanded showoverlayedfonts[#1]
+ \start
+ \getdummyparameters[\c!list=,#1]
+ \doifsomething {\dummyparameter\c!list} {
+ \page
+ \getfromcommacommand[\dummyparameter\c!list][1]\let\NameOne\commalistelement
+ \getfromcommacommand[\dummyparameter\c!list][2]\let\NameTwo\commalistelement
+ \definefont[FontOne][\NameOne]
+ \definefont[FontTwo][\NameTwo]
+ \FontOne\expandafter\edef\expandafter\OneID\expandafter{\number\fontid\font}%
+ \FontTwo\expandafter\edef\expandafter\TwoID\expandafter{\number\fontid\font}%
+ \scratchdimenone\emwidth
+ \scratchdimentwo\exheight
+ \ctxlua{moduledata.fonts.overlay(\OneID)}%
+ \page
+ % \startTEXpage[offset=.25\scratchdimentwo,height=10\scratchdimentwo,width=4\scratchdimenone]
+ % \vfill
+ % \hbox to \hsize{\ColorOne\infofont\hss\OneN\hss}
+ % \vfill
+ % \hbox to \hsize{\ColorTwo\infofont\hss\TwoN\hss}
+ % \vfill
+ % \stopTEXpage
+ % \page
+ }
+ \stop
+\stoptexdefinition
+
+\protect
+
+\stopmodule
+
+\continueifinputfile{s-fonts-overlay.mkiv}
+
+\starttext
+
+% \showoverlayedfonts
+% [list={file:husayni-script-regular.ttf @ 48.0pt,
+% file:husayni-note-bold.ttf @ 34.2pt}] % 34.18726pt
+
+ \showoverlayedfonts
+ [list={Serif,SerifBold}]
+
+\stoptext
diff --git a/tex/context/modules/mkiv/s-tugboat.mkiv b/tex/context/modules/mkiv/s-tugboat.mkiv
index 2b3b07d11..d3d15c3e7 100644
--- a/tex/context/modules/mkiv/s-tugboat.mkiv
+++ b/tex/context/modules/mkiv/s-tugboat.mkiv
@@ -23,8 +23,7 @@
[tugboat]
[type=article,
columns=no,
- grid=yes
- ]
+ grid=yes]
\setvariables
[tugboat]
@@ -45,7 +44,7 @@
email={tugboat@tug.org}]
%D \section Font Setup %<<<1
-%D
+%D
%D \TUGBOAT\ uses slightly different interline space than the default.
%D So we change the interline space.
@@ -121,7 +120,7 @@
\setupdescriptions [indentnext=no]
-%D \section Itemize
+%D \section Itemize
%D
%D And these. We typeset itemizations ragged right.
@@ -158,7 +157,7 @@
subject, subsubject, subsubsubject]
[style=bold,
align=right,
- before={\blank[8pt]},
+ before={\blank[8pt]},
after={\blank[4pt]}]
%D \section Spacing <<<1
@@ -173,8 +172,8 @@
\setupitemize[1][before={\blank[tugblank]},after={\blank[tugblank]},
inbetween={\blank[tugblank]}]
-\setuplines[before={\blank[tugblank]},after={\blank[tugblank]},
- inbetween={\blank[tugblank]}]
+\setuplines[before={\blank[tugblank]},after={\blank[tugblank]},
+ inbetween={\blank[tugblank]}]
%D \section Typing %<<<1
%D
@@ -232,7 +231,7 @@
\definereferenceformat[cite][left={[},right={]}]
\defineitemgroup [bibliography] [levels=1]
-\setupitemgroup [bibliography]
+\setupitemgroup [bibliography]
[symbol=n,
left={[},
right={]},
diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua
index 7785d5587..b0d45659e 100644
--- a/tex/context/modules/mkiv/x-asciimath.lua
+++ b/tex/context/modules/mkiv/x-asciimath.lua
@@ -50,9 +50,12 @@ local formatters = string.formatters
local entities = characters.entities or { }
local xmltext = xml.text
+local xmlpure = xml.pure
local xmlinclusion = xml.inclusion
local xmlcollected = xml.collected
+local lxmlgetid = lxml.getid
+
-- todo: use private unicodes as temporary slots ... easier to compare
local s_lparent = "\\left\\lparent"
@@ -2089,6 +2092,14 @@ interfaces.implement {
arguments = { "string", true },
}
+interfaces.implement {
+ name = "xmlasciimath",
+ actions = function(id)
+ convert(xmlpure(lxmlgetid(id)))
+ end,
+ arguments = "string"
+}
+
local ctx_typebuffer = context.typebuffer
local ctx_mathematics = context.mathematics
local ctx_color = context.color
@@ -2192,7 +2203,7 @@ end
function show.filter(id,element)
collected, indexed, ignored = { }, { }, { }
- asciimath.filter(lxml.getid(id),element or "am",collected,indexed)
+ asciimath.filter(lxmlgetid(id),element or "am",collected,indexed)
end
function show.max()
diff --git a/tex/context/modules/mkiv/x-asciimath.mkiv b/tex/context/modules/mkiv/x-asciimath.mkiv
index 1b0567dbd..32eaf2af2 100644
--- a/tex/context/modules/mkiv/x-asciimath.mkiv
+++ b/tex/context/modules/mkiv/x-asciimath.mkiv
@@ -182,6 +182,23 @@
{\the\everyasciimath
\clf_justasciimath{\detokenize\expandafter{\normalexpanded{#1}}}}}
+% \unexpanded\def\xmlasciimath
+% {\clf_xmlasciimath}
+
+\unexpanded\def\xmlasciimath
+ {\doifnextoptionalelse\xmlasciimath_yes\xmlasciimath_nop}
+
+\def\xmlasciimath_yes[#1]#2%
+ {\mathematics
+ [#1]%
+ {\the\everyasciimath%
+ \clf_xmlasciimath{#2}}}
+
+\def\xmlasciimath_nop#1%
+ {\mathematics
+ {\the\everyasciimath
+ \clf_xmlasciimath{#1}}}
+
\unexpanded\def\ctxmoduleasciimath#1%
{\ctxlua{moduledata.asciimath.#1}}