summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/typo-itc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/typo-itc.lua')
-rw-r--r--tex/context/base/mkiv/typo-itc.lua93
1 files changed, 52 insertions, 41 deletions
diff --git a/tex/context/base/mkiv/typo-itc.lua b/tex/context/base/mkiv/typo-itc.lua
index 2683eecc3..64701abcc 100644
--- a/tex/context/base/mkiv/typo-itc.lua
+++ b/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