summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-10-18 00:46:16 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-10-18 00:46:16 +0200
commite2ee706a3114129601a30908d6b8cbb57068d32c (patch)
tree222b1047f4a7fe1144fefe5d0e52b78604a00f58 /tex/context/base/mkiv
parente5f189d9965a70c8f3043c07c7b07d41ef268e93 (diff)
downloadcontext-e2ee706a3114129601a30908d6b8cbb57068d32c.tar.gz
2018-10-18 00:16:00
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/char-act.mkiv10
-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-con.lua3
-rw-r--r--tex/context/base/mkiv/font-map.lua63
-rw-r--r--tex/context/base/mkiv/font-oup.lua2
-rw-r--r--tex/context/base/mkiv/grph-img.lua1
-rw-r--r--tex/context/base/mkiv/grph-inc.lua65
-rw-r--r--tex/context/base/mkiv/lpdf-img.lua2
-rw-r--r--tex/context/base/mkiv/spac-hor.mkiv2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26098 -> 26094 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin270199 -> 270225 bytes
-rw-r--r--tex/context/base/mkiv/tabl-tsp.mkiv29
13 files changed, 112 insertions, 69 deletions
diff --git a/tex/context/base/mkiv/char-act.mkiv b/tex/context/base/mkiv/char-act.mkiv
index ff4dc621f..dd9a325f2 100644
--- a/tex/context/base/mkiv/char-act.mkiv
+++ b/tex/context/base/mkiv/char-act.mkiv
@@ -50,7 +50,7 @@
% \unexpanded\gdef\setcontrolspaces{\catcode\spaceasciicode\activecatcode\def {\controlspace}}
% \egroup
-\unexpanded\def\obeyspaces {\catcode\spaceasciicode\activecatcode\letcharcode\spaceasciicode\obeyedspace }
+%unexpanded\def\obeyspaces {\catcode\spaceasciicode\activecatcode\letcharcode\spaceasciicode\obeyedspace }
\unexpanded\def\setcontrolspaces{\catcode\spaceasciicode\activecatcode\letcharcode\spaceasciicode\controlspace}
%D \macros
@@ -78,12 +78,16 @@
% \unexpanded\def\ignorepages{\catcode\formfeedasciicode \ignorecatcode}
% \unexpanded\def\ignoreeofs {\catcode\endoffileasciicode\ignorecatcode}
+% but ... as we don't want to freeze to \obeyedspace etc which can be set after \obeyspaces, we
+% use an idirectness
+
\def\_obeyed_space_{\obeyedspace}
\def\_obeyed_tab_ {\obeyedtab}
\def\_obeyed_line_ {\obeyedline}
\def\_obeyed_page_ {\obeyedpage}
-\unexpanded\def\obeytabs {\catcode\tabasciicode \activecatcode\letcharcode\tabasciicode \_obeyed_tab_ }
+\unexpanded\def\obeyspaces {\catcode\spaceasciicode \activecatcode\letcharcode\spaceasciicode \_obeyed_space_}
+\unexpanded\def\obeytabs {\catcode\tabasciicode \activecatcode\letcharcode\tabasciicode \_obeyed_tab_}
\unexpanded\def\obeylines {\catcode\endoflineasciicode\activecatcode\letcharcode\endoflineasciicode\_obeyed_line_}
\unexpanded\def\obeypages {\catcode\formfeedasciicode \activecatcode\letcharcode\formfeedasciicode \_obeyed_page_}
@@ -92,6 +96,8 @@
\unexpanded\def\ignorepages{\catcode\formfeedasciicode \ignorecatcode}
\unexpanded\def\ignoreeofs {\catcode\endoffileasciicode\ignorecatcode}
+\unexpanded\def\setcontrolspaces{\catcode\spaceasciicode\activecatcode\letcharcode\spaceasciicode\_control_space_}
+
%D \macros
%D {naturaltextext}
%D
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 5ce172570..02b2e4f41 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{2018.10.17 15:06}
+\newcontextversion{2018.10.18 00:07}
%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 8b144d609..e8a83d039 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -42,7 +42,7 @@
%D has to match \type {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2018.10.17 15:06}
+\edef\contextversion{2018.10.18 00:07}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua
index d238084d0..b067c8c40 100644
--- a/tex/context/base/mkiv/font-con.lua
+++ b/tex/context/base/mkiv/font-con.lua
@@ -425,6 +425,7 @@ function constructors.scale(tfmdata,specification)
targetparameters.extrafactor = extrafactor -- context specific
--
local tounicode = fonts.mappings.tounicode
+ local unknowncode = tounicode(0xFFFD)
--
local defaultwidth = resources.defaultwidth or 0
local defaultheight = resources.defaultheight or 0
@@ -740,7 +741,7 @@ function constructors.scale(tfmdata,specification)
-- in luatex > 0.85 we can do this:
-- chr.tounicode = isunicode
else
--- chr.tounicode = "FFFD"
+ chr.tounicode = unknowncode
end
if hasquality then
-- we could move these calculations elsewhere (saves calculations)
diff --git a/tex/context/base/mkiv/font-map.lua b/tex/context/base/mkiv/font-map.lua
index 712b1584c..7dd538858 100644
--- a/tex/context/base/mkiv/font-map.lua
+++ b/tex/context/base/mkiv/font-map.lua
@@ -225,7 +225,7 @@ local unknown = f_single(0xFFFD)
-- elseif k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
-- v = f_single(k)
-- else
--- k = k - 0x10000
+-- local k = k - 0x10000
-- v = f_double(rshift(k,10)+0xD800,k%1024+0xDC00)
-- end
-- t[k] = v
@@ -251,33 +251,62 @@ local conc = { }
-- table.makeweak(hash)
+-- table.setmetatableindex(hash,function(t,k)
+-- if type(k) == "table" then
+-- local n = #k
+-- for l=1,n do
+-- conc[l] = hash[k[l]]
+-- end
+-- return concat(conc,"",1,n)
+-- end
+-- local v
+-- if k >= 0x00E000 and k <= 0x00F8FF then
+-- v = unknown
+-- elseif k >= 0x0F0000 and k <= 0x0FFFFF then
+-- v = unknown
+-- elseif k >= 0x100000 and k <= 0x10FFFF then
+-- v = unknown
+-- elseif k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
+-- v = f_single(k)
+-- else
+-- local k = k - 0x10000
+-- v = f_double(rshift(k,10)+0xD800,k%1024+0xDC00)
+-- end
+-- t[k] = v
+-- return v
+-- end)
+--
+-- local function tounicode(unicode)
+-- return hash[unicode]
+-- end
+
table.setmetatableindex(hash,function(t,k)
+ if k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
+ v = f_single(k)
+ else
+ local k = k - 0x10000
+ v = f_double(rshift(k,10)+0xD800,k%1024+0xDC00)
+ end
+ t[k] = v
+ return v
+end)
+
+local function tounicode(k)
if type(k) == "table" then
local n = #k
for l=1,n do
conc[l] = hash[k[l]]
end
return concat(conc,"",1,n)
- end
- local v
- if k >= 0x00E000 and k <= 0x00F8FF then
- v = unknown
+ elseif k >= 0x00E000 and k <= 0x00F8FF then
+ return unknown
elseif k >= 0x0F0000 and k <= 0x0FFFFF then
- v = unknown
+ return unknown
elseif k >= 0x100000 and k <= 0x10FFFF then
- v = unknown
- elseif k < 0xD7FF or (k > 0xDFFF and k <= 0xFFFF) then
- v = f_single(k)
+ return unknown
else
- k = k - 0x10000
- v = f_double(rshift(k,10)+0xD800,k%1024+0xDC00)
+ return hash[k]
end
- t[k] = v
- return v
-end)
-
-local function tounicode(unicode)
- return hash[unicode]
end
local function fromunicode16(str)
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 14df60822..cd44bfef7 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -970,7 +970,7 @@ local function stripredundant(fontdata)
local n = 0
local c = 0
-- in context we always strip
- if not context and fonts.privateoffsets.keepnames then
+ if (not context and fonts.privateoffsets.keepnames) or forcekeep then
for unicode, d in next, descriptions do
if d.class == "base" then
d.class = nil
diff --git a/tex/context/base/mkiv/grph-img.lua b/tex/context/base/mkiv/grph-img.lua
index 3714b649e..c76733cbf 100644
--- a/tex/context/base/mkiv/grph-img.lua
+++ b/tex/context/base/mkiv/grph-img.lua
@@ -687,7 +687,6 @@ do
else
return
end
- -- maybe alpha some day
if colordepth == 8 then
colordepth = 1
elseif colordepth == 16 then
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index 553c60463..a41d3a3f6 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -2262,45 +2262,32 @@ local function png_checker(data) -- same as jpg (for now)
end
directives.register("graphics.pdf.uselua",function(v)
- if v then
- report("%s Lua based PDF inclusion","enabling")
- checkers.pdf = pdf_checker
- else
- report("%s Lua based PDF inclusion","disabling")
- checkers.pdf = nil
- end
+ checkers.pdf = v and pdf_checker or nil
+ report("%s Lua based PDF inclusion",v and "enabling" or "disabling")
end)
directives.register("graphics.jpg.uselua",function(v)
- if v then
- report("%s Lua based JPG inclusion","enabling")
- checkers.jpg = jpg_checker
- else
- report("%s Lua based JPG inclusion","disabling")
- checkers.jpg = nil
- end
+ checkers.jpg = v and jpg_checker or nil
+ report("%s Lua based JPG inclusion",v and "enabling" or "disabling")
end)
directives.register("graphics.jp2.uselua",function(v)
- if v then
- report("%s Lua based JP2 inclusion","enabling")
- checkers.jp2 = jp2_checker
- else
- report("%s Lua based JP2 inclusion","disabling")
- checkers.jp2 = nil
- end
+ checkers.jp2 = v and jp2_checker or nil
+ report("%s Lua based JP2 inclusion",v and "enabling" or "disabling")
end)
directives.register("graphics.png.uselua",function(v)
- if v then
- report("%s Lua based PNG inclusion","enabling")
- checkers.png = png_checker
- else
- report("%s Lua based PNG inclusion","disabling")
- checkers.png = nil
- end
+ checkers.png = v and png_checker or nil
+ report("%s Lua based PNG inclusion",v and "enabling" or "disabling")
end)
+directives.register("graphics.uselua",function(v)
+ checkers.pdf = v and pdf_checker or nil
+ checkers.jpg = v and jpg_checker or nil
+ checkers.jp2 = v and jp2_checker or nil
+ checkers.png = v and png_checker or nil
+ report("%s Lua based PDF, PNG, JPG and JP2 inclusion",v and "enabling" or "disabling")
+end)
-- directives.enable("graphics.pdf.uselua")
--
@@ -2344,30 +2331,18 @@ function bitmaps.new(xsize,ysize,colorspace,colordepth,mask)
end
local function flush(bitmap)
- img.write(lpdf.injectors.bitmap(bitmap))
+ return img.node(lpdf.injectors.bitmap(bitmap))
end
bitmaps.flush = flush
-function bitmaps.tocontext(bitmap,width,height)
- if type(width) == "number" then
- width = width .. "sp"
- end
- if type(height) == "number" then
- height = height .. "sp"
- end
- if not height and not height then
- width = bitmap.xsize .. "bp"
- height = bitmap.ysize .. "bp"
- end
+function bitmaps.tocontext(bitmap)
context.scale (
{
- width = width,
- height = height,
+ width = bitmap.xsize .. "bp",
+ height = bitmap.ysize .. "bp",
},
- function()
- flush(bitmap)
- end
+ flush(bitmap)
)
end
diff --git a/tex/context/base/mkiv/lpdf-img.lua b/tex/context/base/mkiv/lpdf-img.lua
index 28890887a..11aa00787 100644
--- a/tex/context/base/mkiv/lpdf-img.lua
+++ b/tex/context/base/mkiv/lpdf-img.lua
@@ -39,6 +39,8 @@ local report_jpg = logs.reporter("graphics","jpg")
local report_jp2 = logs.reporter("graphics","jp2")
local report_png = logs.reporter("graphics","png")
+trackers.register("graphics.backend", function(v) trace = v end)
+
local injectors = { }
lpdf.injectors = injectors
diff --git a/tex/context/base/mkiv/spac-hor.mkiv b/tex/context/base/mkiv/spac-hor.mkiv
index 3e4c28157..db8d12ae2 100644
--- a/tex/context/base/mkiv/spac-hor.mkiv
+++ b/tex/context/base/mkiv/spac-hor.mkiv
@@ -1122,6 +1122,8 @@
\unexpanded\def\spac_spaces_checked_normal {\mathortext\normalspace{\dontleavehmode\normalspace}}%
\unexpanded\def\spac_spaces_checked_fixed {\mathortext\normalspace{\dontleavehmode\fixedspace}}%
+% hm, order matters when we \let in \obeyspaces
+
\installspacemethod \v!on
{\obeyspaces
\let\obeyedspace\spac_spaces_checked_control
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 20a7f18e1..e2c84f900 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 b48b2651a..6875b27e6 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/base/mkiv/tabl-tsp.mkiv b/tex/context/base/mkiv/tabl-tsp.mkiv
index 2c4b694b3..e0ddce38a 100644
--- a/tex/context/base/mkiv/tabl-tsp.mkiv
+++ b/tex/context/base/mkiv/tabl-tsp.mkiv
@@ -441,6 +441,35 @@
\exitloop
\fi\fi}
+%D Maybe handy:
+%D
+%D \starttyping
+%D \splitfloat
+%D {\placefigure{some caption}}
+%D {\startsplittext
+%D \typefile[option=TEX,before=,after=]{oeps.tex}
+%D \stopsplittext}
+%D \stoptyping
+
+\def\handlesplittext#1%
+ {\setbox\tsplitresult\vbox
+ {\vsplit\tsplitcontent to \dimexpr#1-\lineheight\relax}}
+
+\unexpanded\def\startsplittext
+ {\begingroup
+ \resettsplit
+ \let\tsplitminimumfreelines\!!zerocount
+ \let\tsplitminimumfreespace\!!zeropoint
+ \let\extrasplitfloatlines \!!plusone
+ \let\tsplitdirectsplitter \handlesplittext
+ \setbox\tsplitcontent\vbox\bgroup
+ \insidefloattrue}
+
+\unexpanded\def\stopsplittext
+ {\egroup
+ \handledirecttsplit
+ \endgroup}
+
\protect \endinput
% test cases