Closed jbezos closed 4 months ago
This following naive patch seems to work, but I did not think much about it:
diff --git a/babel.dtx b/babel.dtx
index ebfea61..859ddb9 100644
--- a/babel.dtx
+++ b/babel.dtx
@@ -23296,6 +23296,18 @@ local ranges = Babel.ranges
local DIR = node.id('dir')
local GLYPH = node.id('glyph')
+local tenln = font.id('tenln')
+local tenlnw = font.id('tenlnw')
+local tencirc = font.id('tencirc')
+local tencircw = font.id('tencircw')
+
+local function glyph_not_picture_font(node)
+ local id = node.id
+ if id ~= GLYPH then
+ return false
+ else
+ local font = node.font
+ return font ~= tenln and font ~= tenlnw
+ and font ~= tencirc and font ~= tencircw
+ end
+end
local function insert_implicit(head, state, outer)
local new_state = state
@@ -23384,7 +23396,7 @@ 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
+ if glyph_not_picture_font(item)
or (item.id == 7 and item.subtype == 2) then
local d_font = nil
@@ -23513,7 +23525,7 @@ function Babel.bidi(head, ispar, hdir)
temp = 'on' -- W6
end
for e = first_et, #nodes do
- if nodes[e][1].id == GLYPH then nodes[e][2] = temp end
+ if glyph_not_picture_font(nodes[e][1]) then nodes[e][2] = temp end
end
first_et = nil
has_en = false
@@ -23553,7 +23565,7 @@ function Babel.bidi(head, ispar, hdir)
temp = 'on' -- W6
end
for e = first_et, #nodes do
- if nodes[e][1].id == GLYPH then nodes[e][2] = temp end
+ if glyph_not_picture_font(nodes[e][1]) then nodes[e][2] = temp end
end
end
@@ -23589,7 +23601,7 @@ function Babel.bidi(head, ispar, hdir)
for r = first_on, q - 1 do
nodes[r][2] = temp
item = nodes[r][1] -- MIRRORING
- if Babel.mirroring_enabled and item.id == GLYPH
+ if Babel.mirroring_enabled and glyph_not_picture_font(item)
and temp == 'r' and characters[item.char] then
local font_mode = ''
if item.font > 0 and font.fonts[item.font].properties then
@Udi-Fogiel Thanks. I'll try to take a look when I have a little time.
@Udi-Fogiel After investigating, I realized \cancel
doesn’t use the picture
environment and builds the lines and vectors directly. Anyway, clearly mirroring must be disabled with ‘symbol’ fonts, and I’m even wondering if OML
and OMS
fonts should be included, too (or even U
and OMX
). For the moment, I’ll deal, following your suggestion, with the picture
fonts.
@jbezos
and I’m even wondering if
OML
andOMS
fonts should be included, too (or evenU
andOMX
). For the moment, I’ll deal, following your suggestion, with thepicture
fonts.
Maybe it will be useful to check for fonts with script=math
as well? might help with the interaction between \hbox
and equations.
See https://tex.stackexchange.com/questions/708472/the-cancel-package-doesnt-work-sometimes-in-hebrew.