From b8da8b42eae284f045e32aedf2a564f1c3588584 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Wed, 26 Nov 2014 21:15:03 +0100 Subject: 2014-11-26 20:05:00 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4392 -> 4386 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/lang-hyp.lua | 75 ++++++++++++++++----- tex/context/base/lang-hyp.mkiv | 9 ++- tex/context/base/lang-ini.mkiv | 4 ++ tex/context/base/pack-mrl.mkiv | 8 ++- tex/context/base/scrn-fld.mkvi | 2 + tex/context/base/status-files.pdf | Bin 24694 -> 24700 bytes tex/context/base/status-lua.pdf | Bin 344500 -> 344497 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 11 files changed, 81 insertions(+), 23 deletions(-) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 7392a750e..49e49777f 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{2014.11.26 12:50} +\newcontextversion{2014.11.26 20:03} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index fbc02fe6b..2576ac50c 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 8229af432..fc91abb81 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.11.26 12:50} +\edef\contextversion{2014.11.26 20:03} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/lang-hyp.lua b/tex/context/base/lang-hyp.lua index 31ec8946c..4bf2845fd 100644 --- a/tex/context/base/lang-hyp.lua +++ b/tex/context/base/lang-hyp.lua @@ -202,10 +202,11 @@ function traditional.loadpatterns(language,filename) return dictionary end -local lcchars = characters.lcchars -local uccodes = characters.uccodes -local nofwords = 0 -local nofhashed = 0 +local lcchars = characters.lcchars +local uccodes = characters.uccodes +local categories = characters.categories +local nofwords = 0 +local nofhashed = 0 local steps = nil local f_show = formatters["%w%s"] @@ -439,6 +440,9 @@ local function hyphenate(dictionary,word,n) -- odd is okay end function traditional.gettrace(language,word) + if not word or word == "" then + return + end local dictionary = dictionaries[language] if dictionary then local hyphenated = dictionary.hyphenated @@ -763,6 +767,7 @@ if context then local rightwordmin = tonumber(featureset.rightwordmin) local leftcharmin = tonumber(featureset.leftcharmin) local rightcharmin = tonumber(featureset.rightcharmin) + local rightedge = featureset.rightedge -- joinerchars = joinerchars == v_yes and defaultjoiners or joinerchars hyphenchars = hyphenchars == v_yes and defaulthyphens or hyphenchars @@ -773,6 +778,7 @@ if context then featureset.rightwordmin = rightwordmin and rightwordmin > 0 and rightwordmin or nil featureset.leftcharmin = leftcharmin and leftcharmin > 0 and leftcharmin or nil featureset.rightcharmin = rightcharmin and rightcharmin > 0 and rightcharmin or nil + featureset.strict = rightedge == 'tex' -- return register(name,featureset) end @@ -830,9 +836,21 @@ if context then -- 3M memory on this test. (Some optimizations already brought the 3.30 -- seconds down to 3.14 but it all depends on aggressive caching.) + -- As we kick in the hyphenator before fonts get handled, we don't look + -- at implicit (font) kerns or ligatures. + local starttiming = statistics.starttiming local stoptiming = statistics.stoptiming + local strictids = { + [nodecodes.hlist] = true, + [nodecodes.vlist] = true, + [nodecodes.rule] = true, + [nodecodes.disc] = true, + [nodecodes.accent] = true, + [nodecodes.math] = true, + } + function traditional.hyphenate(head) local first = tonut(head) @@ -860,6 +878,7 @@ if context then local attr = nil local lastwordlast = nil local hyphenated = hyphenate + local strict = nil -- We cannot use an 'enabled' boolean (false when no characters or extras) because we -- can have plugins that set a characters metatable and so) ... it doesn't save much @@ -882,6 +901,7 @@ if context then rightwordmin = f.rightwordmin leftcharmin = f.leftcharmin rightcharmin = f.rightcharmin + strict = f.strict and strictids if rightwordmin and rightwordmin > 0 and lastwordlast ~= rightwordmin then -- so we can change mid paragraph but it's kind of unpredictable then if not tail then @@ -911,6 +931,7 @@ if context then rightwordmin = false leftcharmin = false rightcharmin = false + strict = false end return a end @@ -1119,9 +1140,13 @@ if context then local lang = getfield(current,"lang") if lang ~= language then if size > 0 and dictionary and leftmin + rightmin <= size then - local hyphens = hyphenated(dictionary,word,size) - if hyphens then - flush(hyphens) + if categories[word[1]] == "lu" and getfield(start,"uchyph") < 0 then + -- skip + else + local hyphens = hyphenated(dictionary,word,size) + if hyphens then + flush(hyphens) + end end end language = lang @@ -1165,9 +1190,13 @@ if context then word[size] = char elseif dictionary then if leftmin + rightmin <= size then - local hyphens = hyphenated(dictionary,word,size) - if hyphens then - flush(hyphens) + if categories[word[1]] == "lu" and getfield(start,"uchyph") < 0 then + -- skip + else + local hyphens = hyphenated(dictionary,word,size) + if hyphens then + flush(hyphens) + end end end size = 0 @@ -1190,13 +1219,20 @@ if context then end stop = current current = getnext(current) + elseif strict and strict[id] then + current = id == math_code and getnext(end_of_math(current)) or getnext(current) + size = 0 else current = id == math_code and getnext(end_of_math(current)) or getnext(current) if size > 0 then if dictionary and leftmin + rightmin <= size then - local hyphens = hyphenated(dictionary,word,size) - if hyphens then - flush(hyphens) + if categories[word[1]] == "lu" and getfield(start,"uchyph") < 0 then + -- skip + else + local hyphens = hyphenated(dictionary,word,size) + if hyphens then + flush(hyphens) + end end end size = 0 @@ -1205,9 +1241,13 @@ if context then end -- we can have quit due to last so we need to flush the last seen word if size > 0 and dictionary and leftmin + rightmin <= size then - local hyphens = hyphenated(dictionary,word,size) - if hyphens then - flush(hyphens) + if categories[word[1]] == "lu" and getfield(start,"uchyph") < 0 then + -- skip + else + local hyphens = hyphenated(dictionary,word,size) + if hyphens then + flush(hyphens) + end end end @@ -1293,6 +1333,9 @@ if context then local ctx_verbatim = context.verbatim function commands.showhyphenationtrace(language,word) + if not word or word == "" then + return + end local saved = trace_steps trace_steps = "silent" local steps = traditional.gettrace(language,word) diff --git a/tex/context/base/lang-hyp.mkiv b/tex/context/base/lang-hyp.mkiv index 036974c87..aef57be4c 100644 --- a/tex/context/base/lang-hyp.mkiv +++ b/tex/context/base/lang-hyp.mkiv @@ -95,6 +95,7 @@ \letdummyparameter\s!lefthyphenmin\!!zerocount \letdummyparameter\s!righthyphenmin\!!zerocount \letdummyparameter\c!alternative\empty + \letdummyparameter\c!rightedge\empty \getdummyparameters[#2]% \ctxcommand{definehyphenationfeatures("#1",{ characters = \!!bs\dummyparameter\c!characters\!!es, @@ -104,6 +105,7 @@ leftcharmin = \number\dummyparameter\s!lefthyphenmin, rightcharmin = \number\dummyparameter\s!righthyphenmin, alternative = "\dummyparameter\c!alternative", + rightedge = "\dummyparameter\c!rightedge", })}% \endgroup} @@ -182,9 +184,14 @@ \definehyphenationfeatures [default] - [\c!hyphens=\v!yes, + [%c!rightedge=\v!tex, + \c!hyphens=\v!yes, \c!joiners=\v!yes] +\definehyphenationfeatures + [strict] + [\c!rightedge=\s!tex] + % \sethyphenationfeatures % [fences] diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv index 1ffc37791..d40136f9c 100644 --- a/tex/context/base/lang-ini.mkiv +++ b/tex/context/base/lang-ini.mkiv @@ -515,6 +515,10 @@ \unexpanded\def\language {\doifnextoptionalcselse\lang_basics_set_current\normallanguage} +\let\setlanguage\language % we make these synonyms + +\let\patterns\gobbleoneargument + \newcount\mainlanguagenumber \unexpanded\def\mainlanguage[#1]% diff --git a/tex/context/base/pack-mrl.mkiv b/tex/context/base/pack-mrl.mkiv index c0097cb5f..ad3a1364f 100644 --- a/tex/context/base/pack-mrl.mkiv +++ b/tex/context/base/pack-mrl.mkiv @@ -145,7 +145,8 @@ %D \showsetup{hl} \unexpanded\def\pack_rule_vl_indeed#1#2#3% - {\bgroup + {\dontleavehmode + \begingroup \setbox\scratchbox\hbox {\vrule \s!width #1\linewidth @@ -154,13 +155,14 @@ \dp\scratchbox\strutdp \ht\scratchbox\strutht \box\scratchbox - \egroup} + \endgroup} \def\pack_rule_vl[#1]% {\pack_rule_vl_indeed{#1}{#1}{#1}} \def\pack_rule_hl[#1]% - {\hbox + {\dontleavehmode + \hbox {\vrule \s!width #1\emwidth \s!height\linewidth diff --git a/tex/context/base/scrn-fld.mkvi b/tex/context/base/scrn-fld.mkvi index 049ac92c3..bf1923e11 100644 --- a/tex/context/base/scrn-fld.mkvi +++ b/tex/context/base/scrn-fld.mkvi @@ -740,6 +740,8 @@ %D \goto{walk field}[Walk{mine}] %D \stoptyping +% todo: expand #symbols + \unexpanded\def\definefieldstack {\dotripleargument\scrn_fieldstack_define} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index f9a8c021f..37f29f9a4 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 47c64e4a0..de451d454 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 409f5d255..7a840991a 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 : 11/26/14 12:50:01 +-- merge date : 11/26/14 20:03:34 do -- begin closure to overcome local limits and interference -- cgit v1.2.3