diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-09-27 20:05:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-09-27 20:05:00 +0200 |
commit | 7d5303b65f33ee0ea99f83f9a7aaa4672a405660 (patch) | |
tree | cad2e7cd1c6a7e2345b469e4f80191589ff46c40 /tex | |
parent | 0708cb2babdfd4c6f9cb86dd408992716a0e99cf (diff) | |
download | context-7d5303b65f33ee0ea99f83f9a7aaa4672a405660.tar.gz |
beta 2011.09.27 20:05
Diffstat (limited to 'tex')
37 files changed, 301 insertions, 161 deletions
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 8a588ce6a..11ed26366 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -25,6 +25,7 @@ local utfchar, utfbyte, utfsub, utfgsub = utf.char, utf.byte, utf.sub, utf.gsub local insert, remove = table.insert, table.remove local topoints = number.topoints local utfvalues = string.utfvalues +local fromunicode16 = fonts.mappings.fromunicode16 local trace_export = false trackers.register ("export.trace", function(v) trace_export = v end) local less_state = false directives.register("export.lessstate", function(v) less_state = v end) @@ -1825,10 +1826,12 @@ local function collectresults(head,list) -- is last used (we also have currentat local u = fc.tounicode if u and u ~= "" then -- tracing - for s in gmatch(u,"....") do -- is this ok? - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(tonumber(s,16)) - end +-- for s in gmatch(u,"....") do -- is this ok? +-- nofcurrentcontent = nofcurrentcontent + 1 +-- currentcontent[nofcurrentcontent] = utfchar(tonumber(s,16)) +-- end + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = utfchar(fromunicode16(u)) else nofcurrentcontent = nofcurrentcontent + 1 currentcontent[nofcurrentcontent] = utfchar(c) @@ -2188,9 +2191,6 @@ local function stopexport(v) local result = allcontent(tree) -- also does some housekeeping and data collecting -- local files = { - xhtmlfile, - -- stylefilename, - -- imagefilename, } local results = concat { wholepreamble(), @@ -2218,6 +2218,7 @@ local function stopexport(v) else xhtmlfile = file.addsuffix(xhtmlfile,"xhtml") end + files[#files+1] = xhtmlfile report_export("saving xhtml variant in '%s",xhtmlfile) local xmltree = cleanxhtmltree(xml.convert(results)) xml.save(xmltree,xhtmlfile) diff --git a/tex/context/base/bibl-bib.lua b/tex/context/base/bibl-bib.lua index d7c195576..444f7e9bc 100644 --- a/tex/context/base/bibl-bib.lua +++ b/tex/context/base/bibl-bib.lua @@ -204,12 +204,12 @@ function bibtex.toxml(session,options) local strip = options.strip -- todo: interface local entries = session.entries r = r + 1 ; result[r] = format("<?xml version='1.0' standalone='yes'?>") - result[#result+1] = format("<bibtex>") + r = r + 1 ; result[r] = format("<bibtex>") for id, categories in next, session.data do id = lower(gsub(id,"^@","")) for name, entry in next, categories do if not entries or entries[name] then - result[#result+1] = format("<entry tag='%s' category='%s'>",lower(name),id) + r = r + 1 ; result[r] = format("<entry tag='%s' category='%s'>",lower(name),id) for key, value in next, entry do value = gsub(value,"\\(.)",ihatethis) value = lpegmatch(escaped_pattern,value) diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 78cc2795c..20a06246e 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2011.09.19 23:43} +\newcontextversion{2011.09.27 20:05} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 9c2ac5258..41106bfc6 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{2011.09.19 23:43} +\newcontextversion{2011.09.27 20:05} %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/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 0a3d4b524..1347294c2 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 70f13ed78..4fe6a22e5 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 9355e5357..454c8fcae 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.09.19 23:43} +\edef\contextversion{2011.09.27 20:05} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 5aaf50cea..0a44b2efb 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2011.09.19 23:43} +\edef\contextversion{2011.09.27 20:05} %D For those who want to use this: diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua index 9028443f0..f6b415bc7 100644 --- a/tex/context/base/font-con.lua +++ b/tex/context/base/font-con.lua @@ -403,21 +403,35 @@ function constructors.scale(tfmdata,specification) local sharedkerns = { } -- for unicode, character in next, characters do - local chr, description, index + local chr, description, index, touni if changed then - -- basemode hack + -- basemode hack (we try to catch missing tounicodes, e.g. needed for ssty in math cambria) local c = changed[unicode] if c then - description = descriptions[c] or character + description = descriptions[c] or descriptions[unicode] or character character = characters[c] or character index = description.index or c + if tounicode then + touni = tounicode[index] -- nb: index! + if not touni then -- goodie + local d = descriptions[unicode] or characters[unicode] + local i = d.index or unicode + touni = tounicode[i] -- nb: index! + end + end else description = descriptions[unicode] or character index = description.index or unicode + if tounicode then + touni = tounicode[index] -- nb: index! + end end else description = descriptions[unicode] or character index = description.index or unicode + if tounicode then + touni = tounicode[index] -- nb: index! + end end local width = description.width local height = description.height @@ -460,15 +474,12 @@ function constructors.scale(tfmdata,specification) } end end + if touni then + chr.tounicode = touni + end -- if trace_scaling then -- report_defining("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-') -- end - if tounicode then - local tu = tounicode[index] -- nb: index! - if tu then - chr.tounicode = tu - end - end if hasquality then -- we could move these calculations elsewhere (saves calculations) local ve = character.expansion_factor diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua index b30462f23..7f5305f9a 100644 --- a/tex/context/base/font-map.lua +++ b/tex/context/base/font-map.lua @@ -98,6 +98,15 @@ local function tounicode16sequence(unicodes) return concat(t) end +local function fromunicode16(str) + if #str == 4 then + return tonumber(str,16) + else + local l, r = match(str,"(....)(....)") + return (tonumber(l,16)- 0xD800)*0x400 + tonumber(r,16) - 0xDC00 + end +end + --~ This is quite a bit faster but at the cost of some memory but if we --~ do this we will also use it elsewhere so let's not follow this route --~ now. I might use this method in the plain variant (no caching there) @@ -122,6 +131,7 @@ mappings.loadlumtable = loadlumtable mappings.makenameparser = makenameparser mappings.tounicode16 = tounicode16 mappings.tounicode16sequence = tounicode16sequence +mappings.fromunicode16 = fromunicode16 local separator = S("_.") local other = C((1 - separator)^1) @@ -177,7 +187,9 @@ function mappings.addtounicode(data,filename) if unic == -1 or unic >= private or (unic >= 0xE000 and unic <= 0xF8FF) or unic == 0xFFFE or unic == 0xFFFF then local unicode = lumunic and lumunic[name] or unicodevector[name] if unicode then - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + originals[index] = unicode + tounicode[index] = tounicode16(unicode) + ns = ns + 1 end -- cidmap heuristics, beware, there is no guarantee for a match unless -- the chain resolves @@ -186,7 +198,9 @@ function mappings.addtounicode(data,filename) if foundindex then unicode = cidcodes[foundindex] -- name to number if unicode then - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + originals[index] = unicode + tounicode[index] = tounicode16(unicode) + ns = ns + 1 else local reference = cidnames[foundindex] -- number to name if reference then @@ -194,16 +208,23 @@ function mappings.addtounicode(data,filename) if foundindex then unicode = cidcodes[foundindex] if unicode then - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + originals[index] = unicode + tounicode[index] = tounicode16(unicode) + ns = ns + 1 end end if not unicode then local foundcodes, multiple = lpegmatch(uparser,reference) if foundcodes then + originals[index] = foundcodes if multiple then - originals[index], tounicode[index], nl, unicode = foundcodes, tounicode16sequence(foundcodes), nl + 1, true + tounicode[index] = tounicode16sequence(foundcodes) + nl = nl + 1 + unicode = true else - originals[index], tounicode[index], ns, unicode = foundcodes, tounicode16(foundcodes), ns + 1, foundcodes + tounicode[index] = tounicode16(foundcodes) + ns = ns + 1 + unicode = foundcodes end end end @@ -214,19 +235,8 @@ function mappings.addtounicode(data,filename) -- a.whatever or a_b_c.whatever or a_b_c (no numbers) if not unicode then local split = lpegmatch(ligsplitter,name) - local nplit = (split and #split) or 0 - if nplit == 0 then - -- skip - elseif nplit == 1 then - local base = split[1] - unicode = unicodes[base] or unicodevector[base] - if unicode then - if type(unicode) == "table" then - unicode = unicode[1] - end - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 - end - else + local nplit = split and #split or 0 + if nplit >= 2 then local t, n = { }, 0 for l=1,nplit do local base = split[l] @@ -244,25 +254,38 @@ function mappings.addtounicode(data,filename) if n == 0 then -- done then -- nothing elseif n == 1 then - originals[index], tounicode[index], nl, unicode = t[1], tounicode16(t[1]), nl + 1, true + originals[index] = t[1] + tounicode[index] = tounicode16(t[1]) else - originals[index], tounicode[index], nl, unicode = t, tounicode16sequence(t), nl + 1, true + originals[index] = t + tounicode[index] = tounicode16sequence(t) end + nl = nl + 1 + unicode = true + else + -- skip: already checked and we don't want privates here end end - -- last resort + -- last resort (we might need to catch private here as well) if not unicode then local foundcodes, multiple = lpegmatch(uparser,name) if foundcodes then if multiple then - originals[index], tounicode[index], nl, unicode = foundcodes, tounicode16sequence(foundcodes), nl + 1, true + originals[index] = foundcodes + tounicode[index] = tounicode16sequence(foundcodes) + nl = nl + 1 + unicode = true else - originals[index], tounicode[index], ns, unicode = foundcodes, tounicode16(foundcodes), ns + 1, foundcodes + originals[index] = foundcodes + tounicode[index] = tounicode16(foundcodes) + ns = ns + 1 + unicode = foundcodes end end end -- if not unicode then - -- originals[index], tounicode[index] = 0xFFFD, "FFFD" + -- originals[index] = 0xFFFD + -- tounicode[index] = "FFFD" -- end end end diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua index 6295ecb7d..246171aec 100644 --- a/tex/context/base/l-unicode.lua +++ b/tex/context/base/l-unicode.lua @@ -218,7 +218,7 @@ local function utf16_to_utf8_be(t) if right then local now = 256*left + right if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong more = 0 r = r + 1 result[r] = utfchar(now) @@ -246,7 +246,7 @@ local function utf16_to_utf8_le(t) if right then local now = 256*right + left if more > 0 then - now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 + now = (more-0xD800)*0x400 + (now-0xDC00) + 0x10000 -- the 0x10000 smells wrong more = 0 r = r + 1 result[r] = utfchar(now) diff --git a/tex/context/base/math-tag.lua b/tex/context/base/math-tag.lua index 49138ac3b..0ac5b0897 100644 --- a/tex/context/base/math-tag.lua +++ b/tex/context/base/math-tag.lua @@ -87,6 +87,8 @@ end -- todo: check function here and keep attribute the same +-- todo: variants -> original + local actionstack = { } process = function(start) -- we cannot use the processor as we have no finalizers (yet) @@ -117,6 +119,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer else tag = "mo" end +-- print(start,a,tag) set_attribute(start,a_tagged,start_tagged(tag,a)) stop_tagged() break -- okay? diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index 9aa2f400a..31c13cf8c 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -653,11 +653,12 @@ function vfmath.define(specification,set,goodies) ref = { { 'slot', s, index } } si[index] = ref end + local italic = fci.italic local t = { - width = fci.width, + width = fci.width + italic, -- watch this ! height = fci.height, depth = fci.depth, - italic = fci.italic, + italic = italic, commands = ref, } local n = fci.next diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index f76a03727..7ff3420d9 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -586,13 +586,13 @@ \recalculatelayout} \def\checkcurrentoddlayout - {\ifcsname\??ly\v!odd\c!state\endcsname - \doifvalue{\??ly\v!odd\c!state}\v!start{\changetolayout\v!odd}% + {\ifcsname\namedlayouthash\v!odd\c!state\endcsname + \doif{\namedlayoutparameter\v!odd\c!state}\v!start{\changetolayout\v!odd}% \fi} \def\checkcurrentevenlayout - {\ifcsname\??ly\v!even\c!state\endcsname - \doifvalue{\??ly\v!even\c!state}\v!start{\changetolayout\v!even}% + {\ifcsname\namedlayouthash\v!even\c!state\endcsname + \doif{\namedlayoutparameter\v!even\c!state}\v!start{\changetolayout\v!even}% \fi} \ifx\lastpage\undefined @@ -613,11 +613,11 @@ \fi} \def\checkcurrentlayout % public and used in naw, so keep this name - {\ifcsname\??ly\realfolio\c!state\endcsname - \doifvalue{\??ly\realfolio\c!state}\v!start{\changetolayout\realfolio}% - \else\ifcsname\??ly\reverserealfolio\c!state\endcsname - \doifvalue{\??ly\reverserealfolio\c!state}\v!start{\changetolayout\reverserealfolio}% - \else\ifcsname\??ly\v!current\c!state\endcsname + {\ifcsname\namedlayouthash\realfolio\c!state\endcsname + \doif{\namedlayoutparameter\realfolio\c!state}\v!start{\changetolayout\realfolio}% + \else\ifcsname\namedlayouthash\reverserealfolio\c!state\endcsname + \doif{\namedlayoutparameter\reverserealfolio\c!state}\v!start{\changetolayout\reverserealfolio}% + \else\ifcsname\namedlayouthash\v!current\c!state\endcsname \changetolayout\v!current % no start test ? \else \doifoddpageelse\checkcurrentoddlayout\checkcurrentevenlayout diff --git a/tex/context/base/page-set.mkiv b/tex/context/base/page-set.mkiv index 7ef196d53..0c3dfff30 100644 --- a/tex/context/base/page-set.mkiv +++ b/tex/context/base/page-set.mkiv @@ -2480,7 +2480,7 @@ \setcolumnsetspanhsize\mofcolumns\!!countc % a/b used \hsize\columnsetspanhsize \setbox\scratchbox\vbox\bgroup - \dostartframedtext[cs:#1][\v!none]% geen nils placement + \dostartframedtext{cs:#1}[\v!none]% geen nils placement % spoils spacing : \vskip-\struttotal\par\verticalstrut\par \ifnum\columnsetlevel>\zerocount \namedframedtextparameter{cs:#1}\c!before diff --git a/tex/context/base/s-pre-61.tex b/tex/context/base/s-pre-61.tex index d4e06d0a7..21e461320 100644 --- a/tex/context/base/s-pre-61.tex +++ b/tex/context/base/s-pre-61.tex @@ -234,6 +234,7 @@ \StartSteps \startitemize +\item Fiona Apple \FlushStep \item Tori Amos \FlushStep \item Kate Bush \FlushStep \item Heather Nova \FlushStep diff --git a/tex/context/base/s-pre-70.mkiv b/tex/context/base/s-pre-70.mkiv index 9f76fc84a..2c8bb2d26 100644 --- a/tex/context/base/s-pre-70.mkiv +++ b/tex/context/base/s-pre-70.mkiv @@ -119,16 +119,16 @@ [state=start] \startinteractionmenu[bottom] - \txt + \starttxt \interactionbar [alternative=d, symbol=yes, color=white, contrastcolor=textcolor] - \\ + \stoptxt \hfilll - \but [previouspage] < < < \\ - \but [nextpage] > > > \\ + \startbut [previouspage] < < < \stopbut + \startbut [nextpage] > > > \stopbut \stopinteractionmenu %D Instead of the normal symbols we use more punky ones. @@ -150,7 +150,7 @@ %D Run this file with the command: \type {context --mode=demo s-pre-70} %D in order to get an example. -\doifnotmode{demo} {\endinput} +\continueifinputfile{s-pre-70.mkiv} \usemodule[pre-60] % use the stepper @@ -159,14 +159,18 @@ \title {Punk for dummies} \dorecurse{10} { + \title{Just a few dummy pages} - \StartSteps \startitemize[packed] - \startitemize - \startitem bla \FlushStep \stopitem - \startitem bla bla \FlushStep \stopitem - \startitem bla bla bla \FlushStep \stopitem - \startitem bla bla bla bla \FlushStep \stopitem - \stopitemize \StopSteps + + \StartSteps + \startitemize[packed] + \startitem bla \FlushStep \stopitem + \startitem bla bla \FlushStep \stopitem + \startitem bla bla bla \FlushStep \stopitem + \startitem bla bla bla bla \FlushStep \stopitem + \stopitemize + \StopSteps + } \stoptext diff --git a/tex/context/base/s-pre-71.mkiv b/tex/context/base/s-pre-71.mkiv index a52718576..38dae61df 100644 --- a/tex/context/base/s-pre-71.mkiv +++ b/tex/context/base/s-pre-71.mkiv @@ -145,7 +145,7 @@ \let\StartText\starttext \let\StopText \stoptext -\doifnotmode{demo}{\endinput} +\continueifinputfile{s-pre-71.mkiv} \starttext diff --git a/tex/context/base/scrn-but.mkvi b/tex/context/base/scrn-but.mkvi index 7370d944f..693996d8a 100644 --- a/tex/context/base/scrn-but.mkvi +++ b/tex/context/base/scrn-but.mkvi @@ -739,7 +739,7 @@ \unexpanded\def\scrn_menu_but#content\\{\scrn_menu_but_start#content\stopbut} \let\stopbut\relax \unexpanded\def\scrn_menu_got#content\\{\scrn_menu_got_start#content\stopgot} \let\stopgot\relax \unexpanded\def\scrn_menu_nop#content\\{\scrn_menu_nop_start#content\stopnop} \let\stopnop\relax -\unexpanded\def\scrn_menu_txt#content\\{\scrn_menu_nop_start#content\stoptxt} \let\stoptxt\relax +\unexpanded\def\scrn_menu_txt#content\\{\scrn_menu_txt_start#content\stoptxt} \let\stoptxt\relax \unexpanded\def\scrn_menu_rul#content\\{\scrn_menu_rul_start#content\stoprul} \let\stoprul\relax \unexpanded\def\scrn_menu_com#content\\{\scrn_menu_com_start#content\stopcom} \let\stopcom\relax diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index d9a6bb64d..8640ba825 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -96,10 +96,11 @@ local validmethods = table.tohash { } local predefinedmethods = { - [v_before] = "mm,mc,uc", - [v_after] = "pm,mc,uc", - [v_first] = "pc,mm,uc", - [v_last] = "mc,mm,uc", + [v_default] = "zc,pc,zm,pm,uc", + [v_before] = "mm,mc,uc", + [v_after] = "pm,mc,uc", + [v_first] = "pc,mm,uc", + [v_last] = "mc,mm,uc", } sorters = { @@ -113,7 +114,7 @@ sorters = { digitsoffset = digitsoffset, digitsmaximum = digitsmaximum, defaultlanguage = v_default, - defaultmethod = v_before, + defaultmethod = v_default, defaultdigits = v_numbers, } } diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index 686bcfb83..ffc1f2434 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -244,6 +244,10 @@ \let\raggedtopcommand \vfilll % used with \framed for \fi} % instance in tables +\setvalue{\@@ragged@@command\v!last}% + {\appendtoks\centeredlastline\to\everyraggedcommand + \!!donecfalse} + \setvalue{\@@ragged@@command\v!flushleft }{\getvalue{\@@ragged@@command\v!right }} \setvalue{\@@ragged@@command\v!flushright}{\getvalue{\@@ragged@@command\v!left }} \setvalue{\@@ragged@@command\v!center }{\getvalue{\@@ragged@@command\v!middle}} @@ -358,8 +362,8 @@ \let\updateraggedskips\relax -\def\setraggedskips#1#2#3#4#5#6#7% never change this name - {\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% +\unexpanded\def\setraggedskips#1#2#3#4#5#6#7% never change this name + {\unexpanded\def\updateraggedskips{\dosetraggedskips{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% \updateraggedskips} \def\dosetraggedskips#1#2#3#4#5#6#7% @@ -419,10 +423,12 @@ % defaults -\def\raggedfillamount {1fil} -\def\raggedhalffillamount{.5fil} -\def\raggedspaceamount {\interwordspace} % {.3333em} -\def\raggedxspaceamount {.5em} +\def\raggedfillamount {1fil} +\def\raggednegativefillamount{-1fil} +\def\raggeddoublefillamount {2fil} +\def\raggedhalffillamount {.5fil} +\def\raggedspaceamount {\interwordspace} % {.3333em} +\def\raggedxspaceamount {.5em} \unexpanded\def\notragged {\raggedstatus\zerocount @@ -445,6 +451,16 @@ \setraggedskips2\middleraggedness\middleraggedness\raggedspaceamount \raggedxspaceamount\zeropoint\zeropoint} +\unexpanded\def\centeredlastline + {\setraggedskips + \zerocount + \raggedfillamount + \raggednegativefillamount + \zeropoint + \zeropoint + \raggeddoublefillamount + \zeropoint} + %D We used to have: %D %D \starttyping @@ -561,6 +577,8 @@ \installalign {l2r} {\lefttoright} \installalign {r2l} {\righttoleft} +\installalign \v!last {\centeredlastline} + \newcount\hyphenminoffset \ifx\sethyphenationvariables\undefined \let\sethyphenationvariables\relax \fi diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex a72d471d4..c8c6b27a5 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 27829fd27..e4e11892c 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua index fff357574..7532ac63f 100644 --- a/tex/context/base/strc-doc.lua +++ b/tex/context/base/strc-doc.lua @@ -595,6 +595,9 @@ function sections.typesetnumber(entry,kind,...) -- kind='section','number','pref local firstprefix, lastprefix = 0, 16 if segments then local f, l = match(tostring(segments),"^(.-):(.+)$") + if l == "*" then + l = 100 -- new + end if f and l then -- 0:100, chapter:subsubsection firstprefix = tonumber(f) or sections.getlevel(f) or 0 diff --git a/tex/context/base/strc-flt.mkiv b/tex/context/base/strc-flt.mkiv index 3a6aea0ab..219ff812a 100644 --- a/tex/context/base/strc-flt.mkiv +++ b/tex/context/base/strc-flt.mkiv @@ -912,7 +912,7 @@ \flushsidefloats % hoort eigenlijk niet hier \docomplexplacefloat[#1][\v!text,#2,\v!left][#3]} -\def\docomplexreserveblock#1#2% +\def\dodocomplexreserveblock#1#2% {\begingroup \edef\currentfloat{#1}% \let\currentfloatcaption\currentfloat @@ -921,7 +921,7 @@ \endgroup} \long\def\docomplexreserveblock[#1][#2][#3][#4]#5% - {\getvalue{\e!place#1}[#3][#4]{#5}{\docomplexreserveblock{#1}{#2}{#1}}} + {\getvalue{\e!place#1}[#3][#4]{#5}{\dodocomplexreserveblock{#1}{#2}}} \def\docomplexstartreservetextblock[#1][#2][#3][#4]% {\flushsidefloats % hoort eigenlijk niet hier diff --git a/tex/context/base/strc-reg.mkiv b/tex/context/base/strc-reg.mkiv index 0467eac96..4871b40ce 100644 --- a/tex/context/base/strc-reg.mkiv +++ b/tex/context/base/strc-reg.mkiv @@ -706,9 +706,9 @@ \def\withregisterpagecommand#1#2#3#4% {\def\currentregisterpageindex{#2}% \iflocation - \goto{\registerparameter\c!pagecommand{#4}}[internal(#2)]% + \goto{\applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}}[internal(#2)]% \else - \registerparameter\c!pagecommand{#4}% + \applyprocessor{#1}{\registerparameter\c!pagecommand{#4}}% \fi} \def\registeronepage#1#2#3#4% #1:processor content diff --git a/tex/context/base/strc-ren.mkiv b/tex/context/base/strc-ren.mkiv index 0d82b7f6f..11a2ee2b3 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -25,12 +25,6 @@ \newevery \everyheadstart \relax -% \unexpanded\def\placeheadmargintexts -% {\the\everyheadstart -% \doif{\headparameter\c!margintext}\v!yes\placemargincontent} - -\let\placeheadmargintexts\relax - \unexpanded\def\setupheadcomponentfont#1#2% {\dontconvertfont \ifconditional\headisdisplay @@ -77,9 +71,8 @@ {\begingroup \setupheadcomponentfont\c!textstyle\c!textcolor \headparameter\c!commandbefore - \placeheadmargintexts - \ifcsname\??nh\currenthead\c!deeptextcommand\endcsname - \expandafter\let\expandafter\deepstructuretitlecommand\csname\??nh\currenthead\c!deeptextcommand\endcsname + \ifcsname\currentheadhash\c!deeptextcommand\endcsname + \expandafter\let\expandafter\deepstructuretitlecommand\csname\currentheadhash\c!deeptextcommand\endcsname \fi \ifconditional\headisdisplay % \ifdisplaysectionhead % struts can be nilled with \setnostrut @@ -100,9 +93,8 @@ \def\doplaceheadnumbercomponent#1% {\begingroup \setupheadcomponentfont\c!numberstyle\c!numbercolor - \placeheadmargintexts - \ifcsname\??nh\currenthead\c!deepnumbercommand\endcsname - \expandafter\let\expandafter\deepstructurenumbercommand\csname\??nh\currenthead\c!deepnumbercommand\endcsname + \ifcsname\currentheadhash\c!deepnumbercommand\endcsname + \expandafter\let\expandafter\deepstructurenumbercommand\csname\currentheadhash\c!deepnumbercommand\endcsname \fi \ifconditional\headisdisplay % \ifdisplaysectionhead % can be nilled with \setnostrut @@ -149,7 +141,7 @@ % maybe auto: backreference when given, else list \fi\fi} -\unexpanded\def\placeheadtext +\unexpanded\def\placecurrentheadtext {\beginheadplacement \setheadmarking \doresettructureheadnumbercontent @@ -161,13 +153,13 @@ \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes {\dosetlocalgridsnapping{\headparameter\c!internalgrid}% \doresettructureheadnumbercontent - \dosetfontattribute{\??nh\currenthead}\c!style % but we don't want color to influence user command, todo: get the if-else out of it + \dosetheadfontattribute\c!style \setinlineheadreferenceattributes \headparameter\c!command{}{\doplaceheadtextcomponent\getheadtitle}}% \fi \endheadplacement{\getheadsyncs}} -\unexpanded\def\placeheadnumbertext +\unexpanded\def\placecurrentheadnumbertext {\beginheadplacement \setheadmarking \doiftextelse{\getheadnumber}\dosettructureheadnumbercontent\doresettructureheadnumbercontent @@ -178,13 +170,13 @@ \docheckheadreference \setbox\sectionheadbox\ifvertical\vbox\else\hbox\fi \headreferenceattributes {\dosetlocalgridsnapping{\headparameter\c!internalgrid}% - \dosetfontattribute{\??nh\currenthead}\c!style + \dosetheadfontattribute\c!style \setinlineheadreferenceattributes \headparameter\c!command{\doplaceheadnumbercomponent\getheadnumber}{\doplaceheadtextcomponent\getheadtitle}}% \fi \endheadplacement{\getheadsyncs}} -\unexpanded\def\placeheadempty +\unexpanded\def\placecurrentheadempty {\hbox \headreferenceattributes {\getheadsyncs}} %D \starttyping @@ -461,7 +453,7 @@ \fi #2}} -\unexpanded\def\placeheadmargin#1#2% +\unexpanded\def\placeheadmarginalternative#1#2% {\vbox {\localheadsetup \begstrut % use one \strut here! @@ -473,8 +465,8 @@ \fi {#2}}} -\defineheadplacement[\v!inmargin][\v!vertical]#1#2{\placeheadmargin{#1}{#2}} -\defineheadplacement[\v!margin] [\v!vertical]#1#2{\placeheadmargin{#1}{#2}} +\defineheadplacement[\v!inmargin][\v!vertical]#1#2{\placeheadmarginalternative{#1}{#2}} +\defineheadplacement[\v!margin] [\v!vertical]#1#2{\placeheadmarginalternative{#1}{#2}} \defineheadplacement[\v!middle][\v!vertical]#1#2% {\vbox @@ -496,7 +488,7 @@ {\begstrut#2}% \egroup} -\unexpanded\def\placeheadlohi#1#2#3% +\unexpanded\def\placeheadlohialternative#1#2#3% {\ifconditional\headshownumber \setbox0\hbox{#2} \setbox2=#1{\localheadsetup\advance\hsize-\wd0\relax#3}% @@ -508,8 +500,8 @@ % onder/boven lijnt het nummer op de onderste/bovenste regel % uit van een meerregelige kop -\defineheadplacement[\v!bottom][\v!vertical]#1#2{\placeheadlohi\vbox{#1}{#2}} -\defineheadplacement[\v!top] [\v!vertical]#1#2{\placeheadlohi\vtop{#1}{#2}} +\defineheadplacement[\v!bottom][\v!vertical]#1#2{\placeheadlohialternative\vbox{#1}{#2}} +\defineheadplacement[\v!top] [\v!vertical]#1#2{\placeheadlohialternative\vtop{#1}{#2}} % helpers diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index a2f011941..d2836d6eb 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -426,8 +426,8 @@ [#3]% \reportcurrentstructure} -\unexpanded\def\placeheadtext {\dosingleempty\doplaceheadtext } % use with care -\unexpanded\def\placeheadnumber{\dosingleempty\doplaceheadnumber} % use with care +\unexpanded\def\placeheadtext {\dosingleempty\place_head_text } % use with care +\unexpanded\def\placeheadnumber{\dosingleempty\place_head_number} % use with care \ifdefined\setupheadcomponentfont \else @@ -439,7 +439,7 @@ \fi -\def\doplaceheadtext[#1]% +\def\place_head_text[#1]% {\dontleavehmode \begingroup \edef\currenthead{#1}% @@ -449,7 +449,7 @@ \endgraf \endgroup} -\def\doplaceheadnumber[#1]% +\def\place_head_number[#1]% {\dontleavehmode \begingroup \edef\currenthead{#1}% @@ -504,20 +504,20 @@ \let\getheadtitle\fullheadtitle \ifconditional\headshownumber \let\getheadnumber\fullheadnumber - \placeheadnumbertext + \placecurrentheadnumbertext \else - \placeheadtext + \placecurrentheadtext \fi \doheadspacingafteryes \else\ifconditional\headhidden \doregisterhead\currenthead{#2}{#3}% after optional \page \let\getheadsyncs\theheadsynchonization - \placeheadhidden % only something when tracing + \placecurrentheadhidden % only something when tracing \else \doheadspacingbeforenop % toegevoegd ivm subpaginanr / tug sheets \doregisterhead\currenthead{#2}{#3}% after optional \page \let\getheadsyncs\theheadsynchonization - \placeheadempty % just flush 'm + \placecurrentheadempty % just flush 'm \doheadspacingafternop \fi\fi \else @@ -526,18 +526,18 @@ \doregisterhead\currenthead{#2}{#3}% after optional \page \let\getheadsyncs\theheadsynchonization \let\getheadtitle\fullheadtitle - \placeheadtext + \placecurrentheadtext \doheadspacingafteryes \else\ifconditional\headhidden \doregisterhead\currenthead{#2}{#3}% after optional \page \let\getheadsyncs\theheadsynchonization - \placeheadhidden % only something when tracing + \placecurrentheadhidden % only something when tracing \else % do nothing / should be vbox to 0pt \doheadspacingbeforenop \doregisterhead\currenthead{#2}{#3}% after optional \page \let\getheadsyncs\theheadsynchonization - \placeheadempty % just flush 'm + \placecurrentheadempty % just flush 'm \doheadspacingafternop \fi\fi \fi @@ -553,21 +553,21 @@ % typesetting -\unexpanded\def\placeheadnumbertext % dummy, will be overloaded +\unexpanded\def\placecurrentheadnumbertext {\setheadmarking \getheadnumber/\getheadtitle \getheadsyncs} -\unexpanded\def\placeheadtext % dummy, will be overloaded +\unexpanded\def\placecurrentheadtext {\setheadmarking \getheadtitle \getheadsyncs} -\unexpanded\def\placeheadempty % dummy, will be overloaded +\unexpanded\def\placecurrentheadempty {\setheadmarking \getheadsyncs} -\unexpanded\def\placeheadhidden +\unexpanded\def\placecurrentheadhidden {\setxvalue{\currenthead:sync}% {\noexpand\setgvalue{\currenthead:sync}{}% \noexpand\pagetype[\currentheadcoupling]% hm also number diff --git a/tex/context/interface/cont-cs.xml b/tex/context/interface/cont-cs.xml index 03e68bbc5..7af35cd94 100644 --- a/tex/context/interface/cont-cs.xml +++ b/tex/context/interface/cont-cs.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="cs" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="uvnitr"/> <cd:constant type="vnejsi"/> @@ -25,6 +27,10 @@ <cd:constant type="normalni"/> <cd:constant type="ne"/> <cd:constant type="ano"/> + <cd:constant type="siroky"/> + <cd:constant type="posledni"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index 659fdf3f0..7d164e861 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="de" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="innen"/> <cd:constant type="aussen"/> @@ -25,6 +27,10 @@ <cd:constant type="normal"/> <cd:constant type="nein"/> <cd:constant type="ja"/> + <cd:constant type="breit"/> + <cd:constant type="letzte"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index 46568857a..8cc1bac6c 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="en" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="inner"/> <cd:constant type="outer"/> @@ -25,6 +27,10 @@ <cd:constant type="normal"/> <cd:constant type="no"/> <cd:constant type="yes"/> + <cd:constant type="broad"/> + <cd:constant type="last"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index 081ea1802..7b109fd68 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="fr" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="interieur"/> <cd:constant type="exterieur"/> @@ -25,6 +27,10 @@ <cd:constant type="normal"/> <cd:constant type="non"/> <cd:constant type="oui"/> + <cd:constant type="large"/> + <cd:constant type="dernier"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index b739b60cb..e8574d2f6 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="it" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="interno"/> <cd:constant type="esterno"/> @@ -25,6 +27,10 @@ <cd:constant type="normale"/> <cd:constant type="no"/> <cd:constant type="si"/> + <cd:constant type="ampio"/> + <cd:constant type="ultimo"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index b3036a5a9..cb585d771 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="nl" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="binnen"/> <cd:constant type="buiten"/> @@ -25,6 +27,10 @@ <cd:constant type="normaal"/> <cd:constant type="nee"/> <cd:constant type="ja"/> + <cd:constant type="ruim"/> + <cd:constant type="laatste"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/context/interface/cont-pe.xml b/tex/context/interface/cont-pe.xml index 956087029..e271cb846 100644 --- a/tex/context/interface/cont-pe.xml +++ b/tex/context/interface/cont-pe.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="pe" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="داخلی"/> <cd:constant type="خارجی"/> @@ -25,6 +27,10 @@ <cd:constant type="نرمال"/> <cd:constant type="نه"/> <cd:constant type="بله"/> + <cd:constant type="گسترده"/> + <cd:constant type="آخرین"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index d91aa40f1..dc198d252 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -13,6 +13,8 @@ <cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context test" language="ro" version="2006.08.02"> + <!-- there are some more --> + <cd:define name="align"> <cd:constant type="intern"/> <cd:constant type="extern"/> @@ -25,6 +27,10 @@ <cd:constant type="normal"/> <cd:constant type="nu"/> <cd:constant type="da"/> + <cd:constant type="broad"/> + <cd:constant type="ultim"/> + <cd:constant type="r2l"/> + <cd:constant type="l2r"/> </cd:define> <cd:define name="symalign"> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 28ac0347a..b60a0b79b 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 : 09/19/11 23:43:44 +-- merge date : 09/27/11 20:05:02 do -- begin closure to overcome local limits and interference @@ -3520,21 +3520,35 @@ function constructors.scale(tfmdata,specification) local sharedkerns = { } -- for unicode, character in next, characters do - local chr, description, index + local chr, description, index, touni if changed then - -- basemode hack + -- basemode hack (we try to catch missing tounicodes, e.g. needed for ssty in math cambria) local c = changed[unicode] if c then - description = descriptions[c] or character + description = descriptions[c] or descriptions[unicode] or character character = characters[c] or character index = description.index or c + if tounicode then + touni = tounicode[index] -- nb: index! + if not touni then -- goodie + local d = descriptions[unicode] or characters[unicode] + local i = d.index or unicode + touni = tounicode[i] -- nb: index! + end + end else description = descriptions[unicode] or character index = description.index or unicode + if tounicode then + touni = tounicode[index] -- nb: index! + end end else description = descriptions[unicode] or character index = description.index or unicode + if tounicode then + touni = tounicode[index] -- nb: index! + end end local width = description.width local height = description.height @@ -3577,15 +3591,12 @@ function constructors.scale(tfmdata,specification) } end end + if touni then + chr.tounicode = touni + end -- if trace_scaling then -- report_defining("t=%s, u=%s, i=%s, n=%s c=%s",k,chr.tounicode or "",index or 0,description.name or '-',description.class or '-') -- end - if tounicode then - local tu = tounicode[index] -- nb: index! - if tu then - chr.tounicode = tu - end - end if hasquality then -- we could move these calculations elsewhere (saves calculations) local ve = character.expansion_factor @@ -4569,6 +4580,15 @@ local function tounicode16sequence(unicodes) return concat(t) end +local function fromunicode16(str) + if #str == 4 then + return tonumber(str,16) + else + local l, r = match(str,"(....)(....)") + return (tonumber(l,16)- 0xD800)*0x400 + tonumber(r,16) - 0xDC00 + end +end + --~ This is quite a bit faster but at the cost of some memory but if we --~ do this we will also use it elsewhere so let's not follow this route --~ now. I might use this method in the plain variant (no caching there) @@ -4593,6 +4613,7 @@ mappings.loadlumtable = loadlumtable mappings.makenameparser = makenameparser mappings.tounicode16 = tounicode16 mappings.tounicode16sequence = tounicode16sequence +mappings.fromunicode16 = fromunicode16 local separator = S("_.") local other = C((1 - separator)^1) @@ -4648,7 +4669,9 @@ function mappings.addtounicode(data,filename) if unic == -1 or unic >= private or (unic >= 0xE000 and unic <= 0xF8FF) or unic == 0xFFFE or unic == 0xFFFF then local unicode = lumunic and lumunic[name] or unicodevector[name] if unicode then - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + originals[index] = unicode + tounicode[index] = tounicode16(unicode) + ns = ns + 1 end -- cidmap heuristics, beware, there is no guarantee for a match unless -- the chain resolves @@ -4657,7 +4680,9 @@ function mappings.addtounicode(data,filename) if foundindex then unicode = cidcodes[foundindex] -- name to number if unicode then - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + originals[index] = unicode + tounicode[index] = tounicode16(unicode) + ns = ns + 1 else local reference = cidnames[foundindex] -- number to name if reference then @@ -4665,16 +4690,23 @@ function mappings.addtounicode(data,filename) if foundindex then unicode = cidcodes[foundindex] if unicode then - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 + originals[index] = unicode + tounicode[index] = tounicode16(unicode) + ns = ns + 1 end end if not unicode then local foundcodes, multiple = lpegmatch(uparser,reference) if foundcodes then + originals[index] = foundcodes if multiple then - originals[index], tounicode[index], nl, unicode = foundcodes, tounicode16sequence(foundcodes), nl + 1, true + tounicode[index] = tounicode16sequence(foundcodes) + nl = nl + 1 + unicode = true else - originals[index], tounicode[index], ns, unicode = foundcodes, tounicode16(foundcodes), ns + 1, foundcodes + tounicode[index] = tounicode16(foundcodes) + ns = ns + 1 + unicode = foundcodes end end end @@ -4685,19 +4717,8 @@ function mappings.addtounicode(data,filename) -- a.whatever or a_b_c.whatever or a_b_c (no numbers) if not unicode then local split = lpegmatch(ligsplitter,name) - local nplit = (split and #split) or 0 - if nplit == 0 then - -- skip - elseif nplit == 1 then - local base = split[1] - unicode = unicodes[base] or unicodevector[base] - if unicode then - if type(unicode) == "table" then - unicode = unicode[1] - end - originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 - end - else + local nplit = split and #split or 0 + if nplit >= 2 then local t, n = { }, 0 for l=1,nplit do local base = split[l] @@ -4715,25 +4736,38 @@ function mappings.addtounicode(data,filename) if n == 0 then -- done then -- nothing elseif n == 1 then - originals[index], tounicode[index], nl, unicode = t[1], tounicode16(t[1]), nl + 1, true + originals[index] = t[1] + tounicode[index] = tounicode16(t[1]) else - originals[index], tounicode[index], nl, unicode = t, tounicode16sequence(t), nl + 1, true + originals[index] = t + tounicode[index] = tounicode16sequence(t) end + nl = nl + 1 + unicode = true + else + -- skip: already checked and we don't want privates here end end - -- last resort + -- last resort (we might need to catch private here as well) if not unicode then local foundcodes, multiple = lpegmatch(uparser,name) if foundcodes then if multiple then - originals[index], tounicode[index], nl, unicode = foundcodes, tounicode16sequence(foundcodes), nl + 1, true + originals[index] = foundcodes + tounicode[index] = tounicode16sequence(foundcodes) + nl = nl + 1 + unicode = true else - originals[index], tounicode[index], ns, unicode = foundcodes, tounicode16(foundcodes), ns + 1, foundcodes + originals[index] = foundcodes + tounicode[index] = tounicode16(foundcodes) + ns = ns + 1 + unicode = foundcodes end end end -- if not unicode then - -- originals[index], tounicode[index] = 0xFFFD, "FFFD" + -- originals[index] = 0xFFFD + -- tounicode[index] = "FFFD" -- end end end |