From ae6e6d9d13c2d7f452fdf2253ed1ab3002e15777 Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 9 May 2011 17:40:16 +0300 Subject: beta 2011.05.09 16:28 --- scripts/context/lua/mtx-epub.lua | 149 +++++++++++++++ scripts/context/lua/mtx-flac.lua | 4 +- tex/context/base/back-exp.lua | 31 +++- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/font-enh.lua | 16 ++ tex/context/base/lang-def.mkiv | 278 ++++++++++++++-------------- tex/context/base/lang-ini.lua | 7 +- tex/context/base/lang-txt.lua | 84 ++++----- tex/context/base/math-vfu.lua | 6 +- tex/context/base/scrp-cjk.lua | 102 +++++----- tex/context/base/scrp-eth.lua | 151 +++++++++++++++ tex/context/base/scrp-ini.lua | 41 ++-- tex/context/base/scrp-ini.mkiv | 11 +- tex/context/base/status-files.pdf | Bin 23543 -> 23535 bytes tex/context/base/status-lua.pdf | Bin 154301 -> 154284 bytes tex/context/fonts/dingbats.lfg | 1 + tex/context/fonts/lucida-math.lfg | 2 + tex/generic/context/luatex-fonts-merged.lua | 2 +- 21 files changed, 620 insertions(+), 273 deletions(-) create mode 100644 scripts/context/lua/mtx-epub.lua create mode 100644 tex/context/base/scrp-eth.lua diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua new file mode 100644 index 000000000..5239028ba --- /dev/null +++ b/scripts/context/lua/mtx-epub.lua @@ -0,0 +1,149 @@ +if not modules then modules = { } end modules ['mtx-epub'] = { + version = 1.001, + comment = "companion to mtxrun.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format = string.format +local concat = table.concat + +local helpinfo = [[ +--make create epub zip file + +example: + +mtxrun --script epub --make mydocument +]] + +local application = logs.application { + name = "mtx-epub", + banner = "ConTeXt EPUB Helpers 0.10", + helpinfo = helpinfo, +} + +-- script code + +scripts = scripts or { } +scripts.epub = scripts.epub or { } + +local mimetype = "application/epub+zip" + +local container = [[ + + + + + + + +]] + +local package = [[ + + + + + + My Title + en + + MySelf + + + + %s + + + + + + + +]] + +local mimetypes = { + xhtml = "application/xhtml+xml", + css = "text/css", +} + +-- specification = { +-- name = "document", +-- identifier = "123", +-- root = "a.xhtml", +-- files = { +-- "a.xhtml", +-- "b.css", +-- "c.png", +-- } +-- } + +function scripts.epub.make() + + local filename = environment.files[1] + + if filename and filename ~= "" then + + filename = file.basename(filename) + local specfile = file.replacesuffix(filename,"specification") + local specification = lfs.isfile(specfile) and dofile(specfile) or { } + + inspect(specification) + + local name = specification.name or file.removesuffix(filename) + local identifier = specification.identifier or os.uuid() + local files = specification.files or { file.addsuffix(filename,"xhtml") } + local root = specification.root or files[1] + + local epubname = name + local epubpath = file.replacesuffix(name,"tree") + local epubfile = file.replacesuffix(name,"epub") + local epubroot = file.replacesuffix(name,"opf") + + local used = { } + + for i=1,#files do + local filename = files[i] + local suffix = file.suffix(filename) + local mime = mimetypes[suffix] + if mime then + file.copy(filename,file.join(epubpath,"OPS",filename)) + used[#used+1] = format("",i,filename,mime) + end + end + + container = format(container,epubroot) + package = format(package,identifier,identifier,concat(used,"\n"),root) + + lfs.mkdir(epubpath) + lfs.mkdir(file.join(epubpath,"META-INF")) + lfs.mkdir(file.join(epubpath,"OPS")) + + io.savedata(file.join(epubpath,"mimetype"),mimetype) + io.savedata(file.join(epubpath,"META-INF","container.xml"),container) + io.savedata(file.join(epubpath,"OPS",epubroot),package) + + lfs.chdir(epubpath) + + os.remove(epubfile) + + os.execute(format("zip %s -0 %s",epubfile,"mimetype")) + os.execute(format("zip %s -r %s",epubfile,"META-INF")) + os.execute(format("zip %s -r %s",epubfile,"OPS")) + + lfs.chdir("..") + + application.report("epub archive: %s",file.join(epubpath,epubfile)) + + end + +end + +-- + +if environment.argument("make") then + scripts.epub.make() +else + application.help() +end diff --git a/scripts/context/lua/mtx-flac.lua b/scripts/context/lua/mtx-flac.lua index 0f517f3d4..37f985654 100644 --- a/scripts/context/lua/mtx-flac.lua +++ b/scripts/context/lua/mtx-flac.lua @@ -170,8 +170,8 @@ local helpinfo = [[ example: -mtxrun --collect somename.flac -mtxrun --collect --pattern="m:/music/**") +mtxrun --script flac --collect somename.flac +mtxrun --script flac --collect --pattern="m:/music/**") ]] local application = logs.application { diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 46ddc4f53..54e37c259 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -44,7 +44,7 @@ end nodes.locate = locate local next, type = next, type -local format, match, concat, rep, sub, gsub = string.format, string.match, table.concat, string.rep, string.sub, string.gsub +local format, match, concat, rep, sub, gsub, gmatch = string.format, string.match, table.concat, string.rep, string.sub, string.gsub, string.gmatch local lpegmatch = lpeg.match local utfchar, utfsub = utf.char, utf.sub local insert, remove = table.insert, table.remove @@ -448,7 +448,7 @@ end function specials.fileorurl(handle,var) local file, url = references.checkedfileorurl(var.operation,var.operation) if url then - handle:write(" url='",file,"'") + handle:write(" url='",url,"'") elseif file then handle:write(" file='",file,"'") end @@ -865,10 +865,15 @@ local function checkinserts(data) local di = data[i] if type(di) == "table" then -- id ~= false if di.element == "descriptionsymbol" then - local i = attributehash[di.fulltag].insert - if i then - nofinserts = nofinserts + 1 - insertids[i] = nofinserts + local hash = attributehash[di.fulltag] + if hash then + local i = hash.insert + if i then + nofinserts = nofinserts + 1 + insertids[i] = nofinserts + end + else + -- something is wrong end end if di.data then @@ -1029,7 +1034,7 @@ local d_template = [[ -- encoding='utf-8' local xmlpreamble = [[ - + @@ -1064,12 +1069,19 @@ local function stopexport(v) local xmlfile = file.addsuffix(v,"export") local handle = io.open(xmlfile,"wb") if handle then + local files = { } + local specification = { + name = file.removesuffix(v), + identifier = os.uuid(), + files = files, + } report_export("saving xml data in '%s",xmlfile) handle:write(format(xmlpreamble,tex.jobname,os.date(),environment.version,version)) if type(cssfile) == "string" then local cssfiles = settings_to_array(cssfile) for i=1,#cssfiles do local cssfile = cssfiles[i] + files[#files+1] = cssfile if type(cssfile) ~= "string" or cssfile == variables.yes or cssfile == "" or cssfile == xmlfile then cssfile = file.replacesuffix(xmlfile,"css") else @@ -1131,6 +1143,11 @@ local function stopexport(v) end xml.save(xmltree,xhtmlfile) end + files[#files+1] = xhtmlfile + specification.root = xhtmlfile + local specfile = file.replacesuffix(xmlfile,"specification") + report_export("saving specification in '%s' (mtxrun --script epub --make %s)",specfile,specfile) + io.savedata(specfile,table.serialize(specification,true)) end else report_export("unable to saving xml in '%s",xmlfile) diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 90a6dd6cc..182533d76 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.05.06 16:52} +\newcontextversion{2011.05.09 16:28} %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 f85035371..a1232732f 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.05.06 16:52} +\newcontextversion{2011.05.09 16:28} %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.mkii b/tex/context/base/context.mkii index 3459ff535..b3e49cca4 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.05.06 16:52} +\edef\contextversion{2011.05.09 16:28} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index c2b49422f..ff6a55323 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.05.06 16:52} +\edef\contextversion{2011.05.09 16:28} %D For those who want to use this: diff --git a/tex/context/base/font-enh.lua b/tex/context/base/font-enh.lua index d19424384..ca9893e3d 100644 --- a/tex/context/base/font-enh.lua +++ b/tex/context/base/font-enh.lua @@ -105,19 +105,29 @@ local registerotffeature = otffeatures.register -- we could also add kerns but we asssume symbols -- todo: complain if not basemode +-- remapping = { +-- tounicode = true, +-- unicodes = { +-- a1 = 0x2701, + +local tosixteen = fonts.mappings.tounicode16 + local function initializeunicoding(tfmdata) local goodies = tfmdata.goodies local newcoding = nil + local tounicode = false for i=1,#goodies do local remapping = goodies[i].remapping if remapping and remapping.unicodes then newcoding = remapping.unicodes -- names to unicodes + tounicode = remapping.tounicode end end if newcoding then local characters = tfmdata.characters local descriptions = tfmdata.descriptions local oldcoding = tfmdata.resources.unicodes + local tounicodes = tfmdata.resources.tounicode -- index to unicode local originals = { } for name, newcode in next, newcoding do local oldcode = oldcoding[name] @@ -135,6 +145,12 @@ local function initializeunicoding(tfmdata) characters [newcode] = characters [oldcode] descriptions[newcode] = descriptions[oldcode] end + if tounicode then + local index = descriptions[newcode].index + if not tounicodes[index] then + tounicodes[index] = tosixteen(newcode) -- shared (we could have a metatable) + end + end if trace_defining then report_defining("aliasing glyph '%s' from U+%05X to U+%05X",name,oldcode,newcode) end diff --git a/tex/context/base/lang-def.mkiv b/tex/context/base/lang-def.mkiv index cf2ab9730..359006fef 100644 --- a/tex/context/base/lang-def.mkiv +++ b/tex/context/base/lang-def.mkiv @@ -24,28 +24,28 @@ \installlanguage [\s!nl] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] \installlanguage [\s!en] [\c!spacing=\v!broad, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!month,\ ,\v!day,{,\ },\v!year}, + \c!date={\v!month,\space,\v!day,{,\space},\v!year}, \s!patterns=\s!us, \s!lefthyphenmin=2, \s!righthyphenmin=3] @@ -55,84 +55,84 @@ [\c!spacing=\v!packed, \s!lefthyphenmin=3, \s!righthyphenmin=3, - \c!leftsentence={\hbox{--~}}, - \c!rightsentence={\hbox{~--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsinglesixquote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,{.\space},\v!month,\space,\v!year}] \installlanguage [\s!da] [\c!spacing=\v!packed, - \c!leftsentence={\hbox{--\hskip.5em}}, - \c!rightsentence={\hbox{\hskip.5em--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, + \c!leftsentence={\hbox{\endash\enskip}}, + \c!rightsentence={\hbox{\enskip\endash}}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsinglesixquote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,{.\space},\v!month,\space,\v!year}] \installlanguage [\s!sv] [\c!spacing=\v!packed, - \c!leftsentence={\hbox{--~}}, - \c!rightsentence={\hbox{~--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, \c!leftquote=\upperrightsingleninequote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperrightdoubleninequote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] \installlanguage [\s!af] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}] + \c!date={\v!year,\space,\v!month,\space,\v!day}] \installlanguage [\s!nb] [spacing=packed, lefthyphenmin=2, righthyphenmin=2, - leftsentence=---, - rightsentence=---, - leftsubsentence=---, - rightsubsentence=---, + leftsentence=\emdash, + rightsentence=\emdash, + leftsubsentence=\emdash, + rightsubsentence=\emdash, leftquote=\upperleftsinglesixquote, rightquote=\upperrightsingleninequote, leftquotation=\leftguillemot, rightquotation=\rightguillemot, - date={day,{.},\ ,month,\ ,year}] + date={day,{.},\space,month,\space,year}] \installlanguage [\s!nn] [spacing=packed, lefthyphenmin=2, righthyphenmin=2, - leftsentence=---, - rightsentence=---, - leftsubsentence=---, - rightsubsentence=---, + leftsentence=\emdash, + rightsentence=\emdash, + leftsubsentence=\emdash, + rightsubsentence=\emdash, leftquote=\upperleftsinglesixquote, rightquote=\upperrightsingleninequote, leftquotation=\leftguillemot, rightquotation=\rightguillemot, - date={day,{.},\ ,month,\ ,year}] + date={day,{.},\space,month,\space,year}] \installlanguage [\s!no] [\s!nb] @@ -198,71 +198,67 @@ \installlanguage [\s!pl] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,{.\space},\v!month,\space,\v!year}] \installlanguage [\s!cs] [\c!spacing=\v!packed, - \c!leftsentence=\thickglue--\thickglue\penalty-20\relax, % hh, \relax added - \c!rightsentence=\thickglue--\thickglue\penalty-20\relax, - \c!leftsubsentence=~---~\penalty-20\relax, - \c!rightsubsentence=~---~\penalty-20\relax, + \c!leftsentence={\thickglue\endash\thickglue\penalty-20\relax}, + \c!rightsentence={\thickglue\endash\thickglue\penalty-20\relax}, + \c!leftsubsentence={\nobreakspace\emdash\nobreakspace\penalty-20\relax}, + \c!rightsubsentence={\nobreakspace\emdash\nobreakspace\penalty-20\relax}, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsinglesixquote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!day,{.\,},\v!month,\ ,\v!year}] + \c!date={\v!day,{.\thinspace},\v!month,\space,\v!year}] \installlanguage [\s!sk] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,{.\,},\v!month,\ ,\v!year}] + \c!date={\v!day,{.\thinspace},\v!month,\space,\v!year}] \installlanguage [\s!hr] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] \installlanguage [\s!sl] [\c!spacing=\v!packed, - \c!leftsentence={\hbox{--~}}, - \c!rightsentence={\hbox{~--}}, - \c!leftsubsentence={--}, - \c!rightsubsentence={--}, - %\c!leftquote=\lowerleftsingleninequote, - %\c!rightquote=\upperrightsinglesixquote, - %\c!leftquotation=\lowerleftdoubleninequote, - %\c!rightquotation=\upperrightdoublesixquote, + \c!leftsentence=\hbox{\endash\space}, + \c!rightsentence=\hbox{\space\endash}, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, \c!leftquote=\guilsingleright, \c!rightquote=\guilsingleleft, \c!leftquotation=\rightguillemot, \c!rightquotation=\leftguillemot, - \c!date={\v!day,{.},\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] \installlanguage [polish] [\s!pl] \installlanguage [czech] [\s!cs] @@ -319,7 +315,7 @@ \c!rightquote=\upperrightdoubleninequote, \c!leftquotation=\leftguillemot, \c!rightquotation=\rightguillemot, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] \installlanguage [\s!ua] @@ -334,7 +330,7 @@ \c!rightquote=\upperrightdoubleninequote, \c!leftquotation=\leftguillemot, \c!rightquotation=\rightguillemot, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}, + \c!date={\v!day,\space,\v!month,\space,\v!year}, \s!patterns=\s!uk] \installlanguage [russian] [\s!ru] @@ -346,28 +342,28 @@ \installlanguage [\s!fi] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}] + \c!date={\v!year,\space,\v!month,\space,\v!day}] \installlanguage [\s!hu] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\lowerleftsingleninequote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,.,\ ,\v!month,\ ,\v!day,.}] + \c!date={\v!year,.,\space,\v!month,\space,\v!day,.}] \installlanguage [finish] [\s!fi] \installlanguage [hungarian] [\s!hu] @@ -379,28 +375,28 @@ \installlanguage [\s!tr] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}] + \c!date={\v!year,\space,\v!month,\space,\v!day}] \installlanguage [\s!tk] [\c!spacing=\v!broad, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day} + \c!date={\v!year,\space,\v!month,\space,\v!day} \s!patterns=\s!tk, \s!lefthyphenmin=1, \s!righthyphenmin=2] @@ -418,15 +414,15 @@ \installlanguage [\s!ar] [\c!spacing=\v!broad, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,{،\ },\v!year}] + \c!date={\v!day,\space,\v!month,{،\space},\v!year}] \installlanguage [\s!arabic] [\s!ar] @@ -464,15 +460,15 @@ \installlanguage [\s!lt] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\lowerleftdoubleninequote, \c!rightquote=\upperrightdoublesixquote, \c!leftquotation=\lowerleftdoubleninequote, \c!rightquotation=\upperrightdoublesixquote, - \c!date={\v!year,~m.,\ ,\v!month,\ ,\v!day,~d.}, + \c!date={\v!year,~m.,\space,\v!month,\space,\v!day,~d.}, \s!patterns=\s!lt, \s!lefthyphenmin=2, \s!righthyphenmin=2] @@ -497,7 +493,7 @@ \c!rightquote=’, \c!leftquotation=“, \c!rightquotation=”, - \c!date={\v!year,年,\ ,\v!month,\v!day,日}] + \c!date={\v!year,年,\space,\v!month,\v!day,日}] \installlanguage [\s!ja] @@ -528,15 +524,15 @@ \installlanguage [\s!gr] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\greekleftquot, \c!rightquote=\greekrightquot, \c!leftquotation=\greekleftquot, \c!rightquotation=\greekrightquot, - \c!date={\v!day\ \v!month\ \v!year}, + \c!date={\v!day\space\v!month\space\v!year}, \s!patterns=\s!agr] % ok? \installlanguage [greek] [\s!gr] @@ -577,40 +573,40 @@ \installlanguage [\s!es] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] \installlanguage [sp] [\s!es] % old times context \installlanguage [\s!ca] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] % Note GB left|/|right (sub)sentences are for \quote {incisi}. \installlanguage [\s!it] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=--, - \c!rightsubsentence=--, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, @@ -618,46 +614,46 @@ \c!leftspeech=\leftguillemot, \c!middlespeech=\leftguillemot, \c!rightspeech=\rightguillemot, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] \installlanguage % the same as italian [\s!la] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] \installlanguage [\s!pt] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\upperleftsinglesixquote, \c!rightquote=\upperrightsingleninequote, \c!leftquotation=\upperleftdoublesixquote, \c!rightquotation=\upperrightdoubleninequote, - \c!date={\v!year,\ ,\v!month,\ ,\v!day}] + \c!date={\v!year,\space,\v!month,\space,\v!day}] \installlanguage [\s!ro] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\leftguillemot, \c!rightquote=\rightguillemot, \c!leftquotation=\lowerrightdoubleninequote, \c!rightquotation=\upperleftdoublesixquote, - \c!date={\v!day,\ ,\v!month,\ ,\v!year}] + \c!date={\v!day,\space,\v!month,\space,\v!year}] %D For compatibility reasons we also define: @@ -678,10 +674,10 @@ \installlanguage [\s!vi] [\c!spacing=\v!packed, - \c!leftsentence=---, - \c!rightsentence=---, - \c!leftsubsentence=---, - \c!rightsubsentence=---, + \c!leftsentence=\emdash, + \c!rightsentence=\emdash, + \c!leftsubsentence=\emdash, + \c!rightsubsentence=\emdash, \c!leftquote=\quoteleft, \c!rightquote=\quoteright, \c!leftquotation=\quotedblleft, diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua index da6802974..525e0f17a 100644 --- a/tex/context/base/lang-ini.lua +++ b/tex/context/base/lang-ini.lua @@ -88,11 +88,16 @@ end -- languages.tolang = tolang +-- todo: en+de => merge + local function loaddefinitions(tag,specification) statistics.starttiming(languages) local data, instance = resolve(tag) local definitions = settings_to_array(specification.patterns or "") if #definitions > 0 then + if trace_patterns then + report_initialization("pattern specification for language '%s': %s",tag,specification.patterns) + end local dataused, ok = data.used, false for i=1,#definitions do local definition = definitions[i] @@ -126,11 +131,11 @@ local function loaddefinitions(tag,specification) end end end + return ok elseif trace_patterns then report_initialization("no definitions for language '%s'",tag) end statistics.stoptiming(languages) - return ok end storage.shared.noflanguages = storage.shared.noflanguages or 0 diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua index 4640ca189..c4a834fc0 100644 --- a/tex/context/base/lang-txt.lua +++ b/tex/context/base/lang-txt.lua @@ -28,7 +28,7 @@ if not modules then modules = { } end modules ['lang-txt'] = { -- fr French Daniel Flipo, Arthur Reutenauer -- gr Greek Apostolos Syropoulos, Thomas Schmitz -- hr Croatian Željko Vrba, Richard Gabriel, Vedran Miletić --- hu Hungarian ... +-- hu Hungarian Adam Reviczky -- it Italian Giuseppe Bilotta, Luigi Scarso -- ja Japanese Richard Gabriel -- kr Korean Jeong Dalyoung @@ -305,7 +305,7 @@ data.labels={ fr="", gr="", hr="i", - hu="", + hu="és", it="", la="", lt="", @@ -341,7 +341,7 @@ data.labels={ fr="Annexe ", gr="Παράρτημα", hr="Dodatak ", - hu="", + hu="Melléklet ", it="", ja="付録", kr="부록", @@ -379,7 +379,7 @@ data.labels={ fi="huhtikuu", fr="avril", gr="Απρίλιος", - hr="travanj", + hr="travnja", hu="április", it="aprile", ja="4", @@ -415,7 +415,7 @@ data.labels={ fr="", gr="", hr="tra", - hu="", + hu="ápr.", it="", la="", lt="apr", @@ -449,7 +449,7 @@ data.labels={ fr="à la page ", gr="", hr="na stranici ", - hu="", + hu="oldal ", it="a pagina ", la="", lt="puslapyje ", @@ -486,7 +486,7 @@ data.labels={ fi="elokuu", fr="aoât", gr="Αύγουστος", - hr="kolovoz", + hr="kolovoza", hu="augusztus", it="agosto", ja="8", @@ -522,7 +522,7 @@ data.labels={ fr="", gr="", hr="kol", - hu="", + hu="aug.", it="", la="", lt="aug", @@ -593,7 +593,7 @@ data.labels={ fr="", gr="", hr=" (nastavak)", - hu="", + hu=" (folytatás)", it="", la="", lt="", @@ -629,7 +629,7 @@ data.labels={ fi="joulukuu", fr="décembre", gr="Δεκέμβριος", - hr="prosinac", + hr="prosinca", hu="december", it="dicembre", ja="12", @@ -665,7 +665,7 @@ data.labels={ fr="", gr="", hr="pro", - hu="", + hu="dec.", it="", la="", lt="dec", @@ -701,7 +701,7 @@ data.labels={ fi="helmikuu", fr="février", gr="Φεβρουάριος", - hr="veljača", + hr="veljače", hu="február", it="febbraio", ja="2", @@ -737,7 +737,7 @@ data.labels={ fr="", gr="", hr="velj", - hu="", + hu="feb.", it="", la="", lt="feb", @@ -881,7 +881,7 @@ data.labels={ fr="ci-dessus", gr="", hr="vidi gore", - hu="", + hu="lásd feljebb", kr="그러므로", it="come mostrato sopra", la="", @@ -916,7 +916,7 @@ data.labels={ fr="ci-dessous", gr="", hr="vidi ispod", - hu="", + hu="lásd lejjebb", it="come mostrato sotto", la="", lt="kaip parodyta žemiau", @@ -989,7 +989,7 @@ data.labels={ fi="tammikuu", fr="janvier", gr="Ιανουάριος", - hr="siječanj", + hr="siječnja", hu="január", it="gennaio", ja="1", @@ -1025,7 +1025,7 @@ data.labels={ fr="", gr="", hr="sij", - hu="", + hu="jan.", it="", la="", lt="jan", @@ -1062,7 +1062,7 @@ data.labels={ fi="heinäkuu", fr="juillet", gr="Ιούλιος", - hr="srpanj", + hr="srpnja", hu="július", it="luglio", ja="7", @@ -1098,7 +1098,7 @@ data.labels={ fr="", gr="", hr="srp", - hu="", + hu="júl.", it="", la="", lt="jul", @@ -1134,7 +1134,7 @@ data.labels={ fi="kesäkuu", fr="juin", gr="Ιούνιος", - hr="lipanj", + hr="lipnja", hu="június", it="giugno", ja="6", @@ -1170,7 +1170,7 @@ data.labels={ fr="", gr="", hr="lip", - hu="", + hu="jún.", it="", la="", lt="jun", @@ -1242,7 +1242,7 @@ data.labels={ fr="lignes ", gr="Γραμμές", hr="retci ", - hu="sorok", + hu="sorok ", it="righe ", ja="線", kr="행", @@ -1279,7 +1279,7 @@ data.labels={ fi="maaliskuu", fr="mars", gr="Μάρτιος", - hr="ožujak", + hr="ožujka", hu="március", it="marzo", ja="3", @@ -1315,7 +1315,7 @@ data.labels={ fr="", gr="", hr="ožu", - hu="", + hu="már.", it="", la="", lt="mar", @@ -1352,7 +1352,7 @@ data.labels={ fi="toukokuu", fr="mai", gr="Μάιος", - hr="svibanj", + hr="svibnja", hu="május", it="maggio", ja="5", @@ -1388,7 +1388,7 @@ data.labels={ fr="", gr="", hr="svi", - hu="", + hu="máj.", it="", la="", lt="may", @@ -1423,7 +1423,7 @@ data.labels={ fr="lundi", gr="Δευτέρα", hr="ponedjeljak", - hu="hétfõ", + hu="hétfő", it="lunedì", ja="月曜日", kr="월요일", @@ -1461,7 +1461,7 @@ data.labels={ fi="marraskuu", fr="novembre", gr="Νοέμβριος", - hr="studeni", + hr="studenog", hu="november", it="novembre", ja="11", @@ -1497,7 +1497,7 @@ data.labels={ fr="", gr="", hr="stu", - hu="", + hu="nov.", it="", la="", lt="nov", @@ -1532,7 +1532,7 @@ data.labels={ fi="lokakuu", fr="octobre", gr="Οκτώβριος", - hr="listopad", + hr="listopada", hu="október", it="ottobre", ja="10", @@ -1568,7 +1568,7 @@ data.labels={ fr="", gr="", hr="lis", - hu="", + hu="okt.", it="", la="", lt="oct", @@ -1602,7 +1602,7 @@ data.labels={ fr="page ", gr="", hr="stranica ", - hu="", + hu="oldal ", it="pagina ", kr="쪽", la="", @@ -1713,7 +1713,7 @@ data.labels={ fr="Section ", gr="Ενότητα", hr="Odjeljak ", - hu="", + hu="Fejezet ", it="", ja={"第","項"}, kr={"제","절"}, @@ -1749,7 +1749,7 @@ data.labels={ fr="cf. ", gr="", hr="vidi ", - hu="", + hu="lásd ", it="cf. ", kr="", la="", @@ -1786,7 +1786,7 @@ data.labels={ fi="syyskuu", fr="septembre", gr="Σεπτέμβριος", - hr="rujan", + hr="rujna", hu="szeptember", it="settembre", ja="9", @@ -1822,7 +1822,7 @@ data.labels={ fr="", gr="", hr="ruj", - hu="", + hu="szep.", it="", la="", lt="sep", @@ -1858,7 +1858,7 @@ data.labels={ fr="Soussection ", gr="Υπόενότητα", hr="Pododjeljak ", - hu="", + hu="Alfejezet ", it="", ja="", la="", @@ -1895,7 +1895,7 @@ data.labels={ fr="Soussoussection ", gr="", hr="Podpododjeljak ", - hu="", + hu="Al-alfejezet ", it="", ja="", la="", @@ -1932,7 +1932,7 @@ data.labels={ fr="Soussoussoussection ", gr="", hr="Podpodpododjeljak ", - hu="", + hu="Al-al-alfejezet ", it="", ja="", la="", @@ -2155,7 +2155,7 @@ data.labels={ fr="Abréviations", gr="Συντομογραφίες", hr="Kratice", - hu="RövidÍtések", + hu="Rövidítések", it="Abbreviazioni", ja="略語", kr="약어", @@ -2229,7 +2229,7 @@ data.labels={ fr="Figures", gr="Σχήματα", hr="Slike", - hu="ábrák", + hu="Ábrák", it="Figure", ja="図", kr="그림", @@ -2412,7 +2412,7 @@ data.labels={ fr="Bibliographie", gr="", hr="Literatura", - hu="", + hu="Bibliográfia", it="Bibliografia", la="", lt="Literatūra", diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index 894398b14..49bf00ffe 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -564,9 +564,9 @@ function vfmath.define(specification,set,goodies) local kerns = fci.kerns local width = fci.width local italic = fci.italic - if italic then - width = width + italic - end + -- if italic then + -- width = width + italic -- old interpretation of otf math specs + -- end if kerns then local krn = { } for k, v in next, kerns do -- kerns is sparse diff --git a/tex/context/base/scrp-cjk.lua b/tex/context/base/scrp-cjk.lua index 5570532c8..d817c28cf 100644 --- a/tex/context/base/scrp-cjk.lua +++ b/tex/context/base/scrp-cjk.lua @@ -11,32 +11,24 @@ local insert_node_after = node.insert_after local insert_node_before = node.insert_before local remove_node = nodes.remove -local nodepool = nodes.pool +local nodepool = nodes.pool +local new_glue = nodepool.glue +local new_penalty = nodepool.penalty -local new_glue = nodepool.glue -local new_penalty = nodepool.penalty +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph -local nodecodes = nodes.nodecodes -local skipcodes = nodes.skipcodes +local a_prestat = attributes.private('prestat') +local a_preproc = attributes.private('preproc') -local glyph_code = nodecodes.glyph +local categorytonumber = scripts.categorytonumber +local numbertocategory = scripts.numbertocategory +local hash = scripts.hash +local numbertodataset = scripts.numbertodataset -local userskip_code = skipcodes.userskip - -local a_prestat = attributes.private('prestat') -local a_preproc = attributes.private('preproc') - -scripts.cjk = scripts.cjk or { } - -local categorytonumber = scripts.categorytonumber -local numbertocategory = scripts.numbertocategory -local hash = scripts.hash -local cjk = scripts.cjk -local numbertodataset = scripts.numbertodataset - -local fonthashes = fonts.hashes -local fontdata = fonthashes.identifiers -local quaddata = fonthashes.quads +local fonthashes = fonts.hashes +local fontdata = fonthashes.identifiers +local quaddata = fonthashes.quads -- raggedleft is controlled by leftskip and we might end up with a situation where -- the intercharacter spacing interferes with this; the solution is to patch the @@ -62,16 +54,16 @@ local function nobreak(head,current) end local function stretch_break(head,current) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function shrink_break(head,current) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end local function nobreak_stretch(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function korean_break(head,current) @@ -80,113 +72,113 @@ end local function nobreak_shrink(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end local function nobreak_autoshrink(head,current) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end local function nobreak_stretch_nobreak_shrink(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end local function nobreak_stretch_nobreak_autoshrink(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end local function nobreak_shrink_nobreak_stretch(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function nobreak_autoshrink_nobreak_stretch(head,current) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function nobreak_shrink_break_stretch(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function nobreak_autoshrink_break_stretch(head,current) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function nobreak_shrink_break_stretch_nobreak_shrink(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end local function nobreak_autoshrink_break_stretch_nobreak_autoshrink(head,current) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end local function nobreak_autoshrink_break_stretch_nobreak_shrink(head,current) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end local function nobreak_shrink_break_stretch_nobreak_autoshrink(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) end end local function nobreak_stretch_break_shrink(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end local function nobreak_stretch_break_autoshrink(head,current) insert_node_before(head,current,new_penalty(10000)) - insert_node_before(head,current,new_glue(userskip_code,inter_char_stretch,0)) + insert_node_before(head,current,new_glue(0,inter_char_stretch,0)) if true then - insert_node_before(head,current,new_glue(userskip_code,0,inter_char_half_shrink)) + insert_node_before(head,current,new_glue(0,0,inter_char_half_shrink)) end end diff --git a/tex/context/base/scrp-eth.lua b/tex/context/base/scrp-eth.lua new file mode 100644 index 000000000..75fad2481 --- /dev/null +++ b/tex/context/base/scrp-eth.lua @@ -0,0 +1,151 @@ +if not modules then modules = { } end modules ['scrp-eth'] = { + version = 1.001, + comment = "companion to scrp-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- at some point I will review the script code but for the moment we +-- do it this way; so space settings like with cjk yet + +local has_attribute = node.has_attribute +local insert_node_before = node.insert_before + +local nodepool = nodes.pool + +local new_glue = nodepool.glue +local new_penalty = nodepool.penalty + +local nodecodes = nodes.nodecodes +local glyph_code = nodecodes.glyph + +local a_prestat = attributes.private('prestat') +local a_preproc = attributes.private('preproc') + +local categorytonumber = scripts.categorytonumber +local numbertocategory = scripts.numbertocategory +local hash = scripts.hash +local numbertodataset = scripts.numbertodataset + +local fonthashes = fonts.hashes +local parameters = fonthashes.parameters + +local space, stretch, shrink, lastfont + +local inter_character_space_factor = 1 +local inter_character_stretch_factor = 1 +local inter_character_shrink_factor = 1 + +local function space_glue(current) + local data = numbertodataset[has_attribute(current,a_preproc)] + if data then + inter_character_space_factor = data.inter_character_space_factor or 1 + inter_character_stretch_factor = data.inter_character_stretch_factor or 1 + inter_character_shrink_factor = data.inter_character_shrink_factor or 1 + end + local font = current.font + if lastfont ~= font then + local pf = parameters[font] + space = pf.space + stretch = pf.space_stretch + shrink = pf.space_shrink + lastfont = font + end + return new_glue( + inter_character_space_factor * space, + inter_character_stretch_factor * stretch, + inter_character_shrink_factor * shrink + ) +end + +local function insert_space(head,current) + insert_node_before(head,current,space_glue(current)) +end + +local function insert_zerowidthspace(head,current) + insert_node_before(head,current,new_glue(0)) +end + +local function insert_nobreakspace(head,current) + insert_node_before(head,current,new_penalty(10000)) + insert_node_before(head,current,space_glue(current)) +end + +-- syllable [zerowidthspace] syllable +-- syllable [zerowidthspace] word +-- syllable [zerowidthspace] sentence +-- word [nobreakspace] syllable +-- word [space] word +-- word [space] sentence +-- sentence [nobreakspace] syllable +-- sentence [space] word +-- sentence [space] sentence + +local injectors = { -- [previous] [current] + ethiopic_syllable = { + ethiopic_syllable = insert_zerowidthspace, + ethiopic_word = insert_nobreakspace, + ethiopic_sentence = insert_nobreakspace, + }, + ethiopic_word = { + ethiopic_syllable = insert_space, + ethiopic_word = insert_space, + ethiopic_sentence = insert_space, + }, + ethiopic_sentence = { + ethiopic_syllable = insert_space, + ethiopic_word = insert_space, + ethiopic_sentence = insert_space, + }, +} + +local function process(head,first,last) + if first ~= last then + local injector = false + local current = first + while current do + local id = current.id + if id == glyph_code then + local prestat = has_attribute(current,a_prestat) + local category = numbertocategory[prestat] + if injector then + local action = injector[category] + if action then + action(head,current) + end + end + injector = injectors[category] + else + -- nothing yet + end + if current == last then + break + else + current = current.next + end + end + end +end + +scripts.installmethod { + name = "ethiopic", + process = process, + datasets = { + default = { + inter_character_space_factor = 1, + inter_character_stretch_factor = 1, + inter_character_shrink_factor = 1, + }, + half = { + inter_character_space_factor = 0.5, + inter_character_stretch_factor = 0.5, + inter_character_shrink_factor = 0.5, + }, + quarter = { + inter_character_space_factor = 0.25, + inter_character_stretch_factor = 0.25, + inter_character_shrink_factor = 0.25, + }, + }, +} diff --git a/tex/context/base/scrp-ini.lua b/tex/context/base/scrp-ini.lua index 543211c36..ef036cdf6 100644 --- a/tex/context/base/scrp-ini.lua +++ b/tex/context/base/scrp-ini.lua @@ -173,6 +173,11 @@ if not next(hash) then for i=0x01160,0x011A7 do if not hash[i] then hash[i] = "jamo_medial" end end for i=0x011A8,0x011FF do if not hash[i] then hash[i] = "jamo_final" end end + for i=0x01200,0x0139F do hash[i] = "ethiopic_syllable" end + + hash[0x01361] = "ethiopic_word" + hash[0x01362] = "ethiopic_sentence" + scripts.hash = hash end @@ -180,6 +185,8 @@ end local numbertodataset = allocate() local numbertohandler = allocate() +--~ storage.register("scripts/hash", hash, "scripts.hash") + scripts.numbertodataset = numbertodataset function scripts.installmethod(handler) @@ -215,7 +222,7 @@ function scripts.installdataset(specification) -- global overload local parent = specification.parent or "" local handler = handlers[method] if handler then - local datasets = handler.dataset + local datasets = handler.datasets if datasets then local defaultset = datasets.default if defaultset then @@ -231,7 +238,7 @@ function scripts.installdataset(specification) -- global overload local existing = datasets[name] if existing then for k, v in next, existing do - existing[k] = v + existing[k] = dataset end else datasets[name] = dataset @@ -259,20 +266,23 @@ function scripts.reset() texsetattribute(handler.attributes[preset]) end --- the following tables will become a proper installer +-- the following tables will become a proper installer (move to cjk/eth) local scriptcolors = allocate { -- todo: just named colors - korean = "trace:0", - chinese = "trace:0", - full_width_open = "trace:1", - full_width_close = "trace:2", - half_width_open = "trace:3", - half_width_close = "trace:4", - hyphen = "trace:5", - non_starter = "trace:6", - jamo_initial = "trace:7", - jamo_medial = "trace:8", - jamo_final = "trace:9", + korean = "trace:0", + chinese = "trace:0", + full_width_open = "trace:1", + full_width_close = "trace:2", + half_width_open = "trace:3", + half_width_close = "trace:4", + hyphen = "trace:5", + non_starter = "trace:6", + jamo_initial = "trace:7", + jamo_medial = "trace:8", + jamo_final = "trace:9", + ethiopic_syllable = "trace:1", + ethiopic_word = "trace:2", + ethiopic_sentence = "trace:3", } scripts.colors = scriptcolors @@ -289,6 +299,9 @@ local numbertocategory = allocate { -- rather bound to cjk ... will be generaliz "jamo_initial", "jamo_medial", "jamo_final", + "ethiopic_syllable", + "ethiopic_word", + "ethiopic_sentence", } local categorytonumber = allocate(table.swapped(numbertocategory)) -- could be one table diff --git a/tex/context/base/scrp-ini.mkiv b/tex/context/base/scrp-ini.mkiv index ddffc5bf4..0e50452ff 100644 --- a/tex/context/base/scrp-ini.mkiv +++ b/tex/context/base/scrp-ini.mkiv @@ -15,6 +15,7 @@ \registerctxluafile{scrp-ini}{1.001} \registerctxluafile{scrp-cjk}{1.001} +\registerctxluafile{scrp-eth}{1.001} \definesystemattribute[preproc][public] \definesystemattribute[prestat][public] @@ -45,6 +46,7 @@ \unexpanded\def\startscript[#1]% {\begingroup + \edef\currentscript{#1}% \dosetscript} \unexpanded\def\stopscript @@ -52,8 +54,11 @@ % \setscript[hangul] \hangul \startscript[hangul] -\definescript[latin] [\c!method=] % resets the attribute -\definescript[hangul][\c!method=hangul] -\definescript[hanzi] [\c!method=hanzi] +\definescript[hangul] [\c!method=hangul] +\definescript[hanzi] [\c!method=hanzi] + +\definescript[ethiopic] [\c!method=ethiopic] + +\definescript[latin] [\c!method=] % resets the attribute (also currentscript) \protect \endinput diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 5e38335cf..5be810ea7 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.pdf b/tex/context/base/status-lua.pdf index c34365ed2..1fe6cbde5 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/fonts/dingbats.lfg b/tex/context/fonts/dingbats.lfg index 2e2ed7c37..eab069c72 100644 --- a/tex/context/fonts/dingbats.lfg +++ b/tex/context/fonts/dingbats.lfg @@ -5,6 +5,7 @@ return { author = "Hans Hagen", copyright = "ConTeXt development team", remapping = { + tounicode = true, unicodes = { a1 = 0x2701, a10 = 0x2721, diff --git a/tex/context/fonts/lucida-math.lfg b/tex/context/fonts/lucida-math.lfg index 3341bea95..603f62050 100644 --- a/tex/context/fonts/lucida-math.lfg +++ b/tex/context/fonts/lucida-math.lfg @@ -253,6 +253,8 @@ mathencodings["lbr-mb"] = { mathencodings["lbr-sy"] = { + [0x022C5] = 0x01, -- cdot, + [0x0002B] = 0x82, -- plus [0x0003D] = 0x83, -- equal diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index f6aeb6327..a0284a898 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 05/06/11 16:52:12 +-- merge date : 05/09/11 16:28:06 do -- begin closure to overcome local limits and interference -- cgit v1.2.3