diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4113 -> 4118 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-gds.lua | 38 | ||||
-rw-r--r-- | tex/context/base/font-odv.lua | 23 | ||||
-rw-r--r-- | tex/context/base/font-pre.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/meta-fnt.lua | 19 | ||||
-rw-r--r-- | tex/context/base/meta-pag.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/mlib-pdf.lua | 22 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24782 -> 24733 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.log | 2 | ||||
-rw-r--r-- | tex/context/base/typo-krn.lua | 71 | ||||
-rw-r--r-- | tex/context/fonts/unifraktur.lfg | 17 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
14 files changed, 153 insertions, 51 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 233482b35..5b54b459f 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.01 11:27} +\newcontextversion{2013.10.01 19:00} %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 Binary files differindex 002df6dd6..224eaeec1 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index dc16c148b..20ba815f4 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.01 11:27} +\edef\contextversion{2013.10.01 19:00} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua index 1b2ac0009..284714261 100644 --- a/tex/context/base/font-gds.lua +++ b/tex/context/base/font-gds.lua @@ -832,3 +832,41 @@ registerotffeature { node = finalize, } } + +-- kern hackery + +local function setkeptligatures(tfmdata,scheme) + local goodies = tfmdata.goodies + if goodies then + for i=1,#goodies do + local g = goodies[i] + local letterspacing = g.letterspacing + if letterspacing then + local keptligatures = letterspacing.keptligatures + if keptligatures then + local unicodes = tfmdata.resources.unicodes + local hash = { } + for k, v in next, keptligatures do + local u = unicodes[k] + if u then + hash[u] = true + else + -- error: unknown name + end + end + tfmdata.properties.keptligatures = hash + end + end + end + end +end + +registerotffeature { + name = "keptligatures", + description = "kept ligatures in letterspacing", + default = true, + initializers = { + base = setkeptligatures, + node = setkeptligatures, + } +} diff --git a/tex/context/base/font-odv.lua b/tex/context/base/font-odv.lua index 7437bd8c3..69f74dfa5 100644 --- a/tex/context/base/font-odv.lua +++ b/tex/context/base/font-odv.lua @@ -133,7 +133,12 @@ replace_all_nbsp = function(head) -- delayed definition end local fontprocesses = fonts.hashes.processes -local xprocesscharacters = nodes.handlers.characters +local xprocesscharacters = nil + +xprocesscharacters = function(head,font) + xprocesscharacters = nodes.handlers.characters + return xprocesscharacters(head,font) +end local function processcharacters(head,font) return xprocesscharacters(head) @@ -559,7 +564,7 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) -- if syllable starts with Ra + H and script has 'Reph' then exclude Reph -- from candidates for base consonants if n == stop then - return head, stop + return head, stop, nbspaces end if n.next.char == c_zwj then current = start @@ -575,7 +580,7 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) stop = stop.prev head = remove_node(head,current) free_node(current) - return head, stop + return head, stop, nbspaces else nbspaces = nbspaces + 1 base = current @@ -592,7 +597,7 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) if next ~= stop and halant[next.char] then current = next next = current.next - local tmp = next.next + local tmp = next and next.next or nil -- needs checking local changestop = next == stop local tempcurrent = copy_node(next) local nextcurrent = copy_node(current) @@ -610,7 +615,9 @@ local function deva_reorder(head,start,stop,font,attr,nbspaces) current.char = tempcurrent.char -- (assumes that result of blwf consists of one node) local freenode = current.next current.next = tmp - tmp.prev = current + if tmp then + tmp.prev = current + end free_node(freenode) flush_list(tempcurrent) if changestop then @@ -1390,12 +1397,12 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa current = start.next.next end - local function action(is_nbsp) + local function stand_alone(is_nbsp) if current == stop then stop = stop.prev head = remove_node(head,current) free_node(current) - return head, stop + return head, stop, nbspaces else if is_nbsp then nbspaces = nbspaces + 1 @@ -1473,7 +1480,7 @@ local function dev2_reorder(head,start,stop,font,attr,nbspaces) -- maybe do a pa if start[a_state] == s_rphf then start[a_state] = unsetvalue end - return head, stop + return head, stop, nbspaces else if base[a_state] then base[a_state] = unsetvalue diff --git a/tex/context/base/font-pre.mkiv b/tex/context/base/font-pre.mkiv index e58a3d1f5..63c0858d4 100644 --- a/tex/context/base/font-pre.mkiv +++ b/tex/context/base/font-pre.mkiv @@ -17,6 +17,8 @@ %D A basic set of features is defined here. +% rlig ccmp + \definefontfeature [always] [mode=auto, diff --git a/tex/context/base/meta-fnt.lua b/tex/context/base/meta-fnt.lua index 811690b69..0ebe8e0dc 100644 --- a/tex/context/base/meta-fnt.lua +++ b/tex/context/base/meta-fnt.lua @@ -28,20 +28,25 @@ metapost.fonts = metapost.fonts or { } local characters, descriptions = { }, { } local factor, code, slot, width, height, depth, total, variants = 100, { }, 0, 0, 0, 0, 0, 0, true --- A next version of mplib will provide the tfm font information which --- gives better glyph dimensions, plus additional kerning information. --- --- Somehow actualtext is not used for cut and paste ... in spite of what --- manuals say ... the usual compatibility mess I guess. +-- The next variant of ActualText is what Taco and I could come up with +-- eventually. As of September 2013 Acrobat copies okay, Summatra copies a +-- question mark, pdftotext injects an extra space and Okular adds a +-- newline plus space. + +-- return formatters["BT /Span << /ActualText (CONTEXT) >> BDC [<feff>] TJ % t EMC ET"](code) local function topdf(n,code) if n < 0x10000 then - return formatters["/Span << /ActualText <feff%04x> >> BDC % t EMC"](n,code) + return formatters["BT /Span << /ActualText <feff%04x> >> BDC [<feff>] TJ % t EMC ET"](n,code) else - return formatters["/Span << /ActualText <feff%04x%04x> >> BDC % t EMC"](n/1024+0xD800,n%1024+0xDC00,code) + return formatters["BT /Span << /ActualText <feff%04x%04x> >> BDC [<feff>] TJ % t EMC ET"](n/1024+0xD800,n%1024+0xDC00,code) end end +-- local function topdf(n,code) +-- return formatters["/Span << /ActualText (CTX) >> BDC % t EMC"](code) +-- end + local flusher = { startfigure = function(chrnum,llx,lly,urx,ury) code = { } diff --git a/tex/context/base/meta-pag.mkiv b/tex/context/base/meta-pag.mkiv index 7124902e7..a25353b18 100644 --- a/tex/context/base/meta-pag.mkiv +++ b/tex/context/base/meta-pag.mkiv @@ -41,7 +41,7 @@ % maybe always set as frozen anyway \startMPinitializations - def LoadPageState = + % def LoadPageState = OnRightPage:=\MPonrightpage; OnOddPage:=\MPonoddpage; RealPageNumber:=\the\realpageno; @@ -88,6 +88,8 @@ LayoutColumns:=\the\layoutcolumns; LayoutColumnDistance:=\the\layoutcolumndistance; LayoutColumnWidth:=\the\layoutcolumnwidth; + def LoadPageState = + % now always set .. this dummy can move to the mp code enddef; \stopMPinitializations diff --git a/tex/context/base/mlib-pdf.lua b/tex/context/base/mlib-pdf.lua index 0115dfabe..8d7febf43 100644 --- a/tex/context/base/mlib-pdf.lua +++ b/tex/context/base/mlib-pdf.lua @@ -335,19 +335,23 @@ function metapost.flush(result,flusher,askedfig) local bbox = figure:boundingbox() local llx, lly, urx, ury = bbox[1], bbox[2], bbox[3], bbox[4] local variables = { } + metapost.variables = variables + metapost.properties = { + llx = llx, + lly = lly, + urx = urx, + ury = ury, + slot = figure:charcode(), + width = figure:width(), + height = figure:height(), + depth = figure:depth(), + italic = figure:italcorr(), + } + -- replaced by the above metapost.llx = llx metapost.lly = lly metapost.urx = urx metapost.ury = ury - metapost.variables = variables --- todo (maybe the lib will change to charwd too): --- --- metapost.charcode = figure.charcode --- metapost.charwd = figure.width --- metapost.charht = figure.height --- metapost.chardp = figure.depth --- metapost.charic = figure.italic --- if urx < llx then -- invalid startfigure(fignum,0,0,0,0,"invalid",figure) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex b8041dc9b..3825c5148 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index 5008311ec..be7dbe7e1 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.01 11:27 MKIV beta fmt: 2013.10.1 int: english/english +ConTeXt ver: 2013.10.01 19:00 MKIV beta fmt: 2013.10.1 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua index a7f17e280..2fc3ff13e 100644 --- a/tex/context/base/typo-krn.lua +++ b/tex/context/base/typo-krn.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['typo-krn'] = { license = "see context related readme files" } +-- glue is still somewhat suboptimal + local next, type, tonumber = next, type, tonumber local utfchar = utf.char @@ -53,6 +55,8 @@ local fontdata = fonthashes.identifiers local chardata = fonthashes.characters local quaddata = fonthashes.quads local markdata = fonthashes.marks +local fontproperties = fonthashes.properties +local fontdescriptions = fonthashes.descriptions local v_max = interfaces.variables.max @@ -62,6 +66,9 @@ local typesetters = typesetters typesetters.kerns = typesetters.kerns or { } local kerns = typesetters.kerns +local report = logs.reporter("kerns") +local trace_ligatures = trackers.register("typesetters.kerns.ligatures",function(v) trace_ligatures = v end) + kerns.mapping = kerns.mapping or { } kerns.factors = kerns.factors or { } local a_kerns = attributes.private("kern") @@ -85,6 +92,26 @@ local gluefactor = 4 -- assumes quad = .5 enspace kerns.keepligature = false -- just for fun (todo: control setting with key/value) kerns.keeptogether = false -- just for fun (todo: control setting with key/value) +function kerns.keepligature(n) -- might become default + local f = n.font + local c = n.char + local k = fontproperties[f].keptligatures + if trace_ligatures then + -- mostly for identifying names as they get reported + local d = fontdescriptions[f][c].name + if k and k[c] then + report("font %s, glyph %a, slot %X -> kept ligature",f,d,c) + return true + else + report("font %s, glyph %a, slot %X -> split ligature",f,d,c) + end + else + if k and k[c] then + return true + end + end +end + -- can be optimized .. the prev thing .. but hardly worth the effort local function kern_injector(fillup,kern) @@ -133,30 +160,30 @@ local function do_process(head,force) -- todo: glue so that we can fully stretch if id == glyph_code then lastfont = start.font local c = start.components - if c then - if keepligature and keepligature(start) then - -- keep 'm + if not c then + -- fine + elseif keepligature and keepligature(start) then + -- keep 'm + else + c = do_process(c,attr) + local s = start + local p, n = s.prev, s.next + local tail = find_node_tail(c) + if p then + p.next = c + c.prev = p else - c = do_process(c,attr) - local s = start - local p, n = s.prev, s.next - local tail = find_node_tail(c) - if p then - p.next = c - c.prev = p - else - head = c - end - if n then - n.prev = tail - end - tail.next = n - start = c - s.components = nil - -- we now leak nodes ! - -- free_node(s) - done = true + head = c + end + if n then + n.prev = tail end + tail.next = n + start = c + s.components = nil + -- we now leak nodes ! + -- free_node(s) + done = true end local prev = start.prev if not prev then diff --git a/tex/context/fonts/unifraktur.lfg b/tex/context/fonts/unifraktur.lfg new file mode 100644 index 000000000..8b9b299f5 --- /dev/null +++ b/tex/context/fonts/unifraktur.lfg @@ -0,0 +1,17 @@ +return { + name = "unicode fraktur", + version = "1.00", + comment = "Goodies that complement unicode fraktur.", + author = "Hans Hagen", + copyright = "ConTeXt development team", + letterspacing = { + -- watch it: zwnj's are used (in the tounicodes too) + keptligatures = { + ["c_afii301_k.ccmp"] = true, -- ck + ["c_afii301_h.ccmp"] = true, -- ch + ["t_afii301_z.ccmp"] = true, -- tz + ["uniFB05"] = true, -- ſt + }, + } +} + diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 71b1a1e72..62f1b874c 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/01/13 11:27:38 +-- merge date : 10/01/13 19:00:22 do -- begin closure to overcome local limits and interference |