[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: More robust tounicode mapping in harf mode (97b97ab)

Marcel Fabian Krüger tex at 2krueger.de
Sun Aug 14 14:20:55 CEST 2022


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/97b97ab4b5ef92ce862ee7ae2c37d20562bffe76

>---------------------------------------------------------------

commit 97b97ab4b5ef92ce862ee7ae2c37d20562bffe76
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Aug 14 14:20:55 2022 +0200

    More robust tounicode mapping in harf mode


>---------------------------------------------------------------

97b97ab4b5ef92ce862ee7ae2c37d20562bffe76
 src/luaotfload-harf-define.lua |  1 +
 src/luaotfload-harf-plug.lua   |  2 +-
 testfiles-harf/colored.tpf     | 38 +++++++++++++++++++-------------------
 3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/luaotfload-harf-define.lua b/src/luaotfload-harf-define.lua
index a1b07b4..c222e0b 100644
--- a/src/luaotfload-harf-define.lua
+++ b/src/luaotfload-harf-define.lua
@@ -394,6 +394,7 @@ local function scalefont(data, spec)
   local unicodes = data.unicodes
   for uni, gid in next, unicodes do
     characters[uni] = characters[gid_offset + gid]
+    characters[uni].tounicode = uni
   end
 
   -- Select font palette, we support `palette=index` option, and load the first
diff --git a/src/luaotfload-harf-plug.lua b/src/luaotfload-harf-plug.lua
index ed9311e..30826a2 100644
--- a/src/luaotfload-harf-plug.lua
+++ b/src/luaotfload-harf-plug.lua
@@ -1130,7 +1130,7 @@ local function set_tounicode()
           if unicode then
             newcharacters[unicode] = character
           end
-          character.tounicode = glyph.tounicode or "FFFD"
+          character.tounicode = glyph.tounicode or unicode or "FFFD"
           character.used = true
         end
       end
diff --git a/testfiles-harf/colored.tpf b/testfiles-harf/colored.tpf
index b9282b4..8bc3684 100644
--- a/testfiles-harf/colored.tpf
+++ b/testfiles-harf/colored.tpf
@@ -2276,13 +2276,13 @@ endcodespacerange
 0 beginbfrange
 endbfrange
 21 beginbfchar
-<002B> <FFFD>
-<002C> <FFFD>
-<002D> <FFFD>
-<002E> <FFFD>
-<002F> <FFFD>
-<0030> <FFFD>
-<0031> <FFFD>
+<002B> <0061>
+<002C> <0062>
+<002D> <0063>
+<002E> <0064>
+<002F> <0065>
+<0030> <0066>
+<0031> <0067>
 <0124> <FFFD>
 <0125> <FFFD>
 <0138> <FFFD>
@@ -2353,23 +2353,23 @@ endcodespacerange
 endbfrange
 100 beginbfchar
 <0008> <0031>
-<0026> <FFFD>
-<0028> <FFFD>
-<002B> <FFFD>
+<0026> <0623>
+<0028> <0625>
+<002B> <0628>
 <0034> <0631>
 <003A> <0637>
 <0041> <0643>
 <0043> <0645>
 <0046> <0648>
-<004C> <FFFD>
-<004D> <FFFD>
-<004E> <FFFD>
-<004F> <FFFD>
-<0065> <FFFD>
-<0071> <FFFD>
-<0075> <FFFD>
-<0078> <FFFD>
-<00AB> <FFFD>
+<004C> <064E>
+<004D> <064F>
+<004E> <0650>
+<004F> <0651>
+<0065> <0671>
+<0071> <06DD>
+<0075> <06E1>
+<0078> <06E4>
+<00AB> <FDFD>
 <0134> <0644>
 <0135> <0644>
 <0136> <0647>





More information about the latex3-commits mailing list.