Skip to content

Commit

Permalink
Merge 3f1abfa into 84771ae
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia committed Dec 29, 2023
2 parents 84771ae + 3f1abfa commit f252727
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 6 additions & 2 deletions languages/fr.lua
Expand Up @@ -223,9 +223,13 @@ function SILE.nodeMakers.fr:iterator (items)
local removed = 0
for k = 1, #items do
if self:mustRemove(k, items) then
removed = removed + 1
-- the index is actually a character position in the byte stream.
-- So we need to take its actual byte length into account.
-- For instance, U+00A0 NBSP is 2 bytes long (0xC2 0xA0) in UTF-8.
removed = removed + string.len(items[k].text)
else
items[k].index = items[k].index - removed -- index has changed due to removals
-- index has changed due to removals
items[k].index = items[k].index - removed
table.insert(cleanItems, items[k])
end
end
Expand Down
10 changes: 2 additions & 8 deletions tests/feat-unicode-nbsp.expected
Expand Up @@ -155,19 +155,13 @@ T 41 85 68 81 111 68 76 86 w=34.3799 (Français)
Mx 50.5831
T 34 w=4.3311 (?)
Mx 57.5711
T 41 85 68 81 111 68 76 w=30.5176 (Françai)
Mx 88.0887
T 86 w=3.8623 (s)
T 41 85 68 81 111 68 76 86 w=34.3799 (Français)
Mx 94.6080
T 29 w=2.2900 (:)
Mx 99.5550
T 169 w=4.8535 («)
Mx 106.5269
T 41 85 68 81 111 w=23.2178 (Franç)
Mx 129.7447
T 68 w=4.5898 (a)
Mx 134.3345
T 76 86 w=6.5723 (is)
T 41 85 68 81 111 68 76 86 w=34.3799 (Français)
Mx 142.2281
T 4 w=2.7197 (!)
Mx 147.0662
Expand Down

0 comments on commit f252727

Please sign in to comment.