[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Fix fontloader CFF2 support (9ced93d)
Marcel Fabian Krüger
tex at 2krueger.de
Wed Aug 26 11:24:41 CEST 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/9ced93db06b1b445c4ef07c55b4e1370cbe62579
>---------------------------------------------------------------
commit 9ced93db06b1b445c4ef07c55b4e1370cbe62579
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Wed Aug 26 03:50:15 2020 +0200
Fix fontloader CFF2 support
>---------------------------------------------------------------
9ced93db06b1b445c4ef07c55b4e1370cbe62579
...08-24.lua => fontloader-2020-08-24-PATCHED.lua} | 30 ++++++---
src/auto/luaotfload-status.lua | 74 +++++++++++-----------
src/fontloader/misc/fontloader-font-cff.lua | 28 +++++---
testfiles/aaaaa-luakern.tlg | 2 +-
4 files changed, 78 insertions(+), 56 deletions(-)
diff --git a/src/auto/fontloader-2020-08-24.lua b/src/auto/fontloader-2020-08-24-PATCHED.lua
similarity index 99%
copy from src/auto/fontloader-2020-08-24.lua
copy to src/auto/fontloader-2020-08-24-PATCHED.lua
index 47f7679..7d31334 100644
--- a/src/auto/fontloader-2020-08-24.lua
+++ b/src/auto/fontloader-2020-08-24-PATCHED.lua
@@ -9346,7 +9346,7 @@ end
end --- [luaotfload, fontloader-2020-08-24.lua scope for “font-ott”] ---
-do --- [luaotfload, fontloader-2020-08-24.lua scope for “font-cff” 23ef8e919a925a95f3745f74f8cdc264] ---
+do --- [luaotfload, fontloader-2020-08-24.lua scope for “font-cff” 7e6d32c1bd8adfb6d826b576c40c5cf4] ---
if not modules then modules={} end modules ['font-cff']={
version=1.001,
@@ -11181,8 +11181,8 @@ do
processshape(tab,index-1)
end
end
-local function readglobals(f,data)
- local routines=readlengths(f)
+local function readglobals(f,data,version)
+ local routines=readlengths(f,version=="cff2")
for i=1,#routines do
routines[i]=readbytetable(f,routines[i])
end
@@ -11236,14 +11236,14 @@ local function readprivates(f,data)
private.data=readstring(f,private.size)
end
end
-local function readlocals(f,data,dictionary)
+local function readlocals(f,data,dictionary,version)
local header=data.header
local private=dictionary.private
if private then
local subroutineoffset=private.data.subroutines
if subroutineoffset~=0 then
setposition(f,header.offset+private.offset+subroutineoffset)
- local subroutines=readlengths(f)
+ local subroutines=readlengths(f,version=="cff2")
for i=1,#subroutines do
subroutines[i]=readbytetable(f,subroutines[i])
end
@@ -11295,7 +11295,7 @@ readers.parsecharstrings=parsecharstrings
local function readnoselect(f,fontdata,data,glyphs,doshapes,version,streams)
local dictionaries=data.dictionaries
local dictionary=dictionaries[1]
- readglobals(f,data)
+ readglobals(f,data,version)
readcharstrings(f,data,version)
if version=="cff2" then
dictionary.charset=nil
@@ -11303,9 +11303,19 @@ local function readnoselect(f,fontdata,data,glyphs,doshapes,version,streams)
readencodings(f,data)
readcharsets(f,data,dictionary)
end
+ local cid=dictionary.cid
+ local fdarray=cid and cid.fdarray
+ if fdarray and not dictionary.private then
+ setposition(f,data.header.offset+fdarray)
+ local dictionaries=readlengths(f,version=="cff2")
+ assert(#dictionaries==1)
+ dictionaries[1]=readstring(f,dictionaries[1])
+ parsedictionaries(data,dictionaries)
+ dictionary.private=dictionaries[1].private
+ end
readprivates(f,data)
parseprivates(data,data.dictionaries)
- readlocals(f,data,dictionary)
+ readlocals(f,data,dictionary,version)
startparsing(fontdata,data,streams)
parsecharstrings(fontdata,data,glyphs,doshapes,version,streams)
stopparsing(fontdata,data)
@@ -11316,7 +11326,7 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
local dictionary=dictionaries[1]
local cid=dictionary.cid
local cidselect=cid and cid.fdselect
- readglobals(f,data)
+ readglobals(f,data,version)
readcharstrings(f,data,version)
if version~="cff2" then
readencodings(f,data)
@@ -11360,7 +11370,7 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
local cidarray=cid.fdarray
if cidarray then
setposition(f,header.offset+cidarray)
- local dictionaries=readlengths(f)
+ local dictionaries=readlengths(f,version=="cff2")
for i=1,#dictionaries do
dictionaries[i]=readstring(f,dictionaries[i])
end
@@ -11368,7 +11378,7 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
cid.dictionaries=dictionaries
readcidprivates(f,data)
for i=1,#dictionaries do
- readlocals(f,data,dictionaries[i])
+ readlocals(f,data,dictionaries[i],version)
end
startparsing(fontdata,data,streams)
for i=1,#charstrings do
diff --git a/src/auto/luaotfload-status.lua b/src/auto/luaotfload-status.lua
index 4d30903..e302962 100644
--- a/src/auto/luaotfload-status.lua
+++ b/src/auto/luaotfload-status.lua
@@ -1,6 +1,6 @@
return {
["hashes"]={
- { "fontloader-2020-08-24.lua", "d6e4f8ba6058cacdbbc5b3e582bec2e4" },
+ { "fontloader-2020-08-24-PATCHED.lua", "b1901b1c9173994dd1eec16363588612" },
{ "fontloader-util-fil.lua", "aae2a2add764144bb58dd8216fd59260" },
{ "fontloader-util-str.lua", "c975ff7bbd178163cf47d9e9296c8b4b" },
{ "fontloader-l-unicode.lua", "f368874f11f3c525de5864fd413e4b24" },
@@ -26,25 +26,26 @@ return {
{ "fontloader-font-imp-italics.lua", "ae563638fa29a4ff3e8e4d1e81fd35ae" },
{ "fontloader-font-imp-ligatures.lua", "26ffcf089391445f7af59536c8814364" },
{ "fontloader-font-imp-tex.lua", "ceb087ef6fa2f89aed7179f60ddf8f35" },
+ { "fontloader-font-shp.lua", "7f10735cfaad837b40172016e3e0f048" },
{ "fontloader-font-def.lua", "bdb0ac50a917b5eca4c4065a49ee49d1" },
{ "fontloader-font-lua.lua", "1fbfdf7b689b2bdfd0e3bb9bf74ce136" },
{ "fontloader-font-afk.lua", "9da14e0fb22129c053acc599d1312544" },
{ "fontloader-font-one.lua", "5a2f244c88c8178e997c16a9b628bb6f" },
{ "fontloader-font-onr.lua", "6d161533f3437435e12a0ad64866df44" },
- { "fontloader-font-otc.lua", "0f12230ea07b5151f75d52726977e91f" },
{ "fontloader-font-ocl.lua", "797b5c71bf819c5f4fb314a4d646e9a7" },
{ "fontloader-font-osd.lua", "73c9531c79df5ada320cb20777f7ed49" },
+ { "fontloader-font-otc.lua", "0f12230ea07b5151f75d52726977e91f" },
{ "fontloader-font-ots.lua", "f018ae1f355a8ef5c8d403cc5489e3d3" },
{ "fontloader-font-ota.lua", "ad1d5de06400f88829509e1f3ff2b473" },
+ { "fontloader-font-oup.lua", "6f46aa00ae1c20c43f8ffaf329dc8695" },
{ "fontloader-font-otj.lua", "8de59cb9b043e5f73c6b9f7cc8f6978e" },
{ "fontloader-font-oto.lua", "2b1d6bc63b2ebf8f2655a15e1cda6541" },
{ "fontloader-font-otl.lua", "b168cf69300873d6668203bc7afe1f56" },
- { "fontloader-font-oup.lua", "6f46aa00ae1c20c43f8ffaf329dc8695" },
- { "fontloader-font-dsp.lua", "5d6528c0673b7651600ca6b763b51df5" },
- { "fontloader-font-ttf.lua", "786a535ba0385446b7015260388bc415" },
- { "fontloader-font-cff.lua", "23ef8e919a925a95f3745f74f8cdc264" },
{ "fontloader-font-ott.lua", "673ed11e1d159997f535bfec5fa73808" },
{ "fontloader-font-oti.lua", "309a75f9c14b77d87e94eba827dc4e71" },
+ { "fontloader-font-dsp.lua", "5d6528c0673b7651600ca6b763b51df5" },
+ { "fontloader-font-ttf.lua", "786a535ba0385446b7015260388bc415" },
+ { "fontloader-font-cff.lua", "7e6d32c1bd8adfb6d826b576c40c5cf4" },
{ "fontloader-font-otr.lua", "64dcbbc7107538723990e1119a80a9f8" },
{ "fontloader-font-vfc.lua", "a81c29eda98cd62cbebdb6c93544b50d" },
{ "fontloader-font-map.lua", "cfccac81981f9c427b32f155245a3738" },
@@ -55,43 +56,44 @@ return {
{ "fontloader-reference.lua", "5f3a01fd0b99943b971c146f19bde2b7" },
{ "fontloader-basics-gen.lua", "e470c13b1ed41e38932e93518219ad74" },
{ "mktests", "918cb50be9ee8bd645ac1a27dc501e8c" },
- { "mkstatus", "9767ba98426c399d590b532664f81df5" },
+ { "mkstatus", "b79990be06fd91494ed43ad432a4616f" },
{ "mkcharacters", "bfca0e96e1e351afe7077502f9595af9" },
{ "mkglyphlist", "7a8a8fdc0eac7fac2f13ec8f4e8e7aa9" },
{ "mkimport", "7d62f1042e548f8b9368f26b9ba4be5c" },
- { "luaotfload-glyphlist.lua", "558bdefe1121b6d1b84b14eda8370755" },
+ { "luaotfload-glyphlist.lua", "3298663cfb661839c4744b84308fc6b2" },
{ "luaotfload-characters.lua", "76415ca3ede312cad6e09038323489ae" },
- { "luaotfload-tounicode.lua", "64220c90c41e5bc6061dc34e6e4dc82c" },
- { "luaotfload-unicode.lua", "df938c2f24624b5e7d48dc8d6d06b8dd" },
- { "luaotfload-resolvers.lua", "7e50f1643388e5f73673f118c9c0884c" },
- { "luaotfload-parsers.lua", "735d295ac36b8c0024249ebcc7769276" },
- { "luaotfload-fallback.lua", "c47744b05fba00bd3e3157a0692a27da" },
- { "luaotfload-szss.lua", "39906d565d05bc1dee282ca2caf9a700" },
- { "luaotfload-scripts.lua", "652cd957c45d0c2652729678db656029" },
- { "luaotfload-multiscript.lua", "da51d8a7a91c92925eff860f0795eca8" },
- { "luaotfload-loaders.lua", "1fd5e1e0b34520b5535476a8ccfda28e" },
- { "luaotfload-harf-plug.lua", "e94afcbb6a112111f3149167f4f46ddf" },
- { "luaotfload-harf-define.lua", "2eb1cd7d190043d7da8c5128a2ae7ab2" },
- { "luaotfload-notdef.lua", "7c3c56e348389b87516d52093830a028" },
- { "luaotfload-embolden.lua", "fb7be0711093c74e09e905aa50873b52" },
- { "luaotfload-letterspace.lua", "46ff24488542476e66b32eca951b1be1" },
- { "luaotfload-features.lua", "bf78bc274e8ea9579664b9a1256cc135" },
- { "luaotfload-database.lua", "593c9e5db53e9cc35299ad72de4cf85a" },
- { "luaotfload-configuration.lua", "4346f74ddc373ecab0e9fbc5e9696b22" },
- { "luaotfload-colors.lua", "37480e277ebaab23d2c569ecf76035a4" },
- { "luaotfload-auxiliary.lua", "b243e3c6c0a11f9d37d24995c28c31f5" },
- { "luaotfload-filelist.lua", "209109f6d3b5caa86cab06b3552b11ca" },
- { "luaotfload-tool.lua", "f330ddd6dd5c0c4b708778f3bf1dea94" },
- { "luaotfload-diagnostics.lua", "45e7b420fa9ddb9951ac632954989c5c" },
- { "luaotfload-log.lua", "252e5092ab8fea6273655f4b8b80bc1e" },
- { "luaotfload-init.lua", "c11717c6e14a2e99cce767b763a81022" },
- { "luaotfload-main.lua", "f56de701fdd2b4dd23728800d1c90d3a" },
+ { "luaotfload-dvi.lua", "4079de9e6ed6a518c2e00d22ff5acd63" },
+ { "luaotfload-tounicode.lua", "c6a89b780fa4f2af7b6ec1c2fbb22a61" },
+ { "luaotfload-unicode.lua", "ed990d8001ab53adac7a5188373bd382" },
+ { "luaotfload-resolvers.lua", "8eac9cd5bb44e2d081a593ab6047443d" },
+ { "luaotfload-parsers.lua", "4322cafe7229c6fbcfdf6b25c5daf651" },
+ { "luaotfload-fallback.lua", "b1c4ad9e80a1ba2eb06d375f1e77914e" },
+ { "luaotfload-szss.lua", "25de3bbf6b37330c59c45a1ac41e7461" },
+ { "luaotfload-scripts.lua", "214eed83b53214b7ceae1e319a52795b" },
+ { "luaotfload-multiscript.lua", "06adb40c709d37ecec7d43c354017d2b" },
+ { "luaotfload-loaders.lua", "9ea3aa64afe6db77ad232cadcb349d2a" },
+ { "luaotfload-harf-plug.lua", "e88a3c0252c2cab0c385d01a3f867221" },
+ { "luaotfload-harf-define.lua", "9345c9886c3e584bda3e01e68dca2ad7" },
+ { "luaotfload-notdef.lua", "1126033a5e95da6930e81ebd71a8a26d" },
+ { "luaotfload-embolden.lua", "bdfdb40da1e921da21482c54f0e3acb6" },
+ { "luaotfload-letterspace.lua", "8994f5aa037935b818a05c601c069952" },
+ { "luaotfload-features.lua", "ccc0222c95186589dd1fdf0421283a3c" },
+ { "luaotfload-database.lua", "896b0b3838a25e836cb5713cbedc9665" },
+ { "luaotfload-configuration.lua", "213da1ff98aadd118bc060c29f7d725d" },
+ { "luaotfload-colors.lua", "0b6110007b74cba45a893c9878bc46b4" },
+ { "luaotfload-auxiliary.lua", "5e7adfa8235e9d48795c5f312bcb2731" },
+ { "luaotfload-filelist.lua", "2008e3ec77d695ef60c92c9ac5a846bf" },
+ { "luaotfload-tool.lua", "c0fd96e9da6a58fa06476249f16888bd" },
+ { "luaotfload-diagnostics.lua", "e4e6a5d2ddd6af62d1c4c5b326f77e37" },
+ { "luaotfload-log.lua", "55208a594f674e9962eaabfa4a116447" },
+ { "luaotfload-init.lua", "a13df5062713c503d3f73d90d13751d9" },
+ { "luaotfload-main.lua", "935a147144fabdfcd5336f9d45724b1f" },
},
["notes"]={
["committer"]="Marcel Fabian Krüger <tex at 2krueger.de>",
["description"]="v3.15-dev/2020-08-24",
- ["loader"]="fontloader-2020-08-24.lua",
- ["revision"]="5a43385437b6a30d4e2d631cb2e243917264baa6",
- ["timestamp"]="2020-08-24 14:55:30 +0200",
+ ["loader"]="fontloader-2020-08-24-PATCHED.lua",
+ ["revision"]="8bb0ed9f2c629d14659f6444c8f992fd487b8752",
+ ["timestamp"]="2020-08-26 03:53:22 +0200",
},
}
\ No newline at end of file
diff --git a/src/fontloader/misc/fontloader-font-cff.lua b/src/fontloader/misc/fontloader-font-cff.lua
index c2cf0e6..d00637b 100644
--- a/src/fontloader/misc/fontloader-font-cff.lua
+++ b/src/fontloader/misc/fontloader-font-cff.lua
@@ -2265,8 +2265,8 @@ do
end
-local function readglobals(f,data)
- local routines = readlengths(f)
+local function readglobals(f,data,version)
+ local routines = readlengths(f,version == "cff2")
for i=1,#routines do
routines[i] = readbytetable(f,routines[i])
end
@@ -2324,14 +2324,14 @@ local function readprivates(f,data)
end
end
-local function readlocals(f,data,dictionary)
+local function readlocals(f,data,dictionary,version)
local header = data.header
local private = dictionary.private
if private then
local subroutineoffset = private.data.subroutines
if subroutineoffset ~= 0 then
setposition(f,header.offset+private.offset+subroutineoffset)
- local subroutines = readlengths(f)
+ local subroutines = readlengths(f,version=="cff2")
for i=1,#subroutines do
subroutines[i] = readbytetable(f,subroutines[i])
end
@@ -2394,7 +2394,7 @@ readers.parsecharstrings = parsecharstrings -- used in font-onr.lua (type 1)
local function readnoselect(f,fontdata,data,glyphs,doshapes,version,streams)
local dictionaries = data.dictionaries
local dictionary = dictionaries[1]
- readglobals(f,data)
+ readglobals(f,data,version)
readcharstrings(f,data,version)
if version == "cff2" then
dictionary.charset = nil
@@ -2402,9 +2402,19 @@ local function readnoselect(f,fontdata,data,glyphs,doshapes,version,streams)
readencodings(f,data)
readcharsets(f,data,dictionary)
end
+ local cid = dictionary.cid
+ local fdarray = cid and cid.fdarray
+ if fdarray and not dictionary.private then
+ setposition(f,data.header.offset+fdarray)
+ local dictionaries = readlengths(f,version=="cff2")
+ assert(#dictionaries == 1)
+ dictionaries[1] = readstring(f,dictionaries[1])
+ parsedictionaries(data,dictionaries)
+ dictionary.private = dictionaries[1].private
+ end
readprivates(f,data)
parseprivates(data,data.dictionaries)
- readlocals(f,data,dictionary)
+ readlocals(f,data,dictionary,version)
startparsing(fontdata,data,streams)
parsecharstrings(fontdata,data,glyphs,doshapes,version,streams)
stopparsing(fontdata,data)
@@ -2416,7 +2426,7 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
local dictionary = dictionaries[1]
local cid = dictionary.cid
local cidselect = cid and cid.fdselect
- readglobals(f,data)
+ readglobals(f,data,version)
readcharstrings(f,data,version)
if version ~= "cff2" then
readencodings(f,data)
@@ -2462,7 +2472,7 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
local cidarray = cid.fdarray
if cidarray then
setposition(f,header.offset+cidarray)
- local dictionaries = readlengths(f)
+ local dictionaries = readlengths(f, version == "cff2")
for i=1,#dictionaries do
dictionaries[i] = readstring(f,dictionaries[i])
end
@@ -2470,7 +2480,7 @@ local function readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
cid.dictionaries = dictionaries
readcidprivates(f,data)
for i=1,#dictionaries do
- readlocals(f,data,dictionaries[i])
+ readlocals(f,data,dictionaries[i],version)
end
startparsing(fontdata,data,streams)
for i=1,#charstrings do
diff --git a/testfiles/aaaaa-luakern.tlg b/testfiles/aaaaa-luakern.tlg
index f38e6a4..de5bc94 100644
--- a/testfiles/aaaaa-luakern.tlg
+++ b/testfiles/aaaaa-luakern.tlg
@@ -1,6 +1,6 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
-3.15-dev with fontloaderxxx2020xxx08xxx24.lua
+3.15-dev with fontloaderxxx2020xxx08xxx24xxxPATCHED.lua
Completed box being shipped out [1]
\vbox(633.0+0.0)x407.0, direction TLT
.\glue 16.0
More information about the latex3-commits
mailing list.