diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-14 11:00:07 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-14 11:00:07 +0100 |
commit | f9e8ebd7846583d696b4e9e7d6454475a38fd767 (patch) | |
tree | bf0677e71178851364f6d7d9a9f511f036a971bb /src/fontloader/runtime | |
parent | f5180e94891872433c3c1ef068d5557c5969c993 (diff) | |
download | luaotfload-f9e8ebd7846583d696b4e9e7d6454475a38fd767.tar.gz |
[fontloader] sync with Context as of 2014-12-14
Diffstat (limited to 'src/fontloader/runtime')
-rw-r--r-- | src/fontloader/runtime/fontloader-fontloader.lua | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/src/fontloader/runtime/fontloader-fontloader.lua b/src/fontloader/runtime/fontloader-fontloader.lua index 0313204..f11a74c 100644 --- a/src/fontloader/runtime/fontloader-fontloader.lua +++ b/src/fontloader/runtime/fontloader-fontloader.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 12/03/14 18:26:33 +-- merge date : 12/11/14 12:02:53 do -- begin closure to overcome local limits and interference @@ -2831,9 +2831,10 @@ local striplinepatterns={ ["retain and no empty"]=p_retain_noempty, ["collapse"]=patterns.collapser, } +setmetatable(striplinepatterns,{ __index=function(t,k) return p_prune_collapse end }) strings.striplinepatterns=striplinepatterns function strings.striplines(str,how) - return str and lpegmatch(how and striplinepatterns[how] or p_prune_collapse,str) or str + return str and lpegmatch(striplinepatterns[how],str) or str end strings.striplong=strings.striplines function strings.nice(str) @@ -7830,8 +7831,8 @@ actions["add duplicates"]=function(data,filename,raw) local description=descriptions[unicode] local n=0 for _,description in next,descriptions do + local kerns=description.kerns if kerns then - local kerns=description.kerns for _,k in next,kerns do local ku=k[unicode] if ku then @@ -14560,14 +14561,20 @@ local fonts=fonts local nodes=nodes local traverse_id=node.traverse_id local glyph_code=nodes.nodecodes.glyph +local disc_code=nodes.nodecodes.disc local ligaturing=node.ligaturing local kerning=node.kerning -function node.ligaturing() texio.write_nl("warning: node.ligaturing is already applied") end -function node.kerning () texio.write_nl("warning: node.kerning is already applied") end +local basepass=true +function nodes.handlers.setbasepass(v) + basepass=v +end function nodes.handlers.characters(head) local fontdata=fonts.hashes.identifiers if fontdata then - local usedfonts,basefonts,prevfont,basefont={},{},nil,nil + local usedfonts={} + local basefonts={} + local prevfont=nil + local basefont=nil for n in traverse_id(glyph_code,head) do local font=n.font if font~=prevfont then @@ -14584,7 +14591,7 @@ function nodes.handlers.characters(head) local processors=shared.processes if processors and #processors>0 then usedfonts[font]=processors - else + elseif basepass then basefont={ n,nil } basefonts[#basefonts+1]=basefont end @@ -14593,6 +14600,30 @@ function nodes.handlers.characters(head) end end end + for d in traverse_id(disc_code,head) do + local r=d.replace + if r then + for n in traverse_id(glyph_code,r) do + local font=n.font + if font~=prevfont then + prevfont=font + local used=usedfonts[font] + if not used then + local tfmdata=fontdata[font] + if tfmdata then + local shared=tfmdata.shared + if shared then + local processors=shared.processes + if processors and #processors>0 then + usedfonts[font]=processors + end + end + end + end + end + end + end + end if next(usedfonts) then for font,processors in next,usedfonts do for i=1,#processors do @@ -14600,7 +14631,7 @@ function nodes.handlers.characters(head) end end end - if #basefonts>0 then + if basepass and #basefonts>0 then for i=1,#basefonts do local range=basefonts[i] local start,stop=range[1],range[2] @@ -14621,6 +14652,10 @@ end function nodes.simple_font_handler(head) head=nodes.handlers.characters(head) nodes.injections.handler(head) + if not basepass then + head=ligaturing(head) + head=kerning(head) + end nodes.handlers.protectglyphs(head) return head end |