Skip to content

Commit

Permalink
fix(languages): Liang hyphenation shall handle UTF8 properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed May 6, 2024
1 parent c877f3d commit ef56154
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/hyphenator-liang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ local function loadPatterns(hyphenator, language)
end

SILE._hyphenate = function (self, text)
if string.len(text) < self.minWord then return { text } end
local points = self.exceptions[text:lower()]
if luautf8.len(text) < self.minWord then return { text } end
local lowertext = luautf8.lower(text)
local points = self.exceptions[lowertext]
local word = SU.splitUtf8(text)
if not points then
points = SU.map(function ()return 0 end, word)
local work = SU.map(string.lower, word)
points = SU.map(function () return 0 end, word)
local work = SU.map(luautf8.lower, word)
table.insert(work, ".")
table.insert(work, 1, ".")
table.insert(points, 1, 0)
Expand Down

0 comments on commit ef56154

Please sign in to comment.