summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/context/scripts/mkiv/mtx-fonts.html77
-rw-r--r--doc/context/scripts/mkiv/mtx-fonts.man63
-rw-r--r--doc/context/scripts/mkiv/mtx-fonts.xml59
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4112 -> 4115 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-def.mkiv13
-rw-r--r--tex/context/base/file-job.mkvi18
-rw-r--r--tex/context/base/font-afm.lua5
-rw-r--r--tex/context/base/font-lib.mkvi3
-rw-r--r--tex/context/base/font-otf.lua32
-rw-r--r--tex/context/base/font-pat.lua32
-rw-r--r--tex/context/base/font-trt.lua56
-rw-r--r--tex/context/base/grph-inc.mkiv4
-rw-r--r--tex/context/base/lxml-ini.mkiv19
-rw-r--r--tex/context/base/mlib-ctx.lua1
-rw-r--r--tex/context/base/mlib-pdf.lua19
-rw-r--r--tex/context/base/mlib-pps.lua318
-rw-r--r--tex/context/base/mlib-pps.mkiv50
-rw-r--r--tex/context/base/mult-sys.mkiv11
-rw-r--r--tex/context/base/pack-rul.mkiv44
-rw-r--r--tex/context/base/s-present-tiles.mkiv12
-rw-r--r--tex/context/base/status-files.pdfbin24707 -> 24712 bytes
-rw-r--r--tex/context/base/status-lua.log2
-rw-r--r--tex/context/fonts/treatments.lfg28
-rw-r--r--tex/context/fonts/unifraktur.lfg6
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua30
27 files changed, 435 insertions, 471 deletions
diff --git a/doc/context/scripts/mkiv/mtx-fonts.html b/doc/context/scripts/mkiv/mtx-fonts.html
deleted file mode 100644
index 3ddc2fa8e..000000000
--- a/doc/context/scripts/mkiv/mtx-fonts.html
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<!-- compare with lmx framework variant -->
-
-<!--
- filename : context-base.xml
- comment : companion to mtx-server-ctx-startup.tex
- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
- copyright: PRAGMA ADE / ConTeXt Development Team
- license : see context related readme files
--->
-
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <title>ConTeXt Font Database Management 0.21</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <style type="text/css">
- body { color: #FFFFFF; background-color: #808080; font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans; font-size: 12px; line-height: 18px; } a:link, a:active, a:visited { color: #FFFFFF; } a.dir-view:link, a.dir-view:active, a.dir-view:visited { color: #FFFFFF; text-decoration: underline; } .valid { color: #00FF00; } .invalid { color: #FF0000; } button, .commonlink, .smallbutton { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; border-color: #7F7F7F; border-style: solid; border-width: .125ex; background-color: #FFFFFF; padding: .5ex; } .smallbutton { width: 1em; } a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { font-weight: bold; font-size: 12px; text-decoration: none; color: #000000; } h1, .title { font-style: normal; font-weight: normal; font-size: 18px; line-height: 18px; margin-bottom: 20px; } h2, .subtitle { font-style: normal; font-weight: normal; font-size: 12px; margin-top: 18px; margin-bottom: 18px; } table { line-height: 18px; font-size: 12px; margin: 0; } th { font-weight: bold; text-align: left; padding-bottom: 6px; } .tc { font-weight: bold; text-align: left; } p, li { max-width: 60em; } .empty-line { margin-top: 4px; } .more-room { margin-right: 1.5em; } .much-more-room { margin-right: 3em; } #main { position: absolute; left: 10%; top: 10%; right: 10%; bottom: 10%; z-index: 2; width: 80%; height: 80%; padding: 0%; margin: 0%; overflow: auto; border-style: none; border-width: 0; background-color: #3F3F3F; } #main-settings { margin: 12px; x_max-width: 60em; line-height: 18px; font-size: 12px; } #left { position: absolute; top : 10%; left: 0%; bottom: 0%; right: 90%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; } #right { position: absolute; top : 0%; left: 90%; bottom: 10%; right: 0%; z-index: 1; width: 10%; height: 90%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #4F6F6F; _margin-left: -15px; } #bottom { position: absolute; left: 10%; right: 0%; top: 90%; bottom: 0%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top { position: absolute; left: 0%; right: 10%; top: 0%; bottom: 90%; z-index: 1; width: 90%; height: 10%; padding: 0%; margin: 0%; font-size: 16px; border-style: none; border-width: 0; background-color: #6F6F8F; } #top-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #top-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: right; vertical-align: middle; } #bottom-one { position: absolute; bottom: 50%; width: 100%; buggedheight: 100%; } #bottom-two { position: relative; margin-bottom: -9px; margin-left: 12px; margin-right: 12px; line-height: 18px; text-align: left; vertical-align: middle; } #left-one { position: absolute; width: 100%; buggedheight: 100%; } #left-two { position: relative; margin-top: 12px; line-height: 18px; text-align: center; vertical-align: top; } #right-one { display: table; height: 100%; width: 100%; } #right-two { display: table-row; height: 100%; width: 100%; } #right-three { display: table-cell; width: 100%; vertical-align: bottom; _position: absolute; _top: 100%; } #right-four { text-align: center; margin-bottom: 2ex; _position: relative; _top: -100%; } #more-top { position: absolute; top: 0%; left: 90%; bottom: 90%; right: 0%; z-index: 3; width: 10%; height: 10%; padding: 0%; margin: 0%; border-style: none; border-width: 0; } #more-top-settings { text-align: center; } #more-right-settings { margin-right: 12px; margin-left: 12px; line-height: 18px; font-size: 10px; text-align: center; } #right-safari { _display: table; width: 100%; height: 100%; }
- </style>
- <style type="text/css">
- </style>
- </head>
- <body>
- <div id="top"> <div id="top-one">
- <div id="top-two">ConTeXt Font Database Management 0.21 </div>
- </div>
- </div>
- <div id="bottom"> <div id="bottom-one">
- <div id="bottom-two">wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl</div>
- </div>
- </div>
- <div id="left"></div>
- <div id="right"></div>
- <div id="main">
- <div id='main-settings'>
- <h1>Command line options</h1>
-<table>
- <tr><th style="width: 10em">flag</th><th style="width: 8em">value</th><th>description</th></tr>
- <tr><th/><td/><td/></tr>
- <tr><th>--save</th><td></td><td>save open type font in raw table</td></tr>
- <tr><th>--unpack</th><td></td><td>save a tma file in a more readable format</td></tr>
- <tr><th/><td/><td/></tr>
- <tr><th>--reload</th><td></td><td>generate new font database (use --force when in doubt)</td></tr>
- <tr><th>--reload</th><td></td><td>--simple:generate luatex-fonts-names.lua (not for context!)</td></tr>
- <tr><th/><td/><td/></tr>
- <tr><th>--list</th><td></td><td>--name: list installed fonts, filter by name [--pattern]</td></tr>
- <tr><th>--list</th><td></td><td>--spec: list installed fonts, filter by spec [--filter]</td></tr>
- <tr><th>--list</th><td></td><td>--file: list installed fonts, filter by file [--pattern]</td></tr>
- <tr><th/><td/><td/></tr>
- <tr><th>--pattern</th><td>str</td><td>filter files using pattern</td></tr>
- <tr><th>--filter</th><td>list</td><td>key-value pairs</td></tr>
- <tr><th>--all</th><td></td><td>show all found instances (combined with other flags)</td></tr>
- <tr><th>--info</th><td></td><td>give more details</td></tr>
- <tr><th>--track</th><td>list</td><td>enable trackers</td></tr>
- <tr><th>--statistics</th><td></td><td>some info about the database</td></tr>
- </table>
-<br/>
-<h1>Examples</h1>
-<tt>mtxrun --script font --list somename (== --pattern=*somename*)</tt>
-<br/><br/><tt>mtxrun --script font --list --name somename</tt>
-<br/><tt>mtxrun --script font --list --name --pattern=*somename*</tt>
-<br/><br/><tt>mtxrun --script font --list --spec somename</tt>
-<br/><tt>mtxrun --script font --list --spec somename-bold-italic</tt>
-<br/><tt>mtxrun --script font --list --spec --pattern=*somename*</tt>
-<br/><tt>mtxrun --script font --list --spec --filter="fontname=somename"</tt>
-<br/><tt>mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed"</tt>
-<br/><tt>mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic"</tt>
-<br/><br/><tt>mtxrun --script font --list --all</tt>
-<br/><tt>mtxrun --script font --list --file somename</tt>
-<br/><tt>mtxrun --script font --list --file --all somename</tt>
-<br/><tt>mtxrun --script font --list --file --pattern=*somename*</tt>
-<br/><br/> </div>
- </div>
- </body>
- </html>
diff --git a/doc/context/scripts/mkiv/mtx-fonts.man b/doc/context/scripts/mkiv/mtx-fonts.man
deleted file mode 100644
index b31e39abd..000000000
--- a/doc/context/scripts/mkiv/mtx-fonts.man
+++ /dev/null
@@ -1,63 +0,0 @@
-.TH "mtx-fonts" "1" "01-01-2013" "version 0.21" "ConTeXt Font Database Management"
-.SH NAME
-.B mtx-fonts
-.SH SYNOPSIS
-.B mtxrun --script fonts [
-.I OPTIONS ...
-.B ] [
-.I FILENAMES
-.B ]
-.SH DESCRIPTION
-.B ConTeXt Font Database Management
-.SH OPTIONS
-.TP
-.B --save
-save open type font in raw table
-.TP
-.B --unpack
-save a tma file in a more readable format
-.TP
-.B --reload
-generate new font database (use --force when in doubt)
-.TP
-.B --reload
---simple:generate luatex-fonts-names.lua (not for context!)
-.TP
-.B --list
---name: list installed fonts, filter by name [--pattern]
-.TP
-.B --list
---spec: list installed fonts, filter by spec [--filter]
-.TP
-.B --list
---file: list installed fonts, filter by file [--pattern]
-.TP
-.B --pattern=str
-filter files using pattern
-.TP
-.B --filter=list
-key-value pairs
-.TP
-.B --all
-show all found instances (combined with other flags)
-.TP
-.B --info
-give more details
-.TP
-.B --track=list
-enable trackers
-.TP
-.B --statistics
-some info about the database
-.SH AUTHOR
-More information about ConTeXt and the tools that come with it can be found at:
-
-
-.B "maillist:"
-ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
-
-.B "webpage:"
-http://www.pragma-ade.nl / http://tex.aanhet.net
-
-.B "wiki:"
-http://contextgarden.net
diff --git a/doc/context/scripts/mkiv/mtx-fonts.xml b/doc/context/scripts/mkiv/mtx-fonts.xml
deleted file mode 100644
index b138a064a..000000000
--- a/doc/context/scripts/mkiv/mtx-fonts.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<application>
- <metadata>
- <entry name="name">mtx-fonts</entry>
- <entry name="detail">ConTeXt Font Database Management</entry>
- <entry name="version">0.21</entry>
- </metadata>
- <flags>
- <category name="basic">
- <subcategory>
- <flag name="save"><short>save open type font in raw table</short></flag>
- <flag name="unpack"><short>save a tma file in a more readable format</short></flag>
- </subcategory>
- <subcategory>
- <flag name="reload"><short>generate new font database (use <ref name="force"/> when in doubt)</short></flag>
- <flag name="reload"><short><ref name="simple"/>:generate luatex-fonts-names.lua (not for context!)</short></flag>
- </subcategory>
- <subcategory>
- <flag name="list"><short><ref name="name"/>: list installed fonts, filter by name [<ref name="pattern"/>]</short></flag>
- <flag name="list"><short><ref name="spec"/>: list installed fonts, filter by spec [<ref name="filter"/>]</short></flag>
- <flag name="list"><short><ref name="file"/>: list installed fonts, filter by file [<ref name="pattern"/>]</short></flag>
- </subcategory>
- <subcategory>
- <flag name="pattern" value="str"><short>filter files using pattern</short></flag>
- <flag name="filter" value="list"><short>key-value pairs</short></flag>
- <flag name="all"><short>show all found instances (combined with other flags)</short></flag>
- <flag name="info"><short>give more details</short></flag>
- <flag name="track" value="list"><short>enable trackers</short></flag>
- <flag name="statistics"><short>some info about the database</short></flag>
- </subcategory>
- </category>
- </flags>
- <examples>
- <category>
- <title>Examples</title>
- <subcategory>
- <example><command>mtxrun --script font --list somename (== --pattern=*somename*)</command></example>
- </subcategory>
- <subcategory>
- <example><command>mtxrun --script font --list --name somename</command></example>
- <example><command>mtxrun --script font --list --name --pattern=*somename*</command></example>
- </subcategory>
- <subcategory>
- <example><command>mtxrun --script font --list --spec somename</command></example>
- <example><command>mtxrun --script font --list --spec somename-bold-italic</command></example>
- <example><command>mtxrun --script font --list --spec --pattern=*somename*</command></example>
- <example><command>mtxrun --script font --list --spec --filter="fontname=somename"</command></example>
- <example><command>mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed"</command></example>
- <example><command>mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic"</command></example>
- </subcategory>
- <subcategory>
- <example><command>mtxrun --script font --list --all</command></example>
- <example><command>mtxrun --script font --list --file somename</command></example>
- <example><command>mtxrun --script font --list --file --all somename</command></example>
- <example><command>mtxrun --script font --list --file --pattern=*somename*</command></example>
- </subcategory>
- </category>
- </examples>
-</application>
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index d16bba5da..7cc4fa14d 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2013.10.04 23:41}
+\newcontextversion{2013.10.07 09:47}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 3e1cf4ec0..21d1f6a85 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 78e7c73d3..7d9c9f602 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2013.10.04 23:41}
+\edef\contextversion{2013.10.07 09:47}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/core-def.mkiv b/tex/context/base/core-def.mkiv
index cc695ea90..99bed6d34 100644
--- a/tex/context/base/core-def.mkiv
+++ b/tex/context/base/core-def.mkiv
@@ -95,23 +95,26 @@
\font_preloads_at_stop_text
\to \everystoptext
+% We made \loadoptionfile obsolete: we pass options via the command line to
+% luatex now and handle them directly instead of via a file. This also makes
+% the next obsolete:
+%
+% \directsetup{*runtime:options}
+% \directsetup{*runtime:modules}
+
\appendtoks
\showcontextbanner
\initializenewlinechar
\calculatecurrenttime
- \loadsystemfiles
- % \loadoptionfile % obsolete, but nice to keep as reference of when/how
+ \syst_files_load
\job_options_get_commandline % expands some commands
\job_options_get_ctxfile % might expand some commands
\job_options_set_filenames
\font_preloads_at_every_job
\settopskip % brrr
\initializemainlanguage
- \initializexmlprocessing % is this still needed?
\initializepagebackgrounds
\initializepagecounters
- % \directsetup{*runtime:options}% % obsolete as the option file is replaced by a more direct mechanism
- % \directsetup{*runtime:modules}% % obsolete as the option file is replaced by a more direct mechanism
\job_options_set_modes
\job_options_set_modules
\job_options_set_environments
diff --git a/tex/context/base/file-job.mkvi b/tex/context/base/file-job.mkvi
index 087f1a685..ce0d54ece 100644
--- a/tex/context/base/file-job.mkvi
+++ b/tex/context/base/file-job.mkvi
@@ -66,14 +66,16 @@
% \def\doloadsystemfile#1% only mkiv files
% {\readfile{sys:///#1.\mksuffix}{\showmessage\m!system2{#1.\mksuffix}}\donothing}
-\unexpanded\def\loadsystemfiles
- {\syst_files_load\f!newfilename % new code, to be integrated at some point, plus fixes posted on the list
- \syst_files_load\f!locfilename % new code, somewhat experimental, not distributed (outside the dev group)
- \syst_files_load\f!expfilename % new code, very experimental, can be engine specific, mostly for me only
- \syst_files_load\f!sysfilename} % local settings, but probably not that good an idea to use
-
-\def\syst_files_load#name% only mkiv files
- {\readsysfile{#name.\mksuffix}{\showmessage\m!system2{#name.\mksuffix}}\donothing}
+\unexpanded\def\syst_files_load
+ {\syst_files_load_indeed\f!newfilename % new code, to be integrated at some point, plus fixes posted on the list
+ \syst_files_load_indeed\f!locfilename % new code, somewhat experimental, not distributed (outside the dev group)
+ \syst_files_load_indeed\f!expfilename % new code, very experimental, can be engine specific, mostly for me only
+ \syst_files_load_indeed\f!sysfilename % local settings, but probably not that good an idea to use
+ %\syst_files_load_indeed\f!fntfilename % maybe some day, can load goodies and patches
+ }
+
+\def\syst_files_load_indeed#name% from now on we assume a suffix to be part of the name
+ {\readsysfile{#name}{\showmessage\m!system2{#name}}\donothing}
% obsolete, but we keep it as reference of what happened
%
diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua
index 1c68dc706..f06b5283d 100644
--- a/tex/context/base/font-afm.lua
+++ b/tex/context/base/font-afm.lua
@@ -54,6 +54,8 @@ afm.addligatures = true -- best leave this set to true
afm.addtexligatures = true -- best leave this set to true
afm.addkerns = true -- best leave this set to true
+local applyruntimefixes = fonts.treatments and fonts.treatments.applyfixes
+
local function setmode(tfmdata,value)
if value then
tfmdata.properties.mode = lower(value)
@@ -360,6 +362,9 @@ function afm.load(filename)
data = containers.write(afm.cache, name, data)
data = containers.read(afm.cache,name)
end
+ if applyruntimefixes and data then
+ applyruntimefixes(filename,data)
+ end
end
return data
else
diff --git a/tex/context/base/font-lib.mkvi b/tex/context/base/font-lib.mkvi
index 4bacef10b..a664d9b3a 100644
--- a/tex/context/base/font-lib.mkvi
+++ b/tex/context/base/font-lib.mkvi
@@ -32,6 +32,8 @@
\registerctxluafile{font-hsh}{1.001} % hashes used by context
\registerctxluafile{font-nod}{1.001}
+\registerctxluafile{font-trt}{1.001}
+
\registerctxluafile{font-oti}{1.001} % otf initialization
\registerctxluafile{font-ott}{1.001} % otf tables (first)
\registerctxluafile{font-otf}{1.001} % otf main
@@ -56,7 +58,6 @@
\registerctxluafile{font-vf} {1.001}
\registerctxluafile{font-enh}{1.001}
-\registerctxluafile{font-trt}{1.001}
\registerctxluafile{font-gds}{1.001}
\registerctxluafile{font-def}{1.001}
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index c694211b9..143a34dfc 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -75,6 +75,8 @@ local forcenotdef = false
local includesubfonts = false
local overloadkerns = false -- experiment
+local applyruntimefixes = fonts.treatments and fonts.treatments.applyfixes
+
local wildcard = "*"
local default = "dflt"
@@ -496,6 +498,9 @@ function otf.load(filename,format,sub,featurefile)
report_otf("loading from cache using hash %a",hash)
end
enhance("unpack",data,filename,nil,false)
+ if applyruntimefixes then
+ applyruntimefixes(filename,data)
+ end
enhance("add dimensions",data,filename,nil,false)
if trace_sequences then
showfeatureorder(data,filename)
@@ -2033,10 +2038,24 @@ local function copytotfm(data,cache_id)
end
end
-- end math
+ -- we need a runtime lookup because of running from cdrom or zip, brrr (shouldn't we use the basename then?)
+ local filename = constructors.checkedfilename(resources)
+ local fontname = metadata.fontname
+ local fullname = metadata.fullname or fontname
+ local units = metadata.units_per_em or 1000
+ --
+ if units == 0 then -- catch bugs in fonts
+ units = 1000 -- maybe 2000 when ttf
+ metadata.units_per_em = 1000
+ report_otf("changing %a units to %a",0,units)
+ end
+ --
local monospaced = metadata.isfixedpitch or (pfminfo.panose and pfminfo.panose.proportion == "Monospaced")
local charwidth = pfminfo.avgwidth -- or unset
- local italicangle = metadata.italicangle
local charxheight = pfminfo.os2_xheight and pfminfo.os2_xheight > 0 and pfminfo.os2_xheight
+-- charwidth = charwidth * units/1000
+-- charxheight = charxheight * units/1000
+ local italicangle = metadata.italicangle
properties.monospaced = monospaced
parameters.italicangle = italicangle
parameters.charwidth = charwidth
@@ -2066,17 +2085,6 @@ local function copytotfm(data,cache_id)
end
end
spaceunits = tonumber(spaceunits) or 500 -- brrr
- -- we need a runtime lookup because of running from cdrom or zip, brrr (shouldn't we use the basename then?)
- local filename = constructors.checkedfilename(resources)
- local fontname = metadata.fontname
- local fullname = metadata.fullname or fontname
- local units = metadata.units_per_em or 1000
- --
- if units == 0 then -- catch bugs in fonts
- units = 1000 -- maybe 2000 when ttf
- metadata.units_per_em = 1000
- report_otf("changing %a units to %a",0,units)
- end
--
parameters.slant = 0
parameters.space = spaceunits -- 3.333 (cmr10)
diff --git a/tex/context/base/font-pat.lua b/tex/context/base/font-pat.lua
index 3ad37641c..9733c9ada 100644
--- a/tex/context/base/font-pat.lua
+++ b/tex/context/base/font-pat.lua
@@ -20,25 +20,25 @@ local patches = otf.enhancers.patches
local register = patches.register
local report = patches.report
-local function patch(data,filename)
- if data.design_size == 0 then
- local ds = match(file.basename(lower(filename)),"(%d+)")
- if ds then
- report("font %a has design size %a",filename,ds)
- data.design_size = tonumber(ds) * 10
- end
- end
-end
-
-register("after","migrate metadata","^lmroman", patch)
-register("after","migrate metadata","^lmsans", patch)
-register("after","migrate metadata","^lmtypewriter",patch)
+-- local function patch(data,filename)
+-- if not metadata.design_size or metadata.design_size == 0 then
+-- local ds = match(file.basename(lower(filename)),"(%d+)")
+-- if ds then
+-- report("font %a has design size %a",filename,ds)
+-- metadata.design_size = tonumber(ds) * 10
+-- end
+-- end
+-- end
+--
+-- register("after","migrate metadata","^lmroman", patch)
+-- register("after","migrate metadata","^lmsans", patch)
+-- register("after","migrate metadata","^lmtypewriter",patch)
-- For some reason (either it's a bug in the font, or it's a problem in the
-- library) the palatino arabic fonts don't have the mkmk features properly
-- set up.
-local function patch(data,filename)
+register("after","rehash features","^palatino.*arabic", function patch(data,filename)
local gpos = data.gpos
if gpos then
for k=1,#gpos do
@@ -61,9 +61,7 @@ local function patch(data,filename)
end
end
end
-end
-
-register("after","rehash features","palatino.*arabic",patch)
+end)
-- -- this code is now in lm-math.lfg
--
diff --git a/tex/context/base/font-trt.lua b/tex/context/base/font-trt.lua
index 6fc8028d1..319863fa3 100644
--- a/tex/context/base/font-trt.lua
+++ b/tex/context/base/font-trt.lua
@@ -6,7 +6,10 @@ if not modules then modules = { } end modules ['font-trt'] = {
license = "see context related readme files"
}
-local rawget, dofile, next = rawget, dofile, next
+local rawget, dofile, next, type = rawget, dofile, next, type
+
+local cleanfilename = fonts.names.cleanfilename
+local splitbase = file.splitbase
--[[ldx--
<p>We provide a simple treatment mechanism (mostly because I want to demonstrate
@@ -14,11 +17,21 @@ something in a manual). It's one of the few places where an lfg file gets loaded
outside the goodies manager.</p>
--ldx]]--
-local treatments = utilities.storage.allocate()
-fonts.treatments = treatments
-local treatmentdata = { }
-treatments.data = treatmentdata
-treatments.filename = "treatments.lfg"
+local treatments = utilities.storage.allocate()
+fonts.treatments = treatments
+local treatmentdata = { }
+treatments.data = treatmentdata
+treatments.filename = "treatments.lfg"
+
+local trace_treatments = false trackers.register("fonts.treatments", function(v) trace_treatments = v end)
+local report_treatment = logs.reporter("fonts","treatment")
+treatments.report = report_treatment
+
+function treatments.trace(...)
+ if trace_treatments then
+ report_treatment(...)
+ end
+end
-- function treatments.load(name)
-- local filename = resolvers.findfile(name)
@@ -55,3 +68,34 @@ table.setmetatableindex(treatmentdata,function(t,k)
table.setmetatableindex(treatmentdata,nil)
return treatmentdata[k]
end)
+
+local function applyfix(fix,filename,data,n)
+ if type(fix) == "function" then
+ -- we assume that when needed the fix reports something
+ -- if trace_treatments then
+ -- report_treatment("applying treatment %a to file %a",n,filename)
+ -- end
+ fix(data)
+ elseif trace_treatments then
+ report_treatment("invalid treatment %a for file %a",n,filename)
+ end
+end
+
+function treatments.applyfixes(filename,data)
+ local filename = cleanfilename(filename)
+ local pathpart, basepart = splitbase(filename)
+ local treatment = treatmentdata[filename] or treatmentdata[basepart]
+ if treatment then
+ local fixes = treatment.fixes
+ if not fixes then
+ -- nothing to fix
+ elseif type(fixes) == "table" then
+ for i=1,#fixes do
+ applyfix(fixes[i],filename,data,i)
+ end
+ else
+ applyfix(fixes,filename,data,1)
+ end
+ end
+end
+
diff --git a/tex/context/base/grph-inc.mkiv b/tex/context/base/grph-inc.mkiv
index 4e2f8da93..5fb87a8b2 100644
--- a/tex/context/base/grph-inc.mkiv
+++ b/tex/context/base/grph-inc.mkiv
@@ -611,7 +611,9 @@
\letexternalfigureparameter\c!offset\v!overlay
\letexternalfigureparameter\c!width \figurewidth
\letexternalfigureparameter\c!height\figureheight
- \inheritedexternalfigureframed{\vfilll\box\foundexternalfigure}%
+% \letexternalfigureparameter\c!align \v!middle
+% \letexternalfigureparameter\c!autowidth\v!no
+ \inheritedexternalfigureframed{\box\foundexternalfigure}%
\fi
\fi\fi
\fi
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index d2d64aa8d..c3ab2dc73 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -87,10 +87,10 @@
\def\xmldisplayverbatim #1{\ctxlxml{displayverbatim("#1")}}
\def\xmlinlineverbatim #1{\ctxlxml{inlineverbatim("#1")}}
-\def\xmlload #1#2{\ctxlxml{load("#1","#2","\p_lxml_entities","\p_lxml_compress")}}
-\def\xmlloadbuffer #1#2{\ctxlxml{loadbuffer("#1","#2","\p_lxml_entities","\p_lxml_compress")}}
-\def\xmlloaddata #1#2{\ctxlxml{loaddata("#1",\!!bs#2\!!es,"\p_lxml_entities","\p_lxml_compress")}}
-\def\xmlloadregistered #1#2{\ctxlxml{loadregistered("#1","\p_lxml_entities","\p_lxml_compress")}}
+\def\xmlload #1#2{\ctxlxml{load("#1","#2","\directxmlparameter\c!entities","\directxmlparameter\c!compress")}}
+\def\xmlloadbuffer #1#2{\ctxlxml{loadbuffer("#1","#2","\directxmlparameter\c!entities","\directxmlparameter\c!compress")}}
+\def\xmlloaddata #1#2{\ctxlxml{loaddata("#1",\!!bs#2\!!es,"\directxmlparameter\c!entities","\directxmlparameter\c!compress")}}
+\def\xmlloadregistered #1#2{\ctxlxml{loadregistered("#1","\directxmlparameter\c!entities","\directxmlparameter\c!compress")}}
\def\xmlloaddirectives #1{\ctxlxml{directives.load("any:///#1")}}
\def\xmlpos #1{\ctxlxml{pos("#1")}}
@@ -313,17 +313,6 @@
\xmlprocessingmode\executeifdefined{\??xmldefaults\directxmlparameter\c!default}\plusone
\to \everysetupxml
-\unexpanded\def\initializexmlprocessing % is this still needed?
- {\the\everysetupxml}
-
-\let\p_lxml_entities\empty
-\let\p_lxml_compress\empty
-
-\appendtoks
- \edef\p_lxml_entities{\directxmlparameter\c!entities}%
- \edef\p_lxml_compress{\directxmlparameter\c!compress}%
-\to \everysetupxml
-
\setupxml
[\c!default=, % flush all
\c!compress=\v!no, % strip comment
diff --git a/tex/context/base/mlib-ctx.lua b/tex/context/base/mlib-ctx.lua
index 04e0efcb4..a1a4e645a 100644
--- a/tex/context/base/mlib-ctx.lua
+++ b/tex/context/base/mlib-ctx.lua
@@ -43,6 +43,7 @@ local function setmpsformat(specification)
specification.method = method
end
specification.mpx = metapost.format(instance,format,method)
+ return specification
end
local extensiondata = metapost.extensiondata or storage.allocate { }
diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua
index 8d7febf43..d5f22cd7e 100644
--- a/tex/context/base/mlib-pdf.lua
+++ b/tex/context/base/mlib-pdf.lua
@@ -31,13 +31,12 @@ metapost.flushers = metapost.flushers or { }
local pdfflusher = { }
metapost.flushers.pdf = pdfflusher
-metapost.multipass = false
+metapost.multipass = false -- to be stacked
metapost.n = 0
-metapost.optimize = true -- false
+metapost.optimize = true -- false
local experiment = true -- uses context(node) that already does delayed nodes
-
-local savedliterals = nil -- needs checking
+local savedliterals = nil -- needs checking
local mpsliteral = nodes.pool.register(node.new("whatsit",nodes.whatsitcodes.pdfliteral)) -- pdfliteral.mode = 1
local pdfliteral = function(s)
@@ -285,11 +284,11 @@ local variable =
local pattern = Cf ( Carg(1) * (Cg(variable * newline^0)^0), rawset)
-metapost.variables = { }
-metapost.llx = 0
-metapost.lly = 0
-metapost.urx = 0
-metapost.ury = 0
+metapost.variables = { } -- to be stacked
+metapost.llx = 0 -- to be stacked
+metapost.lly = 0 -- to be stacked
+metapost.urx = 0 -- to be stacked
+metapost.ury = 0 -- to be stacked
function commands.mprunvar(key,n)
local value = metapost.variables[key]
@@ -328,7 +327,7 @@ function metapost.flush(result,flusher,askedfig)
for f=1,#figures do
local figure = figures[f]
local objects = getobjects(result,figure,f)
- local fignum = figure:charcode() or 0
+ local fignum = figure:charcode() or 0
if askedfig == "direct" or askedfig == "all" or askedfig == fignum then
local t = { }
local miterlimit, linecap, linejoin, dashed = -1, -1, -1, false
diff --git a/tex/context/base/mlib-pps.lua b/tex/context/base/mlib-pps.lua
index 96d5c092f..c4a417833 100644
--- a/tex/context/base/mlib-pps.lua
+++ b/tex/context/base/mlib-pps.lua
@@ -6,13 +6,12 @@ if not modules then modules = { } end modules ['mlib-pps'] = {
license = "see context related readme files",
}
--- todo: make a hashed textext variant where we only process the text once (normally
--- we cannot assume that no macros are involved which influence a next textext
+-- todo: pass multipass nicer
local format, gmatch, match, split = string.format, string.gmatch, string.match, string.split
local tonumber, type = tonumber, type
local round = math.round
-local insert, concat = table.insert, table.concat
+local insert, remove, concat = table.insert, table.remove, table.concat
local Cs, Cf, C, Cg, Ct, P, S, V, Carg = lpeg.Cs, lpeg.Cf, lpeg.C, lpeg.Cg, lpeg.Ct, lpeg.P, lpeg.S, lpeg.V, lpeg.Carg
local lpegmatch = lpeg.match
local formatters = string.formatters
@@ -212,52 +211,65 @@ local function checkandconvert(ca,cb)
end
end
-local current_format, current_graphic, current_initializations
-
-metapost.multipass = false
+local stack = { } -- quick hack, we will pass topofstack around
+local top = nil
+local nofruns = 0 -- askedfig: "all", "first", number
-local textexts = { } -- all boxes, optionally with a different color
-local texslots = { } -- references to textexts in order or usage
-local texorder = { } -- references to textexts by mp index
-local textrial = 0
-local texfinal = 0
-local scratchbox = 0
+local function startjob(texmode)
+ top = {
+ textexts = { }, -- all boxes, optionally with a different color
+ texslots = { }, -- references to textexts in order or usage
+ texorder = { }, -- references to textexts by mp index
+ textrial = 0,
+ texfinal = 0,
+ -- used by tx plugin
+ texhash = { },
+ texlast = 0,
+ texmode = texmode, -- some day we can then skip all pre/postscripts
+ }
+ insert(stack,top)
+ if trace_runs then
+ report_metapost("starting run at level %i",#stack)
+ end
+ return top
+end
-local function freeboxes()
- for n, box in next, textexts do
- local tn = textexts[n]
- if tn then
+local function stopjob()
+ if top then
+ for n, tn in next, top.textexts do
free_list(tn)
- -- texsetbox("scratchbox",tn)
- -- texsetbox("scratchbox",nil) -- this frees too
if trace_textexts then
report_textexts("freeing box %s",n)
end
end
+ if trace_runs then
+ report_metapost("stopping run at level %i",#stack)
+ end
+ remove(stack)
+ top = stack[#stack]
+ return top
end
- textexts = { }
- texslots = { }
- texorder = { }
- textrial = 0
- texfinal = 0
end
-metapost.resettextexts = freeboxes
+function metapost.settextexts () end -- obsolete
+function metapost.resettextexts() end -- obsolete
+
+-- end of new
function metapost.settext(box,slot)
- textexts[slot] = copy_list(texgetbox(box))
+ top.textexts[slot] = copy_list(texgetbox(box))
texsetbox(box,nil)
-- this will become
- -- textexts[slot] = texgetbox(box)
+ -- top.textexts[slot] = texgetbox(box)
-- unsetbox(box)
end
function metapost.gettext(box,slot)
- texsetbox(box,copy_list(textexts[slot]))
+ texsetbox(box,copy_list(top.textexts[slot]))
if trace_textexts then
report_textexts("putting text %s in box %s",slot,box)
end
- -- textexts[slot] = nil -- no, pictures can be placed several times
+ -- top.textexts[slot] = nil -- no, pictures can be placed several times
end
-- rather generic pdf, so use this elsewhere too it no longer pays
@@ -490,7 +502,10 @@ local do_safeguard = ";"
local f_text_data = formatters["mfun_tt_w[%i] := %f ; mfun_tt_h[%i] := %f ; mfun_tt_d[%i] := %f ;"]
function metapost.textextsdata()
- local t, nt, n = { }, 0, 0
+ local texorder = top.texorder
+ local textexts = top.textexts
+ local collected = { }
+ local nofcollected = 0
for n=1,#texorder do
local box = textexts[texorder[n]]
if box then
@@ -498,25 +513,23 @@ function metapost.textextsdata()
if trace_textexts then
report_textexts("passed data item %s: (%p,%p,%p)",n,wd,ht,dp)
end
- nt = nt + 1
- t[nt] = f_text_data(n,wd,n,ht,n,dp)
+ nofcollected = nofcollected + 1
+ collected[nofcollected] = f_text_data(n,wd,n,ht,n,dp)
else
break
end
end
--- inspect(t)
- return t
+ return collected
end
-metapost.intermediate = metapost.intermediate or {}
-metapost.intermediate.actions = metapost.intermediate.actions or {}
-metapost.intermediate.needed = false
+metapost.intermediate = metapost.intermediate or { }
+metapost.intermediate.actions = metapost.intermediate.actions or { }
metapost.method = 1 -- 1:dumb 2:clever
-- maybe we can latelua the texts some day
-local nofruns = 0 -- askedfig: "all", "first", number
+local processmetapost = metapost.process
local function checkaskedfig(askedfig) -- return askedfig, wrappit
if not askedfig then
@@ -535,18 +548,42 @@ local function checkaskedfig(askedfig) -- return askedfig, wrappit
end
end
-function metapost.graphic_base_pass(specification)
- local mpx = specification.mpx -- mandate
- local data = specification.data or ""
- local definitions = specification.definitions or ""
--- local extensions = metapost.getextensions(specification.instance,specification.useextensions)
- local extensions = specification.extensions or ""
- local inclusions = specification.inclusions or ""
+local function extrapass()
+ if trace_runs then
+ report_metapost("second run of job %s, asked figure %a",top.nofruns,top.askedfig)
+ end
+ processmetapost(top.mpx, {
+ top.wrappit and do_begin_fig or "",
+ no_trial_run,
+ concat(metapost.textextsdata()," ;\n"),
+ top.initializations,
+ do_safeguard,
+ top.data,
+ top.wrappit and do_end_fig or "",
+ }, false, nil, false, true, top.askedfig)
+ -- context.MPLIBresettexts() -- must happen afterwards
+end
+
+function metapost.graphic_base_pass(specification) -- name will change (see mlib-ctx.lua)
+ local top = startjob(true)
+ --
+ local mpx = specification.mpx -- mandate
+ local data = specification.data or ""
+ local definitions = specification.definitions or ""
+ -- local extensions = metapost.getextensions(specification.instance,specification.useextensions)
+ local extensions = specification.extensions or ""
+ local inclusions = specification.inclusions or ""
local initializations = specification.initializations or ""
- local askedfig = specification.figure -- no default else no wrapper
+ local askedfig = specification.figure -- no default else no wrapper
--
- nofruns = nofruns + 1
local askedfig, wrappit = checkaskedfig(askedfig)
+ --
+ nofruns = nofruns + 1
+ --
+ top.askedfig = askedfig
+ top.wrappit = wrappit
+ top.nofruns = nofruns
+ --
local done_1, done_2, done_3, forced_1, forced_2, forced_3
data, done_1, forced_1 = checktexts(data)
-- we had preamble = extensions + inclusions
@@ -560,12 +597,12 @@ function metapost.graphic_base_pass(specification)
else
inclusions, done_3, forced_3 = checktexts(inclusions)
end
- metapost.intermediate.needed = false
- metapost.multipass = false -- no needed here
- current_format = mpx
- current_graphic = data
- current_initializations = initializations
- local method = metapost.method
+ top.intermediate = false
+ top.multipass = false -- no needed here
+ top.mpx = mpx
+ top.data = data
+ top.initializations = initializations
+ local method = metapost.method
if trace_runs then
if method == 1 then
report_metapost("forcing two runs due to library configuration")
@@ -586,19 +623,19 @@ function metapost.graphic_base_pass(specification)
report_metapost("first run of job %s, asked figure %a",nofruns,askedfig)
end
-- first true means: trialrun, second true means: avoid extra run if no multipass
- local flushed = metapost.process(mpx, {
+ local flushed = processmetapost(mpx, {
definitions,
extensions,
inclusions,
wrappit and do_begin_fig or "",
do_first_run,
do_trial_run,
- current_initializations,
+ initializations,
do_safeguard,
- current_graphic,
+ data,
wrappit and do_end_fig or "",
}, true, nil, not (forced_1 or forced_2 or forced_3), false, askedfig)
- if metapost.intermediate.needed then
+ if top.intermediate then
for _, action in next, metapost.intermediate.actions do
action()
end
@@ -606,44 +643,35 @@ function metapost.graphic_base_pass(specification)
if not flushed or not metapost.optimize then
-- tricky, we can only ask once for objects and therefore
-- we really need a second run when not optimized
- context.MPLIBextrapass(askedfig)
+ -- context.MPLIBextrapass(askedfig)
+ context(extrapass)
end
else
if trace_runs then
report_metapost("running job %s, asked figure %a",nofruns,askedfig)
end
- metapost.process(mpx, {
+ processmetapost(mpx, {
preamble,
wrappit and do_begin_fig or "",
do_first_run,
no_trial_run,
- current_initializations,
+ initializations,
do_safeguard,
- current_graphic,
+ data,
wrappit and do_end_fig or "",
}, false, nil, false, false, askedfig)
end
+ context(stopjob)
end
-function metapost.graphic_extra_pass(askedfig)
- if trace_runs then
- report_metapost("second run of job %s, asked figure %a",nofruns,askedfig)
- end
- local askedfig, wrappit = checkaskedfig(askedfig)
- metapost.process(current_format, {
- wrappit and do_begin_fig or "",
- no_trial_run,
- concat(metapost.textextsdata()," ;\n"),
- current_initializations,
- do_safeguard,
- current_graphic,
- wrappit and do_end_fig or "",
- }, false, nil, false, true, askedfig)
- context.MPLIBresettexts() -- must happen afterwards
+function metapost.process(...)
+ startjob(false)
+ processmetapost(...)
+ stopjob()
end
local start = [[\starttext]]
-local preamble = [[\long\def\MPLIBgraphictext#1{\startTEXpage[scale=10000]#1\stopTEXpage}]]
+local preamble = [[\def\MPLIBgraphictext#1{\startTEXpage[scale=10000]#1\stopTEXpage}]]
local stop = [[\stoptext]]
function makempy.processgraphics(graphics)
@@ -688,9 +716,9 @@ local resetteractions = sequencers.new { arguments = "t" }
local analyzeractions = sequencers.new { arguments = "object,prescript" }
local processoractions = sequencers.new { arguments = "object,prescript,before,after" }
-appendgroup(resetteractions, "system")
-appendgroup(analyzeractions, "system")
-appendgroup(processoractions, "system")
+appendgroup(resetteractions, "system")
+appendgroup(analyzeractions, "system")
+appendgroup(processoractions,"system")
-- later entries come first
@@ -729,48 +757,56 @@ end
-- end
function metapost.pluginactions(what,t,flushfigure) -- before/after object, depending on what
- for i=1,#what do
- local wi = what[i]
- if type(wi) == "function" then
- -- assume injection
- flushfigure(t) -- to be checked: too many 0 g 0 G
- t = { }
- wi()
- else
- t[#t+1] = wi
+ if top.texmode then
+ for i=1,#what do
+ local wi = what[i]
+ if type(wi) == "function" then
+ -- assume injection
+ flushfigure(t) -- to be checked: too many 0 g 0 G
+ t = { }
+ wi()
+ else
+ t[#t+1] = wi
+ end
end
+ return t
end
- return t
end
function metapost.resetplugins(t) -- intialize plugins, before figure
- -- plugins can have been added
- resetter = resetteractions .runner
- analyzer = analyzeractions .runner
- processor = processoractions .runner
- -- let's apply one runner
- resetter(t)
+ if top.texmode then
+ -- plugins can have been added
+ resetter = resetteractions.runner
+ analyzer = analyzeractions.runner
+ processor = processoractions.runner
+ -- let's apply one runner
+ resetter(t)
+ end
end
function metapost.analyzeplugins(object) -- each object (first pass)
- local prescript = object.prescript -- specifications
- if prescript and #prescript > 0 then
- return analyzer(object,splitprescript(prescript))
+ if top.texmode then
+ local prescript = object.prescript -- specifications
+ if prescript and #prescript > 0 then
+ return analyzer(object,splitprescript(prescript))
+ end
end
end
function metapost.processplugins(object) -- each object (second pass)
- local prescript = object.prescript -- specifications
- if prescript and #prescript > 0 then
- local before = { }
- local after = { }
- processor(object,splitprescript(prescript),before,after)
- return #before > 0 and before, #after > 0 and after
- else
- local c = object.color
- if c and #c > 0 then
- local b, a = colorconverter(c)
- return { b }, { a }
+ if top.texmode then
+ local prescript = object.prescript -- specifications
+ if prescript and #prescript > 0 then
+ local before = { }
+ local after = { }
+ processor(object,splitprescript(prescript),before,after)
+ return #before > 0 and before, #after > 0 and after
+ else
+ local c = object.color
+ if c and #c > 0 then
+ local b, a = colorconverter(c)
+ return { b }, { a }
+ end
end
end
end
@@ -800,12 +836,11 @@ local function cl_reset(t)
t[#t+1] = metapost.colorinitializer() -- only color
end
-local tx_hash = { }
-local tx_last = 0
-
local function tx_reset()
- tx_hash = { }
- tx_last = 0
+ if top then
+ top.texhash = { }
+ top.texlast = 0
+ end
end
local fmt = formatters["%s %s %s % t"]
@@ -814,7 +849,8 @@ local pat = lpeg.tsplitat(":")
local function tx_analyze(object,prescript) -- todo: hash content and reuse them
local tx_stage = prescript.tx_stage
if tx_stage == "trial" then
- textrial = textrial + 1
+ local tx_trial = top.textrial + 1
+ top.textrial = tx_trial
local tx_number = tonumber(prescript.tx_number)
local s = object.postscript or ""
local c = object.color -- only simple ones, no transparency
@@ -826,10 +862,11 @@ local function tx_analyze(object,prescript) -- todo: hash content and reuse them
end
local a = prescript.tr_alternative
local t = prescript.tr_transparency
- local h = fmt(tx_number,a or "?",t or "?",c)
- local n = tx_hash[h] -- todo: hashed variant with s (nicer for similar labels)
+ local h = fmt(tx_number,a or "-",t or "-",c or "-")
+ local n = top.texhash[h] -- todo: hashed variant with s (nicer for similar labels)
if not n then
- tx_last = tx_last + 1
+ local tx_last = top.texlast + 1
+ top.texlast = tx_last
if not c then
-- no color
elseif #c == 1 then
@@ -852,31 +889,35 @@ local function tx_analyze(object,prescript) -- todo: hash content and reuse them
end
end
context.MPLIBsettext(tx_last,s)
- metapost.multipass = true
- tx_hash[h] = tx_last
- texslots[textrial] = tx_last
- texorder[tx_number] = tx_last
+ top.multipass = true
+ metapost.multipass = true -- ugly
+ top.texhash[h] = tx_last
+ top.texslots[tx_trial] = tx_last
+ top.texorder[tx_number] = tx_last
if trace_textexts then
- report_textexts("stage %a, usage %a, number %a, new %a, hash %a",tx_stage,textrial,tx_number,tx_last,h)
+ report_textexts("stage %a, usage %a, number %a, new %a, hash %a",tx_stage,tx_trial,tx_number,tx_last,h)
end
else
- texslots[textrial] = n
+ top.texslots[tx_trial] = n
if trace_textexts then
- report_textexts("stage %a, usage %a, number %a, new %a, hash %a",tx_stage,textrial,tx_number,n,h)
+ report_textexts("stage %a, usage %a, number %a, new %a, hash %a",tx_stage,tx_trial,tx_number,n,h)
end
end
elseif tx_stage == "extra" then
- textrial = textrial + 1
+ local tx_trial = top.textrial + 1
+ top.textrial = tx_trial
local tx_number = tonumber(prescript.tx_number)
- if not texorder[tx_number] then
+ if not top.texorder[tx_number] then
local s = object.postscript or ""
- tx_last = tx_last + 1
+ local tx_last = top.texlast + 1
+ top.texlast = tx_last
context.MPLIBsettext(tx_last,s)
- metapost.multipass = true
- texslots[textrial] = tx_last
- texorder[tx_number] = tx_last
+ top.multipass = true
+ metapost.multipass = true -- ugly
+ top.texslots[tx_trial] = tx_last
+ top.texorder[tx_number] = tx_last
if trace_textexts then
- report_textexts("stage %a, usage %a, number %a, extra %a",tx_stage,textrial,tx_number,tx_last)
+ report_textexts("stage %a, usage %a, number %a, extra %a",tx_stage,tx_trial,tx_number,tx_last)
end
end
end
@@ -888,13 +929,13 @@ local function tx_process(object,prescript,before,after)
tx_number = tonumber(tx_number)
local tx_stage = prescript.tx_stage
if tx_stage == "final" then
- texfinal = texfinal + 1
- local n = texslots[texfinal]
+ top.texfinal = top.texfinal + 1
+ local n = top.texslots[top.texfinal]
if trace_textexts then
- report_textexts("stage %a, usage %a, number %a, use %a",tx_stage,texfinal,tx_number,n)
+ report_textexts("stage %a, usage %a, number %a, use %a",tx_stage,top.texfinal,tx_number,n)
end
local sx, rx, ry, sy, tx, ty = cm(object) -- needs to be frozen outside the function
- local box = textexts[n]
+ local box = top.textexts[n]
if box then
before[#before+1] = function()
-- flush always happens, we can have a special flush function injected before
@@ -936,8 +977,9 @@ local function gt_analyze(object,prescript)
local gt_stage = prescript.gt_stage
if gt_stage == "trial" then
graphics[#graphics+1] = formatters["\\MPLIBgraphictext{%s}"](object.postscript or "")
- metapost.intermediate.needed = true
- metapost.multipass = true
+ top.intermediate = true
+ top.multipass = true
+ metapost.multipass = true -- ugly
end
end
diff --git a/tex/context/base/mlib-pps.mkiv b/tex/context/base/mlib-pps.mkiv
index fe9f460f9..e16827585 100644
--- a/tex/context/base/mlib-pps.mkiv
+++ b/tex/context/base/mlib-pps.mkiv
@@ -33,18 +33,41 @@
\newbox \MPtextbox
\newtoks\everyMPLIBsettext % not used
-\newconditional\MPLIBtextgetdone
-
% \def\MPLIBsettext#1% #2%
% {\dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}
+%
+% \def\MPLIBresettexts
+% {\ctxlua{metapost.resettextexts()}}
+%
+% \newconditional\MPLIBtextgetdone
+%
+% \def\MPLIBsettext#1% #2%
+% {\ifconditional\MPLIBtextgetdone
+% \else
+% \cldcontext{metapost.tex.get()}% MPenvironments are depricated
+% \settrue\MPLIBtextgetdone % no \global needed
+% \fi
+% \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}
+%
+% \def\MPLIBresettexts
+% {\ctxlua{metapost.resettextexts()}%
+% \setfalse\MPLIBtextgetdone}
+
+\def\doMPLIBflushenvironment
+ {%\writestatus\m!metapost{flushing environment}%
+ \cldcontext{metapost.tex.get()}%
+ \let\MPLIBflushenvironment\relax}% MPenvironments are depricated}
+
+\let\MPLIBflushenvironment\doMPLIBflushenvironment
\def\MPLIBsettext#1% #2%
- {\ifconditional\MPLIBtextgetdone
- \else
- \cldcontext{metapost.tex.get()}% MPenvironments are depricated
- \settrue\MPLIBtextgetdone % no \global needed
- \fi
- \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox}
+ {\MPLIBflushenvironment
+ \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox\bgroup
+ \let\MPLIBflushenvironment\doMPLIBflushenvironment
+ \let\next} % gobble open brace
+
+\def\MPLIBresettexts
+ {\ctxlua{metapost.resettextexts()}}
\def\MPLIBgettextscaled#1#2#3% why a copy .. can be used more often
{\ctxlua{metapost.gettext(\number\MPtextbox,#1)}%
@@ -112,15 +135,8 @@
\def\MPLIBpositionwhd#1#2#3#4#5% bp !
{\dosavepositionwhd{#1}\zerocount{#2\onebasepoint}{#3\onebasepoint}{#4\onebasepoint}{#5\onebasepoint}\zeropoint}
-\def\MPLIBextrapass#1%
- {\ctxlua{metapost.graphic_extra_pass("#1")}}
-
-% \def\MPLIBresettexts
-% {\ctxlua{metapost.resettextexts()}}
-
-\def\MPLIBresettexts
- {\ctxlua{metapost.resettextexts()}%$
- \setfalse\MPLIBtextgetdone}
+% \def\MPLIBextrapass#1%
+% {\ctxlua{metapost.graphic_extra_pass("#1")}}
%D Experiment
diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv
index 74e4d70ea..6c6db58e1 100644
--- a/tex/context/base/mult-sys.mkiv
+++ b/tex/context/base/mult-sys.mkiv
@@ -561,11 +561,12 @@
%D calls to other files), old macro's, to garantee compatibility and new macro's noy
%D yet present in the format.
-\definefileconstant {errfilename} {cont-err}
-\definefileconstant {sysfilename} {cont-sys}
-\definefileconstant {newfilename} {cont-new}
-\definefileconstant {locfilename} {cont-loc}
-\definefileconstant {expfilename} {cont-exp}
+\definefileconstant {sysfilename} {cont-sys.mkiv}
+\definefileconstant {newfilename} {cont-new.mkiv}
+\definefileconstant {locfilename} {cont-loc.mkiv}
+\definefileconstant {expfilename} {cont-exp.mkiv}
+\definefileconstant {fntfilename} {cont-fnt.mkiv} % not yet used
+\definefileconstant {gdsfilename} {cont-fnt.lfg} % not yet used
%D The setup files for the language, font, color and special subsystems have a common
%D prefix. This means that we have at most three characters for unique filenames.
diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv
index d015dc0b3..bff8b4a0f 100644
--- a/tex/context/base/pack-rul.mkiv
+++ b/tex/context/base/pack-rul.mkiv
@@ -1649,27 +1649,41 @@
% \framed[width=12cm,height=3cm,orientation=-180]{\input ward\relax}
% \framed[width=12cm,height=3cm,orientation=-270]{\input ward\relax}
+% \def\pack_framed_start_orientation
+% {\ifcase\p_framed_orientation
+% \let\pack_framed_stop_orientation\relax
+% \else
+% \scratchcounter\p_framed_orientation % weird .. why
+% \divide\scratchcounter\plustwo
+% \ifodd\scratchcounter
+% \let\pack_framed_stop_orientation\pack_framed_stop_orientation_odd
+% \else
+% \let\pack_framed_stop_orientation\pack_framed_stop_orientation_even
+% \fi
+% \fi}
+%
+% \def\pack_framed_stop_orientation_odd
+% {\swapmacros\framedwidth\framedheight
+% \swapmacros\localwidth\localheight
+% \swapdimens\d_framed_height\d_framed_width
+% \pack_framed_stop_orientation_even}
+%
+% \def\pack_framed_stop_orientation_even
+% {\setbox\b_framed_normal\hbox{\dorotatebox\p_framed_orientation\hbox{\box\b_framed_normal}}%
+% \d_framed_height\ht\b_framed_normal
+% \d_framed_width \wd\b_framed_normal}
+
\def\pack_framed_start_orientation
{\ifcase\p_framed_orientation
\let\pack_framed_stop_orientation\relax
\else
- \scratchcounter\p_framed_orientation % weird .. why
- \divide\scratchcounter\plustwo
- \ifodd\scratchcounter
- \let\pack_framed_stop_orientation\pack_framed_stop_orientation_odd
- \else
- \let\pack_framed_stop_orientation\pack_framed_stop_orientation_even
- \fi
+ \let\pack_framed_stop_orientation\pack_framed_stop_orientation_indeed
\fi}
-\def\pack_framed_stop_orientation_odd
- {\swapmacros\framedwidth\framedheight
- \swapmacros\localwidth\localheight
- \swapdimens\d_framed_height\d_framed_width
- \pack_framed_stop_orientation_even}
-
-\def\pack_framed_stop_orientation_even
- {\setbox\b_framed_normal\hbox{\dorotatebox\p_framed_orientation\hbox{\box\b_framed_normal}}}
+\def\pack_framed_stop_orientation_indeed
+ {\setbox\b_framed_normal\hbox{\dorotatebox\p_framed_orientation\hbox{\box\b_framed_normal}}%
+ \d_framed_height\ht\b_framed_normal
+ \d_framed_width \wd\b_framed_normal}
%D The last conditional takes care of the special situation of in||line \inframed
%D [height=3cm] {framed} boxes. Such boxes have to be \inframed {aligned} with the
diff --git a/tex/context/base/s-present-tiles.mkiv b/tex/context/base/s-present-tiles.mkiv
index 1a0c95f0d..79fe48950 100644
--- a/tex/context/base/s-present-tiles.mkiv
+++ b/tex/context/base/s-present-tiles.mkiv
@@ -64,8 +64,12 @@
-\topspace
]
-\definemeasure [topiclistfont] [\measured{topiclistwidth}/10]
-\definemeasure [titlepagefont] [2\measured{layoutunit}]
+\definemeasure [topiclistfont] [1.2\measured{topiclistwidth}/10]
+\definemeasure [topictitlefont] [1.2\measured{layoutunit}]
+\definemeasure [titlepagefont] [2\measured{layoutunit}]
+
+\predefinefont[MyTopicTitleFont][SerifBold*default at \measure{topictitlefont}]
+\predefinefont[MyTopicListFont] [SerifBold*default at \measure{topiclistfont}]
\defineframed
[topiclistentry]
@@ -73,7 +77,7 @@
height=\measure{topiclistheight},
background=color,
frame=off,
- foregroundstyle={\definedfont[Bold at \measure{topiclistfont}]},
+ foregroundstyle=MyTopicListFont,
backgroundcolor=primarycolor,
foregroundcolor=white]
@@ -108,8 +112,6 @@
\stoptopicmakeup
\stopsetups
-\predefinefont[MyTopicTitleFont][SerifBold*default at \measure{layoutunit}]
-
\definehead
[topic]
[chapter]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 9a9480dcf..aff94fb26 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log
index 0e63fe31a..47c4cb270 100644
--- a/tex/context/base/status-lua.log
+++ b/tex/context/base/status-lua.log
@@ -1,6 +1,6 @@
(cont-yes.mkiv
-ConTeXt ver: 2013.10.04 23:41 MKIV beta fmt: 2013.10.4 int: english/english
+ConTeXt ver: 2013.10.07 09:47 MKIV beta fmt: 2013.10.7 int: english/english
system > 'cont-new.mkiv' loaded
(cont-new.mkiv)
diff --git a/tex/context/fonts/treatments.lfg b/tex/context/fonts/treatments.lfg
index 22706d6e9..54f35d535 100644
--- a/tex/context/fonts/treatments.lfg
+++ b/tex/context/fonts/treatments.lfg
@@ -2,6 +2,26 @@
-- the order specified by tree order access. The first treatment of a file
-- always wins, so one can overload. These files are not (to be) loaded with
-- font definitions. (Experiment as part of writing the font manual.)
+--
+-- So there are several ways to fix a font: add a patcher to a goodie file and
+-- load that one. Such a patch can end up in the cached file. Treatments are
+-- applied at runtime. An experimental auto-loaded goodie approach is not yet
+-- enabled and will never be if treatments can do the job.
+
+local unifraktur = {
+ comment = "suspicious x height",
+ fixes = function(data)
+ local pfminfo = data.metadata.pfminfo
+ if pfminfo then
+ local os2_xheight = pfminfo.os2_xheight
+ if os2_xheight and os2_xheight < 350 then
+ fonts.treatments.report("suspicious x-height %a, nilling",os2_xheight)
+ pfminfo.os2_xheight_original = os2_xheight
+ pfminfo.os2_xheight = nil
+ end
+ end
+ end,
+}
return {
name = "treatments",
@@ -13,18 +33,20 @@ return {
-- we need to complete this list in order to be able to warn
-- users not to include these files unless permitted
["adobeheitistd-regular.otf"] = {
+ comment = "this font is part of acrobat",
ignored = false,
-- included = false, -- not yet
- comment = "this font is part of acrobat",
},
-- just an experiment .. normally no big deal but I ran into
-- such case
["crap.ttf"] = {
- ignored = true,
comment = "a text file with suffix ttf", -- used in test file
+ ignored = true,
},
["latinmodern-math.otf"] = {
comment = "experimental",
- }
+ },
+ ["unifrakturcook.ttf"] = unifraktur,
+ ["unifrakturmaguntia.ttf"] = unifraktur,
},
}
diff --git a/tex/context/fonts/unifraktur.lfg b/tex/context/fonts/unifraktur.lfg
index 8b9b299f5..32ffed928 100644
--- a/tex/context/fonts/unifraktur.lfg
+++ b/tex/context/fonts/unifraktur.lfg
@@ -1,3 +1,9 @@
+-- moved to treatments.lfg
+--
+-- fonts.handlers.otf.enhancers.patches.register("after","check metadata","unifraktur*", function(data,filename)
+-- data.metadata.pfminfo.os2_xheight = nil
+-- end)
+
return {
name = "unicode fraktur",
version = "1.00",
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 2912a1c31..ccc52b8c0 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 10/04/13 23:41:38
+-- merge date : 10/07/13 09:47:33
do -- begin closure to overcome local limits and interference
@@ -5238,6 +5238,7 @@ afm.syncspace=true
afm.addligatures=true
afm.addtexligatures=true
afm.addkerns=true
+local applyruntimefixes=fonts.treatments and fonts.treatments.applyfixes
local function setmode(tfmdata,value)
if value then
tfmdata.properties.mode=lower(value)
@@ -5477,6 +5478,9 @@ function afm.load(filename)
data=containers.write(afm.cache,name,data)
data=containers.read(afm.cache,name)
end
+ if applyruntimefixes and data then
+ applyruntimefixes(filename,data)
+ end
end
return data
else
@@ -6348,6 +6352,7 @@ local syncspace=true
local forcenotdef=false
local includesubfonts=false
local overloadkerns=false
+local applyruntimefixes=fonts.treatments and fonts.treatments.applyfixes
local wildcard="*"
local default="dflt"
local fontloaderfields=fontloader.fields
@@ -6710,6 +6715,9 @@ function otf.load(filename,format,sub,featurefile)
report_otf("loading from cache using hash %a",hash)
end
enhance("unpack",data,filename,nil,false)
+ if applyruntimefixes then
+ applyruntimefixes(filename,data)
+ end
enhance("add dimensions",data,filename,nil,false)
if trace_sequences then
showfeatureorder(data,filename)
@@ -7956,10 +7964,19 @@ local function copytotfm(data,cache_id)
end
end
end
+ local filename=constructors.checkedfilename(resources)
+ local fontname=metadata.fontname
+ local fullname=metadata.fullname or fontname
+ local units=metadata.units_per_em or 1000
+ if units==0 then
+ units=1000
+ metadata.units_per_em=1000
+ report_otf("changing %a units to %a",0,units)
+ end
local monospaced=metadata.isfixedpitch or (pfminfo.panose and pfminfo.panose.proportion=="Monospaced")
local charwidth=pfminfo.avgwidth
- local italicangle=metadata.italicangle
local charxheight=pfminfo.os2_xheight and pfminfo.os2_xheight>0 and pfminfo.os2_xheight
+ local italicangle=metadata.italicangle
properties.monospaced=monospaced
parameters.italicangle=italicangle
parameters.charwidth=charwidth
@@ -7988,15 +8005,6 @@ local function copytotfm(data,cache_id)
end
end
spaceunits=tonumber(spaceunits) or 500
- local filename=constructors.checkedfilename(resources)
- local fontname=metadata.fontname
- local fullname=metadata.fullname or fontname
- local units=metadata.units_per_em or 1000
- if units==0 then
- units=1000
- metadata.units_per_em=1000
- report_otf("changing %a units to %a",0,units)
- end
parameters.slant=0
parameters.space=spaceunits
parameters.space_stretch=units/2