From c1277fe938900d76727978e9140fbf6bea3e13bb Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 11 Feb 2011 12:23:00 +0100 Subject: beta 2011.02.11 12:23 --- scripts/context/lua/mtxrun.lua | 11 ++++- scripts/context/stubs/mswin/mtxrun.lua | 11 ++++- scripts/context/stubs/unix/mtxrun | 11 ++++- tex/context/base/buff-ver.lua | 2 + tex/context/base/buff-ver.mkiv | 2 +- 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/core-con.lua | 65 ++++++++++++++++++++++++++++ tex/context/base/data-sch.lua | 4 +- tex/context/base/font-afm.lua | 3 +- tex/context/base/font-agl.lua | 8 ++-- tex/context/base/font-enc.lua | 18 ++++++++ tex/context/base/font-ini.mkiv | 2 +- tex/context/base/font-map.lua | 8 ++-- tex/context/base/font-syn.lua | 6 +-- tex/context/base/meta-tex.lua | 30 +++++++++++++ tex/context/base/meta-tex.mkiv | 55 +++++++++++++++++++++-- tex/context/base/mult-ini.lua | 12 ++++- tex/context/base/mult-ini.mkiv | 2 +- tex/context/base/sort-ini.lua | 12 +++-- tex/context/base/sort-lan.lua | 18 +++++++- tex/context/base/spac-ver.lua | 4 +- tex/context/base/status-files.pdf | Bin 23192 -> 23205 bytes tex/context/base/trac-log.lua | 11 ++++- tex/context/base/typo-krn.lua | 27 ++++++++++-- tex/generic/context/luatex-fonts-merged.lua | 18 ++++---- 28 files changed, 299 insertions(+), 49 deletions(-) create mode 100644 tex/context/base/meta-tex.lua diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 5b4fcda8e..6d901c197 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -5025,6 +5025,8 @@ if tex and tex.jobname or tex.formatname then local target = "term and log" + logs.flush = io.flush + local formats = { } setmetatable(formats, valueiskey) local translations = { } setmetatable(translations,valueiskey) @@ -5103,6 +5105,11 @@ if tex and tex.jobname or tex.formatname then settarget = function(whereto) target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end end local stack = { } @@ -5128,6 +5135,8 @@ if tex and tex.jobname or tex.formatname then else + logs.flush = ignore + writer = write_nl report = function(a,b,c,...) @@ -5374,7 +5383,7 @@ function logs.stop_page_number() else report_pages("flushing page") end - io.flush() + logs.flush() end logs.report_job_stat = statistics and statistics.showjobstat diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 5b4fcda8e..6d901c197 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -5025,6 +5025,8 @@ if tex and tex.jobname or tex.formatname then local target = "term and log" + logs.flush = io.flush + local formats = { } setmetatable(formats, valueiskey) local translations = { } setmetatable(translations,valueiskey) @@ -5103,6 +5105,11 @@ if tex and tex.jobname or tex.formatname then settarget = function(whereto) target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end end local stack = { } @@ -5128,6 +5135,8 @@ if tex and tex.jobname or tex.formatname then else + logs.flush = ignore + writer = write_nl report = function(a,b,c,...) @@ -5374,7 +5383,7 @@ function logs.stop_page_number() else report_pages("flushing page") end - io.flush() + logs.flush() end logs.report_job_stat = statistics and statistics.showjobstat diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 5b4fcda8e..6d901c197 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -5025,6 +5025,8 @@ if tex and tex.jobname or tex.formatname then local target = "term and log" + logs.flush = io.flush + local formats = { } setmetatable(formats, valueiskey) local translations = { } setmetatable(translations,valueiskey) @@ -5103,6 +5105,11 @@ if tex and tex.jobname or tex.formatname then settarget = function(whereto) target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end end local stack = { } @@ -5128,6 +5135,8 @@ if tex and tex.jobname or tex.formatname then else + logs.flush = ignore + writer = write_nl report = function(a,b,c,...) @@ -5374,7 +5383,7 @@ function logs.stop_page_number() else report_pages("flushing page") end - io.flush() + logs.flush() end logs.report_job_stat = statistics and statistics.showjobstat diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua index c4b7b4a03..392c323be 100644 --- a/tex/context/base/buff-ver.lua +++ b/tex/context/base/buff-ver.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['buff-ver'] = { -- The default visualizers have reserved names starting with buff-imp-*. Users are -- supposed to use different names for their own variants. +-- +-- todo: skip=auto local type, next, rawset, rawget, setmetatable, getmetatable = type, next, rawset, rawget, setmetatable, getmetatable local format, lower, upper,match, find, sub = string.format, string.lower, string.upper, string.match, string.find, string.sub diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index 6cb8e9cac..d92a5d07e 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -659,7 +659,7 @@ %\c!color=, \c!space=\v!off, \c!page=\v!no, - \c!tab=\s!ascii, + \c!tab=\v!yes, % what is this: \s!ascii ? \c!option=\v!none, \c!text=\v!no, \c!style=\tttf, diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 1716c09ef..2c1c51610 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.02.10 13:23} +\newcontextversion{2011.02.11 12:23} %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 6239e1b5b..39ef95f46 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.02.10 13:23} +\newcontextversion{2011.02.11 12:23} %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 b6d27b2ed..ddac76db0 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.02.10 13:23} +\edef\contextversion{2011.02.11 12:23} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 86a656801..12c5d718a 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.02.10 13:23} +\edef\contextversion{2011.02.11 12:23} %D For those who want to use this: diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua index 80e019c1d..c5d58484c 100644 --- a/tex/context/base/core-con.lua +++ b/tex/context/base/core-con.lua @@ -700,3 +700,68 @@ end -- function converters.Alphabetic(n,code) -- do_alphabetic(n,counters[code] or counters['**'],uppercased) -- end + +-- korean: +-- +-- 하 0xD558 => ㅎ 0x314E +-- 파 0xD30C => ㅍ 0x314D +-- 타 0xD0C0 => ㅌ 0x314C +-- 카 0xCE74 => ㅋ 0x314B +-- 차 0xCC28 => ㅊ 0x314A +-- 자 0xC790 => ㅈ 0x3148 +-- 아 0xC544 => ㅇ 0x3147 +-- 사 0xC0AC => ㅅ 0x3145 +-- 바 0xBC14 => ㅂ 0x3142 +-- 마 0xB9C8 => ㅁ 0x3141 +-- 라 0xB77C => ㄹ 0x3139 +-- 다 0xB2E4 => ㄷ 0x3137 +-- 나 0xB098 => ㄴ 0x3134 +-- 가 0xAC20 => ㄱ 0x3131 + +--~ function converters.koreanconsonants(n) +--~ if n < 0xAC00 then return n -- original +--~ elseif n > 0xD7AF then return n -- original +--~ elseif n >= 0xD558 then return 0x314E -- 하 => ㅎ +--~ elseif n >= 0xD30C then return 0x314D -- 파 => ㅍ +--~ elseif n >= 0xD0C0 then return 0x314C -- 타 => ㅌ +--~ elseif n >= 0xCE74 then return 0x314B -- 카 => ㅋ +--~ elseif n >= 0xCC28 then return 0x314A -- 차 => ㅊ +--~ elseif n >= 0xC790 then return 0x3148 -- 자 => ㅈ +--~ elseif n >= 0xC544 then return 0x3147 -- 아 => ㅇ +--~ elseif n >= 0xC0AC then return 0x3145 -- 사 => ㅅ +--~ elseif n >= 0xBC14 then return 0x3142 -- 바 => ㅂ +--~ elseif n >= 0xB9C8 then return 0x3141 -- 마 => ㅁ +--~ elseif n >= 0xB77C then return 0x3139 -- 라 => ㄹ +--~ elseif n >= 0xB2E4 then return 0x3137 -- 다 => ㄷ +--~ elseif n >= 0xB098 then return 0x3134 -- 나 => ㄴ +--~ elseif n >= 0xAC20 then return 0x3131 -- 가 => ㄱ +--~ else return n -- can't happen +--~ end +--~ end + +languages.firstcharacters = { } +local firstcharacters = languages.firstcharacters + +function firstcharacters.korean(chr) + local consonant + if chr < 0xAC00 then consonant = chr -- original + elseif chr > 0xD7AF then consonant = chr -- original + elseif chr >= 0xD558 then consonant = 0x314E -- 하 => ㅎ + elseif chr >= 0xD30C then consonant = 0x314D -- 파 => ㅍ + elseif chr >= 0xD0C0 then consonant = 0x314C -- 타 => ㅌ + elseif chr >= 0xCE74 then consonant = 0x314B -- 카 => ㅋ + elseif chr >= 0xCC28 then consonant = 0x314A -- 차 => ㅊ + elseif chr >= 0xC790 then consonant = 0x3148 -- 자 => ㅈ + elseif chr >= 0xC544 then consonant = 0x3147 -- 아 => ㅇ + elseif chr >= 0xC0AC then consonant = 0x3145 -- 사 => ㅅ + elseif chr >= 0xBC14 then consonant = 0x3142 -- 바 => ㅂ + elseif chr >= 0xB9C8 then consonant = 0x3141 -- 마 => ㅁ + elseif chr >= 0xB77C then consonant = 0x3139 -- 라 => ㄹ + elseif chr >= 0xB2E4 then consonant = 0x3137 -- 다 => ㄷ + elseif chr >= 0xB098 then consonant = 0x3134 -- 나 => ㄴ + elseif chr >= 0xAC00 then consonant = 0x3131 -- 가 => ㄱ + else consonant = chr -- can't happen + end + -- print(format("korean: 0x%04X 0x%04X",chr,consonant)) + return consonant +end diff --git a/tex/context/base/data-sch.lua b/tex/context/base/data-sch.lua index 1f4a77a79..6c905942a 100644 --- a/tex/context/base/data-sch.lua +++ b/tex/context/base/data-sch.lua @@ -73,13 +73,13 @@ local function fetch(specification) if trace_schemes then report_schemes("fetching '%s', protocol '%s', method 'built-in'",original,scheme) end - io.flush() + logs.flush() handler(specification,cachename) else if trace_schemes then report_schemes("fetching '%s', protocol '%s', method 'curl'",original,scheme) end - io.flush() + logs.flush() runcurl(original,cachename) end end diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua index cc2fcadcc..a9d03b47e 100644 --- a/tex/context/base/font-afm.lua +++ b/tex/context/base/font-afm.lua @@ -337,8 +337,7 @@ end local uparser = fonts.map.makenameparser() unify = function(data, filename) - -- local unicodevector = fonts.enc.load('unicode').hash - local unicodevector = fonts.enc.agl.unicodes + local unicodevector = fonts.enc.agl.unicodes -- loaded runtime in context local glyphs, indices, unicodes, names = { }, { }, { }, { } local verbose, private = fonts.verbose, fonts.privateoffset for name, blob in next, data.characters do diff --git a/tex/context/base/font-agl.lua b/tex/context/base/font-agl.lua index 5ff316678..763434e45 100644 --- a/tex/context/base/font-agl.lua +++ b/tex/context/base/font-agl.lua @@ -3947,12 +3947,12 @@ for k, v in next, extras do end end --- can be a return and loaded on demand +-- can be a return and loaded on demands (although there are no more vectors like this) fonts.enc.agl = { - names = names, - extras = extras, - unicodes = unicodes, + names = names, -- unicode -> name + unicodes = unicodes, -- name -> unicode + extras = extras, -- merged into the other two } -- dofile("char-def.lua") diff --git a/tex/context/base/font-enc.lua b/tex/context/base/font-enc.lua index a18db6730..ad1c2ec64 100644 --- a/tex/context/base/font-enc.lua +++ b/tex/context/base/font-enc.lua @@ -18,6 +18,8 @@ them in tables. But we may do so some day, for consistency.

