summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua')
-rw-r--r--Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua38
1 files changed, 25 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua b/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
index c5104648763..3f13f99b773 100644
--- a/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
+++ b/Master/texmf-dist/tex/generic/babel/babel-bidi-basic.lua
@@ -131,28 +131,40 @@ function Babel.bidi(head, ispar, hdir)
-- current one is not added until we start processing the neutrals.
-- three cases: glyph, dir, otherwise
- if item.id == GLYPH then
+ if item.id == GLYPH
+ or (item.id == 7 and item.subtype == 2) then
- local chardata = characters[item.char]
+ local d_font = nil
+ local item_r
+ if item.id == 7 and item.subtype == 2 then
+ item_r = item.replace -- automatic discs have just 1 glyph
+ else
+ item_r = item
+ end
+ local chardata = characters[item_r.char]
d = chardata and chardata.d or nil
- if not d then
+ if not d or d == 'nsm' then
for nn, et in ipairs(ranges) do
- if item.char < et[1] then
+ if item_r.char < et[1] then
break
- elseif item.char <= et[2] then
- d = et[3]
+ elseif item_r.char <= et[2] then
+ if not d then d = et[3]
+ elseif d == 'nsm' then d_font = et[3]
+ end
break
end
end
end
d = d or 'l'
-
- local temp = (d == 'l' and 0) or
- (d == 'r' and 1) or
- (d == 'al' and 2) or
- (d == 'an' and 2) or nil
- if temp and fontmap and fontmap[temp][item.font] then
- item.font = fontmap[temp][item.font]
+ d_font = d_font or d
+
+ d_font = (d_font == 'l' and 0) or
+ (d_font == 'nsm' and 0) or
+ (d_font == 'r' and 1) or
+ (d_font == 'al' and 2) or
+ (d_font == 'an' and 2) or nil
+ if d_font and fontmap and fontmap[d_font][item_r.font] then
+ item_r.font = fontmap[d_font][item_r.font]
end
if new_d then