diff options
author | Karl Berry <karl@freefriends.org> | 2020-03-05 00:48:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-03-05 00:48:46 +0000 |
commit | f210bce174e1f2f05305ab03e88e120a1cbfc4da (patch) | |
tree | 5c4e2ad096b5c745e859516ac3196fa0864292d5 /Master/texmf-dist/tex/context/base/mkiv/typo-itc.lua | |
parent | 35fd641a3546acc0c62e0aa7f134888e36da30d4 (diff) |
context (from cont-tmf.zip of Feb 17 16:00, size 116339406)
git-svn-id: svn://tug.org/texlive/trunk@54086 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/typo-itc.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/typo-itc.lua | 93 |
1 files changed, 52 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/typo-itc.lua b/Master/texmf-dist/tex/context/base/mkiv/typo-itc.lua index 2683eecc3e1..64701abcc6c 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/typo-itc.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/typo-itc.lua @@ -383,6 +383,8 @@ local function texthandler(head) postinserted = nil postitalic = 0 updated = false + replacefont = nil + postfont = nil pre, post, replace, pretail, posttail, replacetail = getdisc(current,true) if replace then local current = replacetail @@ -390,29 +392,32 @@ local function texthandler(head) local char, id = isglyph(current) if char then local font = id - local data = italicsdata[font] - if data then - local attr = forcedvariant or getattr(current,a_italics) - if attr and attr > 0 then - local cd = data[char] - if not cd then - -- this really can happen - replaceitalic = 0 - else - replaceitalic = cd.italic - if not replaceitalic then - replaceitalic = setitalicinfont(font,char) -- calculated once - -- replaceitalic = 0 - end - if replaceitalic ~= 0 then - lastfont = font - lastattr = attr - replacechar = char - replacehead = replace - updated = true + if font ~= lastfont then + local data = italicsdata[font] + if data then + local attr = forcedvariant or getattr(current,a_italics) + if attr and attr > 0 then + local cd = data[char] + if not cd then + -- this really can happen + replaceitalic = 0 + else + replaceitalic = cd.italic + if not replaceitalic then + replaceitalic = setitalicinfont(font,char) -- calculated once + -- replaceitalic = 0 + end + if replaceitalic ~= 0 then + lastfont = font + lastattr = attr + replacechar = char + replacehead = replace + updated = true + end end end end + replacefont = font end break else @@ -426,29 +431,32 @@ local function texthandler(head) local char, id = isglyph(current) if char then local font = id - local data = italicsdata[font] - if data then - local attr = forcedvariant or getattr(current,a_italics) - if attr and attr > 0 then - local cd = data[char] - if not cd then - -- this really can happen - -- postitalic = 0 - else - postitalic = cd.italic - if not postitalic then - postitalic = setitalicinfont(font,char) -- calculated once - -- postitalic = 0 - end - if postitalic ~= 0 then - lastfont = font - lastattr = attr - postchar = char - posthead = post - updated = true + if font ~= lastfont then + local data = italicsdata[font] + if data then + local attr = forcedvariant or getattr(current,a_italics) + if attr and attr > 0 then + local cd = data[char] + if not cd then + -- this really can happen + -- postitalic = 0 + else + postitalic = cd.italic + if not postitalic then + postitalic = setitalicinfont(font,char) -- calculated once + -- postitalic = 0 + end + if postitalic ~= 0 then + lastfont = font + lastattr = attr + postchar = char + posthead = post + updated = true + end end end end + postfont = font end break else @@ -456,6 +464,9 @@ local function texthandler(head) end end end + if replacefont or postfont then + lastfont = replacefont or postfont + end if updated then setdisc(current,pre,post,replace) end @@ -520,7 +531,7 @@ local function texthandler(head) else if replaceitalic ~= 0 then if trace_italics then - report_italics("inserting %p between %s italic %C and whatever",replaceritalic,"replace",replacechar) + report_italics("inserting %p between %s italic %C and whatever",replaceitalic,"replace",replacechar) end insert_node_after(replacehead,replace,correction_kern(replaceitalic,current)) previnserted = nil |