summaryrefslogtreecommitdiff
path: root/src/fontloader/misc/fontloader-font-map.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2015-12-23 00:12:14 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2015-12-23 00:12:14 +0100
commite7fc73c0cb9a56c394d12f4967dbcffe93923afd (patch)
tree997ecb4230c241159a51d436cba4ffc49fcff8c1 /src/fontloader/misc/fontloader-font-map.lua
parentbd29de3d14bd6cfeb96111227f153cbccf0527a4 (diff)
parent34a02eaaaf87f6608fc7cb13d60f1217f36f6502 (diff)
downloadluaotfload-e7fc73c0cb9a56c394d12f4967dbcffe93923afd.tar.gz
Merge pull request #315 from phi-gamma/master
third round of fixes
Diffstat (limited to 'src/fontloader/misc/fontloader-font-map.lua')
-rw-r--r--src/fontloader/misc/fontloader-font-map.lua66
1 files changed, 65 insertions, 1 deletions
diff --git a/src/fontloader/misc/fontloader-font-map.lua b/src/fontloader/misc/fontloader-font-map.lua
index b645d9a..dc3f499 100644
--- a/src/fontloader/misc/fontloader-font-map.lua
+++ b/src/fontloader/misc/fontloader-font-map.lua
@@ -74,6 +74,71 @@ end
local f_single = formatters["%04X"]
local f_double = formatters["%04X%04X"]
+-- 0.684 0.661 0,672 0.650 : cache at lua end (more mem)
+-- 0.682 0,672 0.698 0.657 : no cache (moderate mem i.e. lua strings)
+-- 0.644 0.647 0.655 0.645 : convert in c (less mem in theory)
+
+-- local tounicodes = table.setmetatableindex(function(t,unicode)
+-- local s
+-- if unicode < 0x10000 then
+-- s = f_single(unicode)
+-- elseif unicode < 0x1FFFFFFFFF then
+-- s = f_double(floor(unicode/1024),unicode%1024+0xDC00)
+-- else
+-- s = false
+-- end
+-- t[unicode] = s
+-- return s
+-- end)
+--
+-- local function tounicode16(unicode,name)
+-- local s = tounicodes[unicode]
+-- if s then
+-- return s
+-- else
+-- report_fonts("can't convert %a in %a into tounicode",unicode,name)
+-- end
+-- end
+--
+-- local function tounicode16sequence(unicodes,name)
+-- local t = { }
+-- for l=1,#unicodes do
+-- local u = unicodes[l]
+-- local s = tounicodes[u]
+-- if s then
+-- t[l] = s
+-- else
+-- report_fonts ("can't convert %a in %a into tounicode",u,name)
+-- return
+-- end
+-- end
+-- return concat(t)
+-- end
+--
+-- local function tounicode(unicode,name)
+-- if type(unicode) == "table" then
+-- local t = { }
+-- for l=1,#unicode do
+-- local u = unicode[l]
+-- local s = tounicodes[u]
+-- if s then
+-- t[l] = s
+-- else
+-- report_fonts ("can't convert %a in %a into tounicode",u,name)
+-- return
+-- end
+-- end
+-- return concat(t)
+-- else
+-- local s = tounicodes[unicode]
+-- if s then
+-- return s
+-- else
+-- report_fonts("can't convert %a in %a into tounicode",unicode,name)
+-- end
+-- end
+-- end
+
local function tounicode16(unicode,name)
if unicode < 0x10000 then
return f_single(unicode)
@@ -126,7 +191,6 @@ local function tounicode(unicode,name)
end
end
-
local function fromunicode16(str)
if #str == 4 then
return tonumber(str,16)