fonts.enc = fonts.enc or { } local enc = fonts.enc +local report_encoding = logs.reporter("fonts","encoding") + enc.version = 1.03 enc.cache = containers.define("fonts", "enc", fonts.enc.version, true) @@ -125,3 +127,19 @@ function enc.make_unicode_vector() end return containers.write(enc.cache, 'unicode', { name='unicode', tag='unicode', vector=vector, hash=hash }) end + +if not enc.agl then + + -- We delay delay loading this rather big vector that is only needed when a + -- font is loaded for caching. Once we're further along the route we can also + -- delay it in the generic version (which doesn't use this file). + + enc.agl = { } + + setmetatable(enc.agl, { __index = function(t,k) + report_encoding("loading (extended) adobe glyph list") + dofile(resolvers.findfile("font-agl.lua")) + return rawget(enc.agl,k) + end }) + +end diff --git a/tex/context/base/font-ini.mkiv b/tex/context/base/font-ini.mkiv index 12cdd2b8f..2df79815f 100644 --- a/tex/context/base/font-ini.mkiv +++ b/tex/context/base/font-ini.mkiv @@ -61,7 +61,7 @@ \registerctxluafile{font-clr}{1.001} \registerctxluafile{node-fnt}{1.001} % here \registerctxluafile{font-enc}{1.001} -\registerctxluafile{font-agl}{1.001} % uses enc, needed in map +%registerctxluafile{font-agl}{1.001} % loaded when needed, saves 100K in format \registerctxluafile{font-map}{1.001} \registerctxluafile{font-syn}{1.001} \registerctxluafile{font-log}{1.001} diff --git a/tex/context/base/font-map.lua b/tex/context/base/font-map.lua index cabdbbac6..26b22b678 100644 --- a/tex/context/base/font-map.lua +++ b/tex/context/base/font-map.lua @@ -163,11 +163,11 @@ fonts.map.addtounicode = function(data,filename) cidcodes = usedmap.unicodes end uparser = makenameparser() - local aglmap = fonts.enc and fonts.enc.agl -- to name + local unicodevector = fonts.enc.agl.unicodes -- loaded runtime in context for index, glyph in next, data.glyphs do local name, unic = glyph.name, glyph.unicode or -1 -- play safe 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 (aglmap and aglmap[name]) + local unicode = (lumunic and lumunic[name]) or unicodevector[name] if unicode then originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 end @@ -211,7 +211,7 @@ fonts.map.addtounicode = function(data,filename) -- skip elseif nplit == 1 then local base = split[1] - unicode = unicodes[base] or (aglmap and aglmap[base]) + unicode = unicodes[base] or unicodevector[base] if unicode then if type(unicode) == "table" then unicode = unicode[1] @@ -222,7 +222,7 @@ fonts.map.addtounicode = function(data,filename) local t, n = { }, 0 for l=1,nplit do local base = split[l] - local u = unicodes[base] or (aglmap and aglmap[base]) + local u = unicodes[base] or unicodevector[base] if not u then break elseif type(u) == "table" then diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index 353e078e4..8f85b8582 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -709,7 +709,7 @@ local function analyzefiles() end done[name] = true end - io.flush() -- a bit overkill for each font, maybe not needed here + logs.flush() -- a bit overkill for each font, maybe not needed here end local function traverse(what, method) local list = filters.list @@ -727,7 +727,7 @@ local function analyzefiles() local elapsed = os.gettimeofday() - t report_names( "%s %s files identified, %s skipped, %s duplicates, %s hash entries added, runtime %0.3f seconds",nofread,what,nofskipped,nofduplicates,nofread-nofskipped,elapsed) end - io.flush() + logs.flush() end if not trace_warnings then report_names( "warnings are disabled (tracker 'fonts.warnings')") @@ -930,7 +930,7 @@ local function is_reloaded() end names.loaded = false reloaded = true - io.flush() + logs.flush() names.load(true) end end diff --git a/tex/context/base/meta-tex.lua b/tex/context/base/meta-tex.lua new file mode 100644 index 000000000..63028d28d --- /dev/null +++ b/tex/context/base/meta-tex.lua @@ -0,0 +1,30 @@ +if not modules then modules = { } end modules ['meta-tex'] = { + version = 1.001, + comment = "companion to meta-tex.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local P, C, lpegmatch = lpeg.P, lpeg.C, lpeg.match + +local left = P("[") +local right = P("]") +local space = P(" ") +local argument = left * C((1-right)^1) * right +local pattern = (argument + space)^0 + +function metapost.sometxt(optional,str) + if optional == "" then + context.sometxta(str) + else + local one, two = lpegmatch(pattern,optional) + if two then + context.sometxtc(one,two,str) + elseif one then + context.sometxtb(one,str) + else + context.sometxta(str) + end + end +end diff --git a/tex/context/base/meta-tex.mkiv b/tex/context/base/meta-tex.mkiv index e35f95385..bc2f354b8 100644 --- a/tex/context/base/meta-tex.mkiv +++ b/tex/context/base/meta-tex.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\registerctxluafile{meta-tex}{1.001} + \unprotect % Ok, we support this in MkIV because Mojca kept the pressure on. It @@ -47,12 +49,57 @@ % draw \sometxt[framed]{black} rotated 45 ; % \stopMPcode -\unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@[#1]}{#2}\setvalue{@@st@@[#1] }{#2}} % we don't grab spaces after [#1] +% \unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@[#1]}{#2}\setvalue{@@st@@[#1] }{#2}} % we don't grab spaces after [#1] +% \long\def\sometxt #1#{\dosometxt{#1}} % grab optional [args] +% \long\def\dosometxt #1#2{textext.drt("\ifcsname @@st@@#1\endcsname\csname @@st@@#1\endcsname{#2}\else#2\fi")} + +% But Mojca wanted more! Two arguments. +% +% \definetextext[framed]{\framed} +% +% \startMPcode +% draw \sometxt{This is for} rotated 45 ; +% draw \sometxt[framed][ss,16pt]{Mojca's}; +% draw \sometxt[framed]{eyes only!} rotated -45 ; +% \stopMPcode + +% a tex one: +% +% \unexpanded\def\definetextext [#1]#2{\setvalue{@@st@@#1}{#2}} +% \def\sometxt #1#{\dosometxt{#1}} +% \def\dosometxt #1#2{textext.drt("\dodosometxt#1{#2}")} +% +% \unexpanded\def\dodosometxt {\doifnextoptionalelse\dododosometxt\relax} +% \def\dododosometxt [#1]{\dodododosometxt{#1}} +% \def\dodododosometxt #1{\doifnextoptionalelse{\dododododosometxt{#1}}{\getsometxt{#1}}} +% \def\dododododosometxt#1[#2]{\switchtobodyfont[#2]\getsometxt{#1}} +% \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}} +% +% or: -\long\def\sometxt#1#{\dosometxt{#1}} % grab optional [args] +\unexpanded\def\dodosometxt {\dodoubleempty\dododosometxt} + \def\dododosometxt {\ifsecondargument + \expandafter\dododosometxtA + \else\iffirstargument + \expandafter\expandafter\expandafter\dododosometxtB + \else + \expandafter\expandafter\expandafter\dododosometxtC + \fi\fi} + \def\dododosometxtA[#1][#2]#3{\getsometxt{#1}{\switchtobodyfont[#2]#3}} + \def\dododosometxtB[#1][#2]#3{\getsometxt{#1}{#3}} + \def\dododosometxtC[#1][#2]#3{#3} + \def\getsometxt #1#2{\csname @@st@@#1\endcsname{#2}} -\long\def\dosometxt#1#2% - {textext.drt("\ifcsname @@st@@#1\endcsname\csname @@st@@#1\endcsname{#2}\else#2\fi")} +% a lua one: + +% \unexpanded\def\definetextext[#1]#2{\setvalue{@@st@@#1}{#2}} +% +% \long\def\sometxt #1#{\dosometxt{#1}} % grab optional [args] +% \long\def\dosometxt #1#2{\ctxlua{metapost.sometxt(\!!bs#1\!!es,\!!bs#2\!!es)}} +% +% \def\sometxta #1{textext.drt("#1")} +% \def\sometxtb #1#2{textext.drt("\getvalue{@@st@@#1}{#2}")} +% \def\sometxtc #1#2#3{textext.drt("\getvalue{@@st@@#1}{\switchtobodyfont[#2]#3}")} % Best use the mp macro instead since it provides positioning. % diff --git a/tex/context/base/mult-ini.lua b/tex/context/base/mult-ini.lua index ab3fa2230..fbb986017 100644 --- a/tex/context/base/mult-ini.lua +++ b/tex/context/base/mult-ini.lua @@ -127,8 +127,18 @@ function interfaces.doifelsemessage(category,tag) return commands.testcase(formats[fulltag(category,tag)]) end +local splitter = lpeg.splitat(",") + function interfaces.showmessage(category,tag,arguments) - reporters[category](formats[fulltag(category,tag)],arguments) + local r = reporters[category] + local f = formats[fulltag(category,tag)] + if type(arguments) == "string" and #arguments > 0 then + r(f,lpegmatch(splitter,arguments)) + elseif arguments then + r(f,arguments) + else + r(f) + end end -- till here diff --git a/tex/context/base/mult-ini.mkiv b/tex/context/base/mult-ini.mkiv index d7a21bed2..afddf692e 100644 --- a/tex/context/base/mult-ini.mkiv +++ b/tex/context/base/mult-ini.mkiv @@ -383,7 +383,7 @@ %D Till here. \unexpanded\def\doifelsemessage #1#2{\ctxlua{interfaces.doifelsemessage("#1","#2")}} -\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2","#3")}} +\unexpanded\def\showmessage #1#2#3{\ctxlua{interfaces.showmessage("#1","#2",\!!bs#3\!!es)}} \unexpanded\def\writestatus #1#2{\ctxcommand{writestatus("#1",\!!bs#2\!!es)}} %D \macros diff --git a/tex/context/base/sort-ini.lua b/tex/context/base/sort-ini.lua index 37443c257..1091bfbfb 100644 --- a/tex/context/base/sort-ini.lua +++ b/tex/context/base/sort-ini.lua @@ -98,6 +98,7 @@ local constants = sorters.constants local data, language, method, digits local replacements, m_mappings, z_mappings, p_mappings, entries, orders, lower, upper, method, sequence +local thefirstofsplit local mte = { __index = function(t,k) @@ -230,6 +231,7 @@ local function preparetables(data) setmetatable(data.m_mappings,mtm) setmetatable(data.z_mappings,mtm) setmetatable(data.p_mappings,mtm) + thefirstofsplit = data.firstofsplit end local function update() -- prepare parent chains, needed when new languages are added @@ -421,9 +423,13 @@ local function firstofsplit(entry) else split = split.ch end - local entry = split and split[1] or "" - local tag = entries[entry] or "\000" - return entry, tag + if thefirstofsplit then + return thefirstofsplit(entry,split) + else + local entry = split and split[1] or "" + local tag = entries[entry] or "\000" + return entry, tag + end end sorters.firstofsplit = firstofsplit diff --git a/tex/context/base/sort-lan.lua b/tex/context/base/sort-lan.lua index 8137bac13..44b92d2b0 100644 --- a/tex/context/base/sort-lan.lua +++ b/tex/context/base/sort-lan.lua @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['sort-lan'] = { -- Gesang. However this is a quite adapted and reformatted variant -- so it needs some checking. -local utfchar = utf.char +local utfchar, utfbyte = utf.char, utf.byte local sorters = sorters local definitions = sorters.definitions local replacementoffset = sorters.constants.replacementoffset @@ -857,3 +857,19 @@ definitions["et"] = { "t", "u", "v", "w", "õ", "ä", "ö", "ü", "x", "y", } } + +--- Korean + +local first = languages.firstcharacters.korean + +function firstofsplit(entries,split) + first = first or languages.firstcharacters.korean + local entry = split and split[1] or "" + local entry = utfchar(first(utfbyte(entry))) + local tag = entry + return entry, tag +end + +definitions["kr"] = { + firstofsplit = firstofsplit, +} diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 2f3f2a38a..ecd5139fa 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -735,10 +735,10 @@ local discard, largest, force, penalty, add, disable, nowhite, goback, together --~ local function free_glue_node(n) --~ -- free_node(n.spec) --~ print("before",n) ---~ io.flush() +--~ logs.flush() --~ free_node(n) --~ print("after") ---~ io.flush() +--~ logs.flush() --~ end function vspacing.snapbox(n,how) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index a774454fd..d535b32f7 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/trac-log.lua b/tex/context/base/trac-log.lua index a6d398bc3..fdc57eba1 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -50,6 +50,8 @@ if tex and tex.jobname or tex.formatname then local target = "term and log" + logs.flush = io.flush + local formats = { } setmetatable(formats, valueiskey) local translations = { } setmetatable(translations,valueiskey) @@ -128,6 +130,11 @@ if tex and tex.jobname or tex.formatname then settarget = function(whereto) target = targets[whereto or "both"] or targets.both + if target == "term" or target == "term and log" then + logs.flush = io.flush + else + logs.flush = ignore + end end local stack = { } @@ -153,6 +160,8 @@ if tex and tex.jobname or tex.formatname then else + logs.flush = ignore + writer = write_nl report = function(a,b,c,...) @@ -399,7 +408,7 @@ function logs.stop_page_number() else report_pages("flushing page") end - io.flush() + logs.flush() end logs.report_job_stat = statistics and statistics.showjobstat diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua index 91849db85..9bf3cb1f5 100644 --- a/tex/context/base/typo-krn.lua +++ b/tex/context/base/typo-krn.lua @@ -75,8 +75,15 @@ local factors = kerns.factors local gluefactor = 4 -- assumes quad = .5 enspace +kerns.keepligature = false -- just for fun (todo: control setting with key/value) +kerns.keeptogether = false -- just for fun (todo: control setting with key/value) + +-- can be optimized .. the prev thing .. but hardly worth the effort + local function do_process(namespace,attribute,head,force) local start, done, lastfont = head, false, nil +local keepligature = kerns.keepligature +local keeptogether = kerns.keeptogether while start do -- faster to test for attr first local attr = force or has_attribute(start,attribute) @@ -89,6 +96,9 @@ local function do_process(namespace,attribute,head,force) lastfont = start.font local c = start.components if c then +if keepligature and keepligature(start) then + -- keep 'm +else c = do_process(namespace,attribute,c,attr) local s = start local p, n = s.prev, s.next @@ -106,8 +116,9 @@ local function do_process(namespace,attribute,head,force) start = c s.components = nil -- we now leak nodes ! ---~ free_node(s) + -- free_node(s) done = true +end end local prev = start.prev if prev then @@ -115,20 +126,30 @@ local function do_process(namespace,attribute,head,force) if not pid then -- nothing elseif pid == kern_code and prev.subtype == kerning_code then +if keeptogether and prev.prev.id == glyph_code and keeptogether(prev.prev,start) then -- we could also pass start + -- keep 'm +else prev.subtype = userkern_code prev.kern = prev.kern + quaddata[lastfont]*krn done = true +end elseif pid == glyph_code then if prev.font == lastfont then local prevchar, lastchar = prev.char, start.char +if keeptogether and keeptogether(prev,start) then + -- keep 'm +else local kerns = chardata[lastfont][prevchar].kerns local kern = kerns and kerns[lastchar] or 0 krn = kern + quaddata[lastfont]*krn + insert_node_before(head,start,new_kern(krn)) + done = true +end else krn = quaddata[lastfont]*krn + insert_node_before(head,start,new_kern(krn)) + done = true end - insert_node_before(head,start,new_kern(krn)) - done = true elseif pid == disc_code then -- a bit too complicated, we can best not copy and just calculate -- but we could have multiple glyphs involved so ... diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 6aacb9857..0563456d0 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 : 02/10/11 13:23:45 +-- merge date : 02/11/11 12:23:06 do -- begin closure to overcome local limits and interference @@ -5533,11 +5533,11 @@ fonts.map.addtounicode = function(data,filename) cidcodes = usedmap.unicodes end uparser = makenameparser() - local aglmap = fonts.enc and fonts.enc.agl -- to name + local unicodevector = fonts.enc.agl.unicodes -- loaded runtime in context for index, glyph in next, data.glyphs do local name, unic = glyph.name, glyph.unicode or -1 -- play safe 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 (aglmap and aglmap[name]) + local unicode = (lumunic and lumunic[name]) or unicodevector[name] if unicode then originals[index], tounicode[index], ns = unicode, tounicode16(unicode), ns + 1 end @@ -5581,7 +5581,7 @@ fonts.map.addtounicode = function(data,filename) -- skip elseif nplit == 1 then local base = split[1] - unicode = unicodes[base] or (aglmap and aglmap[base]) + unicode = unicodes[base] or unicodevector[base] if unicode then if type(unicode) == "table" then unicode = unicode[1] @@ -5592,7 +5592,7 @@ fonts.map.addtounicode = function(data,filename) local t, n = { }, 0 for l=1,nplit do local base = split[l] - local u = unicodes[base] or (aglmap and aglmap[base]) + local u = unicodes[base] or unicodevector[base] if not u then break elseif type(u) == "table" then @@ -15419,12 +15419,12 @@ for k, v in next, extras do end end --- can be a return and loaded on demand +-- can be a return and loaded on demands (although there are no more vectors like this) fonts.enc.agl = { - names = names, - extras = extras, - unicodes = unicodes, + names = names, -- unicode -> name + unicodes = unicodes, -- name -> unicode + extras = extras, -- merged into the other two } -- dofile("char-def.lua") -- cgit v1.2.3