-- fix ligatures -- replace ligatures produced by tex4ht with their components -- this prevents problems with some readers local gsub = unicode.utf8.gsub function filter(s) local replaces = { ["fi"] = "fi", ["ffi"] = "ffi", ["fl"] = "fl", ["ffl"] = "ffl", ["ff"] = "ff" } return gsub(s, "([fiffiflfflff])",function (x) return replaces[x] or x end) end return filter