summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2016-10-22 11:36:54 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-10-22 11:36:54 +0200
commitf46e5a9b112dd6c1601fd1734b03064b4336a262 (patch)
tree86f8e1af5aa2de98958161081f00286cb387431e /tex
parent9e2c13b12ff90635be145c6c02e21d6e9583037f (diff)
downloadcontext-f46e5a9b112dd6c1601fd1734b03064b4336a262.tar.gz
2016-10-22 10:50:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/buff-ver.mkiv4
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-dsp.lua57
-rw-r--r--tex/context/base/mkiv/lpdf-ini.lua22
-rw-r--r--tex/context/base/mkiv/lpdf-xmp.lua4
-rw-r--r--tex/context/base/mkiv/page-lin.lua14
-rw-r--r--tex/context/base/mkiv/page-lin.mkvi24
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin21188 -> 25657 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin368426 -> 368424 bytes
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin836178 -> 836074 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60767 -> 60766 bytes
-rw-r--r--tex/context/modules/mkiv/m-steps.lua72
-rw-r--r--tex/context/modules/mkiv/m-steps.mkvi11
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua45
17 files changed, 182 insertions, 79 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 83368da12..0a50da857 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.10.19 22:51}
+\newcontextversion{2016.10.22 10:43}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index d7a057bd1..f275566cc 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.10.19 22:51}
+\edef\contextversion{2016.10.22 10:43}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/buff-ver.mkiv b/tex/context/base/mkiv/buff-ver.mkiv
index 5b3ed6f2a..8f222b1ff 100644
--- a/tex/context/base/mkiv/buff-ver.mkiv
+++ b/tex/context/base/mkiv/buff-ver.mkiv
@@ -751,6 +751,10 @@
\definetyping[\v!typing]
+% the \zeropoint forces the number to the margin but also works ok in text
+
+\setuplinenumbering[\v!typing][\c!location=\v!left,\c!width=\zeropoint]
+
\setuptyping [\v!file] [\s!parent=\??typing \v!typing] % we don't want \start..\stop overload
\setuplinenumbering[\v!file] [\s!parent=\??linenumbering\v!typing]
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 60d157f8a..980b1502b 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.10.19 22:51}
+\newcontextversion{2016.10.22 10:43}
%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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index f134fac64..1dee0f025 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.10.19 22:51}
+\edef\contextversion{2016.10.22 10:43}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua
index cd2816893..14e3a1d62 100644
--- a/tex/context/base/mkiv/font-dsp.lua
+++ b/tex/context/base/mkiv/font-dsp.lua
@@ -70,6 +70,7 @@ local readers = fonts.handlers.otf.readers
local streamreader = readers.streamreader
local setposition = streamreader.setposition
+local getposition = streamreader.getposition
local skipshort = streamreader.skipshort
local readushort = streamreader.readcardinal2 -- 16-bit unsigned integer
local readulong = streamreader.readcardinal4 -- 24-bit unsigned integer
@@ -397,7 +398,7 @@ local function readlookuparray(f,noflookups,nofcurrent)
end
end
-- if length > nofcurrent then
- -- report_issue("more lookups than currently matched characters")
+ -- report("more lookups than currently matched characters")
-- end
end
return lookups
@@ -413,7 +414,7 @@ end
-- for i=1,noflookups do
-- local index = readushort(f) + 1
-- if index > nofcurrent then
--- report_issue("more lookups than currently matched characters")
+-- report("more lookups than currently matched characters")
-- for i=nofcurrent+1,index-1 do
-- lookups[i] = false
-- end
@@ -1285,20 +1286,50 @@ do
local plugins = { }
- function plugins.size(f,fontdata,tableoffset,parameters)
- if not fontdata.designsize then
- setposition(f,tableoffset+parameters)
- local designsize = readushort(f)
- if designsize > 0 then
- fontdata.designsize = designsize
- skipshort(f,2)
- fontdata.minsize = readushort(f)
- fontdata.maxsize = readushort(f)
+ function plugins.size(f,fontdata,tableoffset,feature)
+ if fontdata.designsize then
+ -- yes, there are fonts with multiple size entries ... it probably relates
+ -- to the other two fields (menu entries in some language)
+ else
+ local function check(offset)
+ setposition(f,offset)
+ local designsize = readushort(f)
+ if designsize > 0 then -- we could also have a threshold
+ local fontstyle = readushort(f)
+ local guimenuid = readushort(f)
+ local minsize = readushort(f)
+ local maxsize = readushort(f)
+ if minsize == 0 and maxsize == 0 and fontstyleid == 0 and guimenuid == 0 then
+ minsize = designsize
+ maxsize = designsize
+ end
+ if designsize >= minsize and designsize <= maxsize then
+ return minsize, maxsize, designsize
+ end
+ end
+ end
+ local minsize, maxsize, designsize = check(tableoffset+feature.offset+feature.parameters)
+ if not designsize then
+ -- some old adobe fonts have: tableoffset+feature.parameters and we could
+ -- use some heuristic but why bother ... this extra check will be removed
+ -- some day and/or when we run into an issue
+ minsize, maxsize, designsize = check(tableoffset+feature.parameters)
+ if designsize then
+ report("bad size feature in %a, falling back to wrong offset",fontdata.filename or "?")
+ else
+ report("bad size feature in %a,",fontdata.filename or "?")
+ end
+ end
+ if designsize then
+ fontdata.minsize = minsize
+ fontdata.maxsize = maxsize
+ fontdata.designsize = designsize
end
end
end
- -- feature order needs checking ... as we loop over a hash
+ -- feature order needs checking ... as we loop over a hash ... however, in the file
+ -- they are sorted so order is not that relevant
local function reorderfeatures(fontdata,scripts,features)
local scriptlangs = { }
@@ -1440,7 +1471,7 @@ do
feature.parameters = parameters
local plugin = plugins[feature.tag]
if plugin then
- plugin(f,fontdata,offset,parameters)
+ plugin(f,fontdata,featureoffset,feature)
end
end
end
diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua
index 2851cc6f9..c36f629c5 100644
--- a/tex/context/base/mkiv/lpdf-ini.lua
+++ b/tex/context/base/mkiv/lpdf-ini.lua
@@ -1188,13 +1188,23 @@ end
do
- local f_actual_text_one = formatters["BT /Span << /ActualText <feff%04x> >> BDC [<feff>] TJ %s EMC ET"]
- local f_actual_text_two = formatters["BT /Span << /ActualText <feff%04x%04x> >> BDC [<feff>] TJ %s EMC ET"]
- local f_actual_text_one_b = formatters["BT /Span << /ActualText <feff%04x> >> BDC [<feff>] TJ "]
- local f_actual_text_two_b = formatters["BT /Span << /ActualText <feff%04x%04x> >> BDC [<feff>] TJ "]
- local f_actual_text_b = formatters["BT /Span << /ActualText <feff%s> >> BDC [<feff>] TJ "]
+ -- local f_actual_text_one = formatters["BT /Span << /ActualText <feff%04x> >> BDC [<feff>] TJ %s EMC ET"]
+ -- local f_actual_text_two = formatters["BT /Span << /ActualText <feff%04x%04x> >> BDC [<feff>] TJ %s EMC ET"]
+ -- local f_actual_text_one_b = formatters["BT /Span << /ActualText <feff%04x> >> BDC [<feff>] TJ "]
+ -- local f_actual_text_two_b = formatters["BT /Span << /ActualText <feff%04x%04x> >> BDC [<feff>] TJ "]
+ -- local f_actual_text_b = formatters["BT /Span << /ActualText <feff%s> >> BDC [<feff>] TJ "]
+ -- local s_actual_text_e = "EMC ET"
+ -- local f_actual_text_b_not = formatters["/Span << /ActualText <feff%s> >> BDC [<feff>] TJ "]
+ -- local s_actual_text_e_not = "EMC"
+ -- local f_actual_text = formatters["/Span <</ActualText %s >> BDC"]
+
+ local f_actual_text_one = formatters["BT /Span << /ActualText <feff%04x> >> %s EMC ET"]
+ local f_actual_text_two = formatters["BT /Span << /ActualText <feff%04x%04x> >> %s EMC ET"]
+ local f_actual_text_one_b = formatters["BT /Span << /ActualText <feff%04x> >> "]
+ local f_actual_text_two_b = formatters["BT /Span << /ActualText <feff%04x%04x> >> "]
+ local f_actual_text_b = formatters["BT /Span << /ActualText <feff%s> >> "]
local s_actual_text_e = "EMC ET"
- local f_actual_text_b_not = formatters["/Span << /ActualText <feff%s> >> BDC [<feff>] TJ "]
+ local f_actual_text_b_not = formatters["/Span << /ActualText <feff%s> >> "]
local s_actual_text_e_not = "EMC"
local f_actual_text = formatters["/Span <</ActualText %s >> BDC"]
diff --git a/tex/context/base/mkiv/lpdf-xmp.lua b/tex/context/base/mkiv/lpdf-xmp.lua
index a514d5655..6153b198f 100644
--- a/tex/context/base/mkiv/lpdf-xmp.lua
+++ b/tex/context/base/mkiv/lpdf-xmp.lua
@@ -31,11 +31,11 @@ local pdfflushstreamobject = lpdf.flushstreamobject
-- XMP-Toolkit-SDK-CC201607.zip. So we hardcode the id.
local xpacket = format ( [[
-<?xpacket begin="%s%s" id="W5M0MpCehiHzreSzNTczkc9d"?>
+<?xpacket begin="%s" id="W5M0MpCehiHzreSzNTczkc9d"?>
%%s
-<?xpacket end="w"?>]], utfchar(0xFEFF), utfchar(0x0089) )
+<?xpacket end="w"?>]], utfchar(0xFEFF) )
local mapping = {
-- user defined keys (pdfx:)
diff --git a/tex/context/base/mkiv/page-lin.lua b/tex/context/base/mkiv/page-lin.lua
index d6369c432..011418063 100644
--- a/tex/context/base/mkiv/page-lin.lua
+++ b/tex/context/base/mkiv/page-lin.lua
@@ -405,17 +405,19 @@ function boxed.stage_one(n,nested)
end
end
if getattr(n,a_displaymath) then
+ -- this probably needs to be adapted !
if is_display_math(n) then
check_number(n,a,skip)
end
else
- local v = getattr(list,a_verbatimline)
- if not v or v ~= last_v then
- last_v = v
+-- -- we now prevent nesting anyway .. maybe later we need to check again
+-- local v = getattr(list,a_verbatimline)
+-- if not v or v ~= last_v then
+-- last_v = v
check_number(n,a,skip)
- else
- check_number(n,a,skip,true)
- end
+-- else
+-- check_number(n,a,skip,true)
+-- end
end
skip = false
end
diff --git a/tex/context/base/mkiv/page-lin.mkvi b/tex/context/base/mkiv/page-lin.mkvi
index 5756d870b..2692087cc 100644
--- a/tex/context/base/mkiv/page-lin.mkvi
+++ b/tex/context/base/mkiv/page-lin.mkvi
@@ -174,11 +174,21 @@
% \startlinenumbering[name][<startvalue>|continue|settings]
\unexpanded\def\startlinenumbering
- {\dodoubleempty\page_lines_start}
+ {\begingroup
+ \dodoubleempty\page_lines_start}
+
+\newcount\c_pages_lines_nesting
\def\page_lines_start % we stay downward compatible
- {\begingroup
- \ifsecondargument
+ {\advance\c_pages_lines_nesting\plusone
+ \ifnum\c_pages_lines_nesting>\plusone
+ \expandafter\dodoubleempty\expandafter\gobbletwooptionals
+ \else
+ \expandafter\page_lines_start_indeed
+ \fi}
+
+\def\page_lines_start_indeed
+ {\ifsecondargument
\expandafter\page_lines_start_two
\else\iffirstargument
\doubleexpandafter\page_lines_start_one
@@ -276,9 +286,11 @@
\attribute\linenumberattribute\csname\??linenumberinginstance\currentlinenumbering\endcsname\relax}
\unexpanded\def\stoplinenumbering
- {\attribute\linenumberattribute\attributeunsetvalue
- \the\aftereverylinenumbering
- \ifconditional\c_page_lines_auto_narrow\par\fi
+ {\ifconditional\c_pages_lines_nesting=\plusone
+ \attribute\linenumberattribute\attributeunsetvalue
+ \the\aftereverylinenumbering
+ \ifconditional\c_page_lines_auto_narrow\par\fi
+ \fi
\endgroup}
% number placement .. will change into (the new) margin code
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index c06c1ab8a..1b3bf27bf 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index f74a63cbd..8d45cf09a 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 5751e4a9a..2951ea756 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index ad848eedc..09567097e 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/m-steps.lua b/tex/context/modules/mkiv/m-steps.lua
index 7348766af..c02e8f1c1 100644
--- a/tex/context/modules/mkiv/m-steps.lua
+++ b/tex/context/modules/mkiv/m-steps.lua
@@ -125,9 +125,9 @@ local function step_make_chart(settings)
local cellsettings = settings.cell
local linesettings = settings.line
- local start = context.startMPcode
- local stop = context.stopMPcode
- local flush = context
+ local start = nil
+ local stop = nil
+ local flush = nil
if false then
@@ -137,24 +137,27 @@ local function step_make_chart(settings)
local mpcode = false
- local function start()
+ start = function()
mpcode = { }
end
- local function stop()
+ stop = function()
+ local code = concat(mpcode,"\n")
+ -- print(code)
metapost.graphic {
- instance = "metafun",
+ -- instance = "metafun",
+ instance = "steps",
format = "metafun",
- data = concat(mpcode,"\n"),
+ data = code,
-- initializations = "",
-- extensions = "",
-- inclusions = "",
- -- definitions = "",
+ definitions = 'loadmodule "step" ;',
-- figure = "",
method = "double",
}
mpcode = false
end
- local function flush(fmt,first,...)
+ flush = function(fmt,first,...)
if first then
mpcode[#mpcode+1] = formatters[fmt](first,...)
else
@@ -162,10 +165,15 @@ local function step_make_chart(settings)
end
end
+ else
+
+ start = function() context.startMPcode("steps") end
+ stop = context.stopMPcode
+ flush = context
+
end
--
start()
- flush("if unknown context_cell : input mp-step.mpiv ; fi ;")
flush("step_begin_chart ;")
--
local alternative = utilities.parsers.settings_to_hash(chartsettings.alternative)
@@ -182,24 +190,24 @@ local function step_make_chart(settings)
flush("chart_align := true ;")
end
--
- flush("text_line_color := resolvedcolor(%q) ;", textsettings.framecolor)
- flush("text_line_width := %p ;", textsettings.rulethickness)
- flush("text_fill_color := resolvedcolor(%q) ;", textsettings.backgroundcolor)
- flush("text_offset := %p ;", textsettings.offset)
- flush("text_distance_set := %p ;", textsettings.distance)
+ flush("text_line_color := %q ;", textsettings.framecolor)
+ flush("text_line_width := %p ;", textsettings.rulethickness)
+ flush("text_fill_color := %q ;", textsettings.backgroundcolor)
+ flush("text_offset := %p ;", textsettings.offset)
+ flush("text_distance_set := %p ;", textsettings.distance)
--
- flush("cell_line_color := resolvedcolor(%q) ;", cellsettings.framecolor)
- flush("cell_line_width := %p ;", cellsettings.rulethickness)
- flush("cell_fill_color := resolvedcolor(%q) ;", cellsettings.backgroundcolor)
- flush("cell_offset := %p ;", cellsettings.offset)
- flush("cell_distance_x := %p ;", cellsettings.dx)
- flush("cell_distance_y := %p ;", cellsettings.dy)
+ flush("cell_line_color := %q ;", cellsettings.framecolor)
+ flush("cell_line_width := %p ;", cellsettings.rulethickness)
+ flush("cell_fill_color := %q ;", cellsettings.backgroundcolor)
+ flush("cell_offset := %p ;", cellsettings.offset)
+ flush("cell_distance_x := %p ;", cellsettings.dx)
+ flush("cell_distance_y := %p ;", cellsettings.dy)
--
- flush("line_line_color := resolvedcolor(%q) ;", linesettings.color)
- flush("line_line_width := %p ;", linesettings.rulethickness)
- flush("line_distance := %p ;", linesettings.distance)
- flush("line_offset := %p ;", linesettings.offset)
- flush("line_height := %p ;", linesettings.height)
+ flush("line_line_color := %q ;", linesettings.color)
+ flush("line_line_width := %p ;", linesettings.rulethickness)
+ flush("line_distance := %p ;", linesettings.distance)
+ flush("line_offset := %p ;", linesettings.offset)
+ flush("line_height := %p ;", linesettings.height)
--
for i=1,chart.count do
local step = steps[i]
@@ -210,7 +218,7 @@ local function step_make_chart(settings)
if ali then
local text = ali.text
local shape = ali.shape
- flush('step_cell_ali(%s,%s,%s,resolvedcolor(%q),resolvedcolor(%q),%p,%i) ;',
+ flush('step_cell_ali(%s,%s,%s,%q,%q,%p,%i) ;',
tonumber(text.left) or 0,
tonumber(text.middle) or 0,
tonumber(text.right) or 0,
@@ -222,7 +230,7 @@ local function step_make_chart(settings)
end
if top then
local shape = top.shape
- flush('step_cell_top(%s,resolvedcolor(%q),resolvedcolor(%q),%p,%i) ;',
+ flush('step_cell_top(%s,%q,%q,%p,%i) ;',
tonumber(top.text.top) or 0,
shape.framecolor,
shape.backgroundcolor,
@@ -232,7 +240,7 @@ local function step_make_chart(settings)
end
if bot then
local shape = bot.shape
- flush('step_cell_bot(%s,resolvedcolor(%q),resolvedcolor(%q),%p,%i) ;',
+ flush('step_cell_bot(%s,%q,%q,%p,%i) ;',
tonumber(bot.text.bot) or 0,
shape.framecolor,
shape.backgroundcolor,
@@ -249,7 +257,7 @@ local function step_make_chart(settings)
if top then
local shape = top.shape
local line = top.line
- flush('step_text_top(%s,resolvedcolor(%q),resolvedcolor(%q),%p,%i,resolvedcolor(%q),%p,%i) ;',
+ flush('step_text_top(%s,%q,%q,%p,%i,%q,%p,%i) ;',
tonumber(top.text.top) or 0,
shape.framecolor,
shape.backgroundcolor,
@@ -263,7 +271,7 @@ local function step_make_chart(settings)
if mid then -- used ?
local shape = mid.shape
local line = mid.line
- flush('step_text_mid(%s,resolvedcolor(%q),resolvedcolor(%q),%p,%i,resolvedcolor(%q),%p,%i) ;',
+ flush('step_text_mid(%s,%q,%q,%p,%i,%q,%p,%i) ;',
tonumber(mid.text.mid) or 0,
shape.framecolor,
shape.backgroundcolor,
@@ -277,7 +285,7 @@ local function step_make_chart(settings)
if bot then
local shape = bot.shape
local line = bot.line
- flush('step_text_bot(%s,resolvedcolor(%q),resolvedcolor(%q),%p,%i,resolvedcolor(%q),%p,%i) ;',
+ flush('step_text_bot(%s,%q,%q,%p,%i,%q,%p,%i) ;',
tonumber(bot.text.bot) or 0,
shape.framecolor,
shape.backgroundcolor,
diff --git a/tex/context/modules/mkiv/m-steps.mkvi b/tex/context/modules/mkiv/m-steps.mkvi
index 2d6068481..e03ffa5ef 100644
--- a/tex/context/modules/mkiv/m-steps.mkvi
+++ b/tex/context/modules/mkiv/m-steps.mkvi
@@ -17,6 +17,17 @@
\unprotect
+\defineMPinstance
+ [steps]
+ [\s!format=metafun,
+ \s!extensions=\v!yes,
+ \s!initializations=\v!yes]
+ %\c!method=\s!double]
+
+\startMPdefinitions{steps}
+ loadmodule "step" ;
+\stopMPdefinitions
+
\installcorenamespace {stepcharts}
\installcorenamespace {steptables}
\installcorenamespace {stepcells}
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index a0b906d0a..287ef1a0d 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 10/19/16 22:51:32
+-- merge date : 10/22/16 10:43:17
do -- begin closure to overcome local limits and interference
@@ -11398,6 +11398,7 @@ local report=logs.reporter("otf reader")
local readers=fonts.handlers.otf.readers
local streamreader=readers.streamreader
local setposition=streamreader.setposition
+local getposition=streamreader.getposition
local skipshort=streamreader.skipshort
local readushort=streamreader.readcardinal2
local readulong=streamreader.readcardinal4
@@ -12453,15 +12454,39 @@ function gposhandlers.extension(f,fontdata,lookupid,lookupoffset,offset,glyphs,n
end
do
local plugins={}
- function plugins.size(f,fontdata,tableoffset,parameters)
- if not fontdata.designsize then
- setposition(f,tableoffset+parameters)
- local designsize=readushort(f)
- if designsize>0 then
+ function plugins.size(f,fontdata,tableoffset,feature)
+ if fontdata.designsize then
+ else
+ local function check(offset)
+ setposition(f,offset)
+ local designsize=readushort(f)
+ if designsize>0 then
+ local fontstyle=readushort(f)
+ local guimenuid=readushort(f)
+ local minsize=readushort(f)
+ local maxsize=readushort(f)
+ if minsize==0 and maxsize==0 and fontstyleid==0 and guimenuid==0 then
+ minsize=designsize
+ maxsize=designsize
+ end
+ if designsize>=minsize and designsize<=maxsize then
+ return minsize,maxsize,designsize
+ end
+ end
+ end
+ local minsize,maxsize,designsize=check(tableoffset+feature.offset+feature.parameters)
+ if not designsize then
+ minsize,maxsize,designsize=check(tableoffset+feature.parameters)
+ if designsize then
+ report("bad size feature in %a, falling back to wrong offset",fontdata.filename or "?")
+ else
+ report("bad size feature in %a,",fontdata.filename or "?")
+ end
+ end
+ if designsize then
+ fontdata.minsize=minsize
+ fontdata.maxsize=maxsize
fontdata.designsize=designsize
- skipshort(f,2)
- fontdata.minsize=readushort(f)
- fontdata.maxsize=readushort(f)
end
end
end
@@ -12598,7 +12623,7 @@ do
feature.parameters=parameters
local plugin=plugins[feature.tag]
if plugin then
- plugin(f,fontdata,offset,parameters)
+ plugin(f,fontdata,featureoffset,feature)
end
end
end