From f2b76ac2cf4a0135cf6943024f7b7eaa6b2f0d5f Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 21 Aug 2013 12:00:14 +0300 Subject: beta 2013.08.21 10:55 --- tex/context/base/back-pdf.mkiv | 5 +- tex/context/base/colo-ini.lua | 87 ++++++++++++++++----- tex/context/base/colo-ini.mkiv | 33 ++++++-- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4108 -> 4109 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/font-otc.lua | 8 +- tex/context/base/math-noa.lua | 19 +++-- tex/context/base/node-ser.lua | 25 +++++- tex/context/base/s-inf-03.pdf | Bin 1974 -> 1981 bytes tex/context/base/status-files.pdf | Bin 24757 -> 24758 bytes tex/context/base/status-lua.log | 5 +- tex/context/base/typo-par.mkiv | 2 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 14 files changed, 143 insertions(+), 47 deletions(-) diff --git a/tex/context/base/back-pdf.mkiv b/tex/context/base/back-pdf.mkiv index 597899af1..4ea76e1b5 100644 --- a/tex/context/base/back-pdf.mkiv +++ b/tex/context/base/back-pdf.mkiv @@ -175,11 +175,13 @@ \unexpanded\def\dostartmirroring {\advance\backendtransformlevel\plusone + \forcecolorhack \pdfsave \pdfsetmatrix{-1 0 0 1}} % 0 0 \unexpanded\def\dostopmirroring {\pdfrestore + \forcecolorhack \advance\backendtransformlevel\minusone} % \unexpanded\def\dostartmirroring @@ -198,7 +200,8 @@ \dowithnextbox{\dodotransformnextbox{#5}{#6}{#1 #2 #3 #4}}} \unexpanded\def\dodotransformnextbox#1#2#3% - {\hbox + {%\forcecolorhack + \hbox {\kern#1\onebasepoint \raise#2\onebasepoint\hbox {\pdfsave diff --git a/tex/context/base/colo-ini.lua b/tex/context/base/colo-ini.lua index b9e8eb203..b91e564e6 100644 --- a/tex/context/base/colo-ini.lua +++ b/tex/context/base/colo-ini.lua @@ -509,7 +509,23 @@ colors.mpcolor = mpcolor colors.mpnamedcolor = mpnamedcolor colors.mpoptions = mpoptions -function colors.formatcolor(ca,separator) +-- local function formatcolor(ca,separator) +-- local cv = colorvalues[ca] +-- if cv then +-- local c, cn, f, t, model = { }, 0, 13, 13, cv[1] +-- if model == 2 then +-- return c[2] +-- elseif model == 3 then +-- return concat(c,separator,3,5) +-- elseif model == 4 then +-- return concat(c,separator,6,9) +-- end +-- else +-- return 0 +-- end +-- end + +local function formatcolor(ca,separator) local cv = colorvalues[ca] if cv then local c, cn, f, t, model = { }, 0, 13, 13, cv[1] @@ -530,41 +546,64 @@ function colors.formatcolor(ca,separator) end end -function colors.formatgray(ca,separator) +local function formatgray(ca,separator) local cv = colorvalues[ca] return format("%0.3f",(cv and cv[2]) or 0) end -function colors.colorcomponents(ca) -- return list +colors.formatcolor = formatcolor +colors.formatgray = formatgray + +local f_gray = formatters["s=%1.3f"] +local f_rgb = formatters["r=%1.3f%sg=%1.3f%sb=%1.3f"] +local f_cmyk = formatters["c=%1.3f%sm=%1.3f%sy=%1.3f%sk=%1.3f"] +local f_spot_name = formatters["p=%s"] +local f_spot_value = formatters["p=%1.3f"] +local f_transparency = formatters["a=%1.3f%st=%1.3f"] +local f_both = formatters["%s%s%s"] + +local function colorcomponents(ca,separator) -- return list local cv = colorvalues[ca] if cv then local model = cv[1] if model == 2 then - return format("s=%1.3f",cv[2]) + return f_gray(cv[2]) elseif model == 3 then - return format("r=%1.3f g=%1.3f b=%1.3f",cv[3],cv[4],cv[5]) + return f_rgb(cv[3],separator or " ",cv[4],separator or " ",cv[5]) elseif model == 4 then - return format("c=%1.3f m=%1.3f y=%1.3f k=%1.3f",cv[6],cv[7],cv[8],cv[9]) + return f_cmyk(cv[6],separator or " ",cv[7],separator or " ",cv[8],separator or " ",cv[9]) elseif type(cv[13]) == "string" then - return format("p=%s",cv[13]) + return f_spot_name(cv[13]) else - return format("p=%1.3f",cv[13]) + return f_spot_value(cv[13]) end else return "" end end -function colors.transparencycomponents(ta) +local function transparencycomponents(ta,separator) local tv = transparencyvalues[ta] if tv then - return format("a=%1.3f t=%1.3f",tv[1],tv[2]) + return f_transparency(tv[1],separator or " ",tv[2]) else return "" end end -function colors.spotcolorname(ca,default) +local function processcolorcomponents(ca,separator) + local cs = colorcomponents(ca,separator) + local ts = transparencycomponents(ca,separator) + if cs == "" then + return ts + elseif ts == "" then + return cs + else + return f_both(cs,separator or " ",ts) + end +end + +local function spotcolorname(ca,default) local cv, v = colorvalues[ca], "unknown" if cv and cv[1] == 5 then v = cv[10] @@ -572,7 +611,7 @@ function colors.spotcolorname(ca,default) return tostring(v) end -function colors.spotcolorparent(ca,default) +local function spotcolorparent(ca,default) local cv, v = colorvalues[ca], "unknown" if cv and cv[1] == 5 then v = cv[12] @@ -583,7 +622,7 @@ function colors.spotcolorparent(ca,default) return tostring(v) end -function colors.spotcolorvalue(ca,default) +local function spotcolorvalue(ca,default) local cv, v = colorvalues[ca], 0 if cv and cv[1] == 5 then v = cv[13] @@ -591,6 +630,13 @@ function colors.spotcolorvalue(ca,default) return tostring(v) end +colors.colorcomponents = colorcomponents +colors.transparencycomponents = transparencycomponents +colors.processcolorcomponents = processcolorcomponents +colors.spotcolorname = spotcolorname +colors.spotcolorparent = spotcolorparent +colors.spotcolorvalue = spotcolorvalue + -- experiment (a bit of a hack, as we need to get the attribute number) local min = math.min @@ -752,13 +798,14 @@ commands.definemultitonecolor = colors.definemultitonecolor commands.definetransparency = colors.definetransparency commands.defineintermediatecolor = colors.defineintermediatecolor -function commands.spotcolorname (a) context(colors.spotcolorname (a)) end -function commands.spotcolorparent (a) context(colors.spotcolorparent (a)) end -function commands.spotcolorvalue (a) context(colors.spotcolorvalue (a)) end -function commands.colorcomponents (a) context(colors.colorcomponents (a)) end -function commands.transparencycomponents(a) context(colors.transparencycomponents(a)) end -function commands.formatcolor (...) context(colors.formatcolor (...)) end -function commands.formatgray (...) context(colors.formatgray (...)) end +function commands.spotcolorname (a) context(spotcolorname (a)) end +function commands.spotcolorparent (a) context(spotcolorparent (a)) end +function commands.spotcolorvalue (a) context(spotcolorvalue (a)) end +function commands.colorcomponents (a,s) context(colorcomponents (a,s)) end +function commands.transparencycomponents(a,s) context(transparencycomponents(a,s)) end +function commands.processcolorcomponents(a,s) context(processcolorcomponents(a,s)) end +function commands.formatcolor (...) context(formatcolor (...)) end +function commands.formatgray (...) context(formatgray (...)) end function commands.mpcolor(model,ca,ta,default) context(mpcolor(model,ca,ta,default)) diff --git a/tex/context/base/colo-ini.mkiv b/tex/context/base/colo-ini.mkiv index 3a037691e..808a46c96 100644 --- a/tex/context/base/colo-ini.mkiv +++ b/tex/context/base/colo-ini.mkiv @@ -70,7 +70,7 @@ %D {definecolor,defineglobalcolor,definenamedcolor,definespotcolor,definemultitonecolor, %D definetransparency} %D -%D \startbuffer +%D \starttyping %D \definecolor [blue] [c=1,m=.38,y=0,k=.64] % pantone pms 2965 uncoated m %D \definecolor [yellow] [c=0,m=.28,y=1,k=.06] % pantone pms 124 uncoated m %D @@ -79,6 +79,12 @@ %D %D \definemultitonecolor [pdftoolscolor] [blue=.12,yellow=.28] [c=.1,m=.1,y=.3,k=.1] %D +%D \defineprocesscolor[myred][r=.5] +%D \defineprocesscolor[myredish][red][a=1,t=.5] +%D +%D \blackrule[color=myred,width=\hsize,height=1cm] \par +%D \blackrule[color=myredish,width=\hsize,height=1cm] +%D %D \useexternalfigure[demofig][mill.png][object=no] %D %D \startcombination[4*1] @@ -87,12 +93,11 @@ %D {\externalfigure[demofig][color=blue-100]} {spot color} %D {\externalfigure[demofig][color=yellow-100]} {spot color} %D \stopcombination -%D \stopbuffer -%D -%D \getbuffer \typebuffer +%D \stoptyping \unexpanded\def\definecolor {\dodoubleargument\colo_basics_define} \unexpanded\def\defineglobalcolor {\dodoubleargument\colo_basics_define_global} +\unexpanded\def\defineprocesscolor {\dotripleargument\colo_basics_define_process} \unexpanded\def\definenamedcolor {\dodoubleargument\colo_basics_define_named} \unexpanded\def\definespotcolor {\dotripleargument\colo_basics_define_spot} \unexpanded\def\definemultitonecolor{\doquadrupleempty\colo_basics_define_multitone} @@ -597,7 +602,7 @@ \def\v_colo_dummy_name{d_u_m_m_y} -\letvalue{\??colorsetter-}\empty % used? +\letvalue{\??colorsetter -}\empty % used? \letvalue{\??transparencysetter-}\empty % used? % new: expandable (see tbl) @@ -688,7 +693,7 @@ {\ctxcommand{defineprocesscolor("#1","#2",true,\v_colo_freeze_state)}% \unexpanded\setgvalue{#1}{\colo_helpers_activate{#1}}} -\def\colo_basics_define_named[#1][#2]% +\def\colo_basics_define_named[#1][#2]% currently same as define {\ctxcommand{defineprocesscolor("#1","#2",false,\v_colo_freeze_state)}% \unexpanded\setvalue{#1}{\colo_helpers_activate{#1}}} @@ -700,6 +705,21 @@ {\ctxcommand{defineprocesscolor("\v_colo_dummy_name","#1",false,false)}% \colo_helpers_activate_dummy} +\def\colo_basics_define_process + {\ifthirdargument + \expandafter\colo_basics_define_process_yes + \else + \expandafter\colo_basics_define_process_nop + \fi} + +\def\colo_basics_define_process_yes[#1][#2][#3]% + {\ctxcommand{defineprocesscolor("#1","\processcolorcomponents{#2},#3",false,\v_colo_freeze_state)}% + \unexpanded\setvalue{#1}{\colo_helpers_activate{#1}}} + +\def\colo_basics_define_process_nop[#1][#2][#3]% + {\ctxcommand{defineprocesscolor("#1","#2",false,\v_colo_freeze_state)}% + \unexpanded\setvalue{#1}{\colo_helpers_activate{#1}}} + % Spotcolors used setxvalue but that messes up currentcolor % and probably no global is needed either but they are global % at the lua end (true argument) so we keep that if only because @@ -1018,6 +1038,7 @@ \def\colorcomponents #1{\ctxcommand{colorcomponents(\thecolorattribute{#1})}} \def\transparencycomponents #1{\ctxcommand{transparencycomponents(\thetransparencyattribute{#1})}} +\def\processcolorcomponents #1{\ctxcommand{processcolorcomponents(\thecolorattribute{#1},",")}} \def\colorvalue #1{\ctxcommand{formatcolor(\thecolorattribute{#1},"\colorformatseparator")}} \def\grayvalue #1{\ctxcommand{formatgray (\thecolorattribute{#1},"\colorformatseparator")}} diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index c1d44cc59..6c801bb4a 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.08.20 13:38} +\newcontextversion{2013.08.21 10:55} %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 edf7b01d2..7c7b75d2c 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 7ac17a1bc..0e29ba277 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.08.20 13:38} +\edef\contextversion{2013.08.21 10:55} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua index a87dcadf8..3006e47ca 100644 --- a/tex/context/base/font-otc.lua +++ b/tex/context/base/font-otc.lua @@ -188,9 +188,11 @@ otf.enhancers.register("check extra features",enhance) -- tlig -- -local tlig = { - endash = "hyphen hyphen", - emdash = "hyphen hyphen hyphen", +local tlig = { -- we need numbers for some fonts so ... + -- endash = "hyphen hyphen", + -- emdash = "hyphen hyphen hyphen", + [0x2013] = { 0x002D, 0x002D }, + [0x2014] = { 0x002D, 0x002D, 0x002D }, -- quotedblleft = "quoteleft quoteleft", -- quotedblright = "quoteright quoteright", -- quotedblleft = "grave grave", diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 99a1594af..8a5d3f546 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -119,6 +119,7 @@ local hlist_code = nodecodes.hlist local glyph_code = nodecodes.glyph local left_fence_code = 1 +local right_fence_code = 3 local function process(start,what,n,parent) if n then n = n + 1 else n = 0 end @@ -443,16 +444,20 @@ local mathsize = attributes.private("mathsize") local resize = { } processors.resize = resize resize[math_fence] = function(pointer) - if pointer.subtype == left_fence_code then + local subtype = pointer.subtype + if subtype == left_fence_code or subtype == right_fence_code then local a = pointer[mathsize] if a and a > 0 then + local method, size = div(a,100), a % 100 pointer[mathsize] = 0 - local d = pointer.delim - local df = d.small_fam - local id = font_of_family(df) - if id > 0 then - local ch = d.small_char - d.small_char = mathematics.big(fontdata[id],ch,a) + local delimiter = pointer.delim + local chr = delimiter.small_char + if chr > 0 then + local fam = delimiter.small_fam + local id = font_of_family(fam) + if id > 0 then + delimiter.small_char = mathematics.big(fontdata[id],chr,size,method) + end end end end diff --git a/tex/context/base/node-ser.lua b/tex/context/base/node-ser.lua index e69b4fc28..d7593cec7 100644 --- a/tex/context/base/node-ser.lua +++ b/tex/context/base/node-ser.lua @@ -9,8 +9,9 @@ if not modules then modules = { } end modules ['node-ser'] = { -- beware, some field names will change in a next releases -- of luatex; this is pretty old code that needs an overhaul -local type, format, rep = type, string.format, string.rep +local type = type local concat, tohash, sortedkeys, printtable = table.concat, table.tohash, table.sortedkeys, table.print +local formatters, format, rep = string.formatters, string.format, string.rep local allocate = utilities.storage.allocate @@ -22,6 +23,7 @@ local traverse = nodes.traverse local is_node = nodes.is_node local nodecodes = nodes.nodecodes +local subtcodes = nodes.codes local noadcodes = nodes.noadcodes local getfields = nodes.fields @@ -30,6 +32,12 @@ local tonode = nodes.tonode local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist +----- utfchar = utf.char +local f_char = formatters["%U"] +----- fontchars = { } table.setmetatableindex(fontchars,function(t,k) fontchars = fonts.hashes.characters return fontchars[k] end) + +----- f_char = utilities.strings.chkuni -- formatters["%!chkuni!"] + local expand = allocate ( tohash { -- text: "list", -- list_ptr & ins_ptr & adjust_ptr @@ -154,7 +162,7 @@ local function totable(n,flat,verbose,noattributes) -- nicest: n,true,true,true local id = tt.id local nodename = nodecodes[id] tt.id = nodename - local subtypes = nodes.codes[nodename] + local subtypes = subtcodes[nodename] if subtypes then tt.subtype = subtypes[subtype] elseif subtype == 0 then @@ -162,6 +170,15 @@ local function totable(n,flat,verbose,noattributes) -- nicest: n,true,true,true else -- we need a table end + if tt.char then + tt.char = f_char(tt.char) + end + if tt.small_char then + tt.small_char = f_char(tt.small_char) + end + if tt.large_char then + tt.large_char = f_char(tt.large_char) + end end return tt end @@ -199,7 +216,7 @@ end -- not ok yet; this will become a module --- todo: adapt to nodecodes etc +-- todo: adapt to nodecodes etc .. use formatters local function serialize(root,name,handle,depth,m,noattributes) handle = handle or print @@ -229,7 +246,7 @@ local function serialize(root,name,handle,depth,m,noattributes) fld = sortedkeys(root) end if type(root) == 'table' and root['type'] then -- userdata or table - handle(format("%s %s=%q,",depth,'type',root['type'])) + handle(format("%s type=%q,",depth,root['type'])) end for f=1,#fld do local k = fld[f] diff --git a/tex/context/base/s-inf-03.pdf b/tex/context/base/s-inf-03.pdf index 74b183f3f..30df291ed 100644 Binary files a/tex/context/base/s-inf-03.pdf and b/tex/context/base/s-inf-03.pdf differ diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 2313e57ca..b30cca021 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index cf5474a6f..83bb6385c 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,13 +1,12 @@ (cont-yes.mkiv -ConTeXt ver: 2013.08.20 13:38 MKIV beta fmt: 2013.8.20 int: english/english +ConTeXt ver: 2013.08.21 10:55 MKIV beta fmt: 2013.8.21 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) system > 'cont-loc.mkiv' loaded (c:/data/develop/context/sources/cont-loc.mkiv !!!! > testing prevdepth across page -!!!! > testing rotation and scaling ) system > 'cont-exp.mkiv' loaded interface > macros > processed mkvi file 'c:/data/develop/context/sources/cont-exp.mkiv', delta 0 @@ -77,4 +76,4 @@ references > unknown reference '[][math]' references > unknown reference '[][mathematics]' references > unknown reference '[][mbox]' references > unknown reference '[][md5]' -r \ No newline at end of file +references > unknown reference '[][metapost \ No newline at end of file diff --git a/tex/context/base/typo-par.mkiv b/tex/context/base/typo-par.mkiv index 7153d1f8a..73396716b 100644 --- a/tex/context/base/typo-par.mkiv +++ b/tex/context/base/typo-par.mkiv @@ -49,6 +49,8 @@ %D \placeinitial \input ward \par \input ward \placeinitial \input tufte %D \stoptyping +% todo: angle (once we can set parshape at the Lua end) + \installcorenamespace{initial} \installsimplecommandhandler \??initial {initial} \??initial diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2a68f8baf..65807e396 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 : 08/20/13 13:38:20 +-- merge date : 08/21/13 10:55:10 do -- begin closure to overcome local limits and interference -- cgit v1.2.3