diff options
39 files changed, 473 insertions, 112 deletions
diff --git a/doc/context/documents/general/manuals/graphics.pdf b/doc/context/documents/general/manuals/graphics.pdf Binary files differnew file mode 100644 index 000000000..455071bc1 --- /dev/null +++ b/doc/context/documents/general/manuals/graphics.pdf diff --git a/doc/context/documents/general/manuals/luatex.pdf b/doc/context/documents/general/manuals/luatex.pdf Binary files differindex 3af62acd7..19c1aa51e 100644 --- a/doc/context/documents/general/manuals/luatex.pdf +++ b/doc/context/documents/general/manuals/luatex.pdf diff --git a/doc/context/documents/general/manuals/musings.pdf b/doc/context/documents/general/manuals/musings.pdf Binary files differindex 7573569b9..9d83dd555 100644 --- a/doc/context/documents/general/manuals/musings.pdf +++ b/doc/context/documents/general/manuals/musings.pdf diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex db96bb54f..c7d6a120e 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex f65a41e0d..ad88a3407 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex e1e1bc1cd..5af37d839 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex cca294dfd..051c9b57b 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 789088c63..d00631ee3 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex 7d38dea46..fcea50fe8 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex 0fc61cd85..523676873 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex 21537aa94..478f26510 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex 8ca776be2..1deb0f13a 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex a2691c1e8..481c3dcaa 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex 4e1491898..4fddb97c8 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex bbd19ee43..b1febc0aa 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex a1fdf1440..7eb50d16e 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex c67652ac4..e85c12bfe 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/sources/general/manuals/graphics/graphics.tex b/doc/context/sources/general/manuals/graphics/graphics.tex new file mode 100644 index 000000000..84a5acc22 --- /dev/null +++ b/doc/context/sources/general/manuals/graphics/graphics.tex @@ -0,0 +1,286 @@ +% language=uk + +\usemodule[article-basic] +\usemodule[abbreviations-smallcaps] +\usemodule[setups-basics] +\usemodule[scite] + +% \setupbodyfont +% [dejavu] + +\loadsetups[context-en] + +\definecolor + [mysetupscolora] + [a=1, + t=.25, + r=.5, + g=.5] + +\definecolor + [mysetupscolorb] + [a=1, + t=.25, + g=.25, + b=.25] + +\definetextbackground + [mysetups] + [before=\blank, + after=\blank, + topoffset=10pt, + leftoffset=10pt, + location=paragraph, + backgroundcolor=mysetupscolora, + backgroundcolor=mysetupscolorb, + frame=off] + +\startsetups xml:setups:start + \starttextbackground[mysetups] +\stopsetups + +\startsetups xml:setups:stop + \stoptextbackground +\stopsetups + +\starttext + +\startbuffer[image] + \startluacode + + local min, max, random = math.min, math.max, math.random + + -- kind of self-explaining: + + local xsize = 210 + local ysize = 297 + local colordepth = 1 + local usemask = true + local colorspace = "rgb" + + -- initialization: + + local bitmap = graphics.bitmaps.new(xsize,ysize,colorspace,colordepth,usemask) + + -- filling the bitmap: + + local data = bitmap.data + local mask = bitmap.mask + local minmask = 100 + local maxmask = 200 + + for i=1,ysize do + local d = data[i] + local m = mask[i] + for j=1,xsize do + d[j] = { i, max(i,j), j, min(i,j) } + m[j] = random(minmask,maxmask) + end + end + + -- flushing the lot: + + graphics.bitmaps.tocontext(bitmap) + + \stopluacode +\stopbuffer + +\definelayer + [page] + [width=\paperwidth, + height=\paperheight] + +\setlayer + [page] + {\scale + [width=\paperwidth] + {\ignorespaces + \getbuffer[image]% + \removeunwantedspaces}} + +\setlayer + [page] + [preset=rightbottom, + hoffset=10mm, + voffset=45mm] + {\scale + [width=.6\paperwidth] + {Graphics}} + +% \setlayer +% [page] +% [preset=righttop, +% hoffset=10mm, +% voffset=20mm] +% {\rotate{\scale +% [width=.3\paperheight] +% {\ConTeXt\ MkIV}}} + +\setlayer + [page] + [preset=rightbottom, + hoffset=10mm, + voffset=20mm] + {\scale + [width=.6\paperwidth] + {Hans Hagen}} + +\startpagemakeup + \flushlayer[page] + \vfill +\stoppagemakeup + +\startsubject[title=Introduction] + +This manual is about integrating graphics your document. Doing this is not really +that complex so this manual will be short. Because graphic inclusion is related +to the backend some options will discussed. It's typical one of these manuals +that can grow over time. + +\stopsubject + +\startsubject[title=Inclusion] + +The command to include an image is: + +\showsetup{externalfigure} + +and its related settings are: + +\showsetup{setupexternalfigure} + +So you can say: + +\starttyping[option=TEX] +\externalfigure[cow.pdf][width=4cm] +\stoptyping + +The suffix is optional, which means that this will also work: + +\starttyping[option=TEX] +\externalfigure[cow][width=4cm] +\stoptyping + +\stopsubject + +\startsubject[title=Defining] + +{\em todo} + +\showsetup{useexternalfigure} +\showsetup{defineexternalfigure} +\showsetup{registerexternalfigure} + +\stopsubject + +\startsubject[title=Analyzing] + +{\em todo} + +\showsetup{getfiguredimensions} + +\showsetup{figurefilename} +\showsetup{figurefilepath} +\showsetup{figurefiletype} +\showsetup{figurefullname} +\showsetup{figureheight} +\showsetup{figurenaturalheight} +\showsetup{figurenaturalwidth} +\showsetup{figuresymbol} +\showsetup{figurewidth} + +\showsetup{noffigurepages} + +\stopsubject + +\startsubject[title=Collections] + +{\em todo} + +\showsetup{externalfigurecollectionmaxheight} +\showsetup{externalfigurecollectionmaxwidth} +\showsetup{externalfigurecollectionminheight} +\showsetup{externalfigurecollectionminwidth} +\showsetup{externalfigurecollectionparameter} +\showsetup{startexternalfigurecollection} + +\stopsubject + +\startsubject[title=Conversion] + +{\em todo} + +\stopsubject + +\startsubject[title=Figure databases] + +{\em todo} + +\showsetup{usefigurebase} + +\stopsubject + +\startsubject[title=Overlays] + +{\em todo} + +\showsetup{overlayfigure} +\showsetup{pagefigure} + +\stopsubject + +\startsubject[title=Scaling] + +Images are normally scaled proportionally but if needed you can give an +explicit height and width. The \type {\scale} command shares this property +and can be used to scale in the same way as \type {\externalfigure}. I will +illustrate this with an example. + +You can define your own bitmaps, like I did with the cover of this manual: + +\typebuffer[image][option=LUA] + +The actually inclusion of this image happened with: + +\starttyping[option=TEX] +\scale + [width=\paperwidth] + {\getbuffer[image]} +\stoptyping + +\stopsubject + +\startsubject[title=The backend] + +Traditionally \TEX\ sees an image as just a box with dimensions and in \LUATEX\ +it is actually a special kind of rule that carries information about what to +inject in the final (\PDF) file. In regular \LUATEX\ the core formats \type +{pdf}, \type {png}, \type {jpg} and \type {jp2} are dealt with by the backend but +in \CONTEXT\ we can use \LUA\ instead. We might default to that method at some +point but for now you need to enable that explicitly: + +\starttyping[option=TEX] +\enabledirectrive[graphics.pdf.uselua] +\enabledirectrive[graphics.jpg.uselua] +\enabledirectrive[graphics.jp2.uselua] +\enabledirectrive[graphics.png.uselua] +\stoptyping + +All four can be enabled with: + +\starttyping[option=TEX] +\enabledirectrive[graphics.uselua] +\stoptyping + +Performance|-|wise only \PNG\ inclusion can be less efficient, but only when you +use interlaced images or large images with masks. It makes no real sense in a +professional workflow to use the (larger) interlaced images, and masks are seldom +used at high resolutions, so in practice one will not really notice loss of +performance. + +The advantage of this method is that we can provide more options, intercept bad +images that make the backend abort and lessen the dependency on libraries. + +\stopsubject + +\stoptext diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 72d476f01..3f7c0e7ef 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{2018.10.17 15:06} +\newcontextversion{2018.10.18 00:07} %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 922f96320..d530cd65d 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{2018.10.17 15:06} +\edef\contextversion{2018.10.18 00:07} %D For those who want to use this: 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 Binary files differindex 20a7f18e1..e2c84f900 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex b48b2651a..6875b27e6 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf 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 diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex e1e1bc1cd..5af37d839 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex b8ae1bd64..003bdabaf 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/m-scite.mkiv b/tex/context/modules/mkiv/m-scite.mkiv index eaac6ecae..9182fa2ec 100644 --- a/tex/context/modules/mkiv/m-scite.mkiv +++ b/tex/context/modules/mkiv/m-scite.mkiv @@ -227,7 +227,7 @@ local function lexdata(data,lexname) end data = indent(data) end -io.savedata("temp.logs ",data) + -- io.savedata("temp.log",data) assignbuffer("lex",data) end @@ -324,11 +324,11 @@ visualizers.register("json", visualizer) \unexpanded\def\buff_scite_slxb#1% {\hangindent\numexpr#1+2\relax\scitespaceskip - \hskip#1\scitespaceskip + \begstrut\hskip#1\scitespaceskip \hangafter 1\relax} \unexpanded\def\buff_scite_slxe - {\par} + {\endstrut\par} \unexpanded\def\buff_scite_slxs {\hskip\scitespaceskip\relax} \unexpanded\def\buff_scite_slxf#1{\hskip#1\scitespaceskip\relax} diff --git a/tex/context/modules/mkiv/s-fonts-system.lua b/tex/context/modules/mkiv/s-fonts-system.lua index 5d2692473..dc0f2e6a3 100644 --- a/tex/context/modules/mkiv/s-fonts-system.lua +++ b/tex/context/modules/mkiv/s-fonts-system.lua @@ -114,7 +114,7 @@ end local splitter = lpeg.splitat(lpeg.S("._"),true) -local method = 3 +local method = 4 function moduledata.fonts.system.showinstalledglyphnames(specification) specification = interfaces.checkedspecification(specification) @@ -129,7 +129,8 @@ function moduledata.fonts.system.showinstalledglyphnames(specification) end end for filename in table.sortedhash(files) do - logs.report("system","fontfile: %s",file.nameonly(filename)) + local fontname = file.nameonly(filename) + logs.report("system","fontfile: %s",fontname) local data = table.load(filename) if data then if method == 1 then @@ -178,31 +179,60 @@ function moduledata.fonts.system.showinstalledglyphnames(specification) end end end + elseif method == 4 then + local descriptions = data.descriptions + if descriptions then + for u, d in sortedhash(descriptions) do + local n = d.name + local u = d.unicode + if n and not u and not find(n,"^%.") then + local n = names[n] + n[#n+1] = fontname + end + end + end else -- nothing end end end - if next(names) then - context.starttabulate { "|l|pl|" } - local f_u = formatters["%04X~(%i)"] - local f_s = formatters["%s~(%i)"] - for k, v in sortedhash(names) do - local t = { } - for k, v in sortedhash(v) do - if type(k) == "string" then - t[#t+1] = f_s(k,v) - else - t[#t+1] = f_u(k,v) + -- names[".notdef"] = nil + -- names[".null"] = nil + if method == 4 then + if next(names) then + context.starttabulate { "|l|pl|" } + local f_u = formatters["%04X~(%i)"] + local f_s = formatters["%s~(%i)"] + for k, v in sortedhash(names) do + NC() ctx_verbatim(k) + NC() context("% t",v) + NC() NR() + end + context.stoptabulate() + end + table.save("s-fonts-system-glyph-unknowns.lua",names) + else + if next(names) then + context.starttabulate { "|l|pl|" } + local f_u = formatters["%04X~(%i)"] + local f_s = formatters["%s~(%i)"] + for k, v in sortedhash(names) do + local t = { } + for k, v in sortedhash(v) do + if type(k) == "string" then + t[#t+1] = f_s(k,v) + else + t[#t+1] = f_u(k,v) + end end + NC() ctx_verbatim(k) + NC() context("%, t",t) + NC() NR() end - NC() ctx_verbatim(k) - NC() context("% t",t) - NC() NR() + context.stoptabulate() end - context.stoptabulate() + table.save("s-fonts-system-glyph-names.lua",names) end - table.save("s-fonts-system-glyph-names.lua",names) end -- -- -- diff --git a/tex/context/modules/mkiv/s-fonts-system.mkiv b/tex/context/modules/mkiv/s-fonts-system.mkiv index 03599b0df..9a0f7485d 100644 --- a/tex/context/modules/mkiv/s-fonts-system.mkiv +++ b/tex/context/modules/mkiv/s-fonts-system.mkiv @@ -39,12 +39,12 @@ % \showinstalledfonts - \enabletrackers[otf.keepnames] +% \enabletrackers[otf.keepnames] - \cacheinstalledfonts[suffixes={otf,ttf,afm}] +% \cacheinstalledfonts[suffixes={otf,ttf,afm}] % \cacheinstalledfonts[threshold=4000000,suffixes={otf,ttf,afm}] % \cacheinstalledfonts[threshold=2000000,suffixes={otf,ttf,afm}] -% \showinstalledglyphnames + \showinstalledglyphnames \stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index f97f82489..0a14e6082 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/17/18 15:06:55 +-- merge date : 10/18/18 00:07:52 do -- begin closure to overcome local limits and interference @@ -9414,6 +9414,7 @@ function constructors.scale(tfmdata,specification) targetparameters.forcedsize=forcedsize targetparameters.extrafactor=extrafactor local tounicode=fonts.mappings.tounicode + local unknowncode=tounicode(0xFFFD) local defaultwidth=resources.defaultwidth or 0 local defaultheight=resources.defaultheight or 0 local defaultdepth=resources.defaultdepth or 0 @@ -9669,6 +9670,7 @@ function constructors.scale(tfmdata,specification) chr.unicode=isunicode chr.tounicode=tounicode(isunicode) else + chr.tounicode=unknowncode end if hasquality then local ve=character.expansion_factor @@ -10759,31 +10761,31 @@ local unknown=f_single(0xFFFD) local hash={} local conc={} 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) if #str==4 then @@ -21065,7 +21067,7 @@ local function stripredundant(fontdata) if descriptions then local n=0 local c=0 - 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 |