summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luaotfload/fontloader-font-shp.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-08-21 03:03:40 +0000
committerNorbert Preining <norbert@preining.info>2023-08-21 03:03:40 +0000
commitf4e4c48e897bec27fd8d07ba278c03c6f0c64336 (patch)
treeb8c47431b940055b5095271c39a9db123375efd6 /macros/luatex/generic/luaotfload/fontloader-font-shp.lua
parent53b22757814343c6071be2e64dc0639f7afc5468 (diff)
CTAN sync 202308210303
Diffstat (limited to 'macros/luatex/generic/luaotfload/fontloader-font-shp.lua')
-rw-r--r--macros/luatex/generic/luaotfload/fontloader-font-shp.lua17
1 files changed, 14 insertions, 3 deletions
diff --git a/macros/luatex/generic/luaotfload/fontloader-font-shp.lua b/macros/luatex/generic/luaotfload/fontloader-font-shp.lua
index 2ca3011a5b..197a3f1ccb 100644
--- a/macros/luatex/generic/luaotfload/fontloader-font-shp.lua
+++ b/macros/luatex/generic/luaotfload/fontloader-font-shp.lua
@@ -17,7 +17,7 @@ local pfb = fonts.handlers.pfb
local hashes = fonts.hashes
local identifiers = hashes.identifiers
-local version = otf.version or 0.011
+local version = otf.version or 0.015
local shapescache = containers.define("fonts", "shapes", version, true)
local streamscache = containers.define("fonts", "streams", version, true)
@@ -150,6 +150,8 @@ end
local readers = otf.readers
local cleanname = otf.readers.helpers.cleanname
+-- todo: shared hash for this but not accessed often
+
local function makehash(filename,sub,instance)
local name = cleanname(file.basename(filename))
if instance then
@@ -234,17 +236,21 @@ local function loadstreams(cache,filename,sub,instance)
if data then
local glyphs = data.glyphs
local streams = { }
+ -- local widths = { }
if glyphs then
for i=0,#glyphs do
local glyph = glyphs[i]
if glyph then
streams[i] = glyph.stream or ""
+ -- widths [i] = glyph.width or 0
else
streams[i] = ""
+ -- widths [i] = 0
end
end
end
data.streams = streams
+ -- data.widths = widths -- maybe more reliable!
data.glyphs = nil
data.size = size
data.format = data.format or (kind == "otf" and "opentype") or "truetype"
@@ -259,8 +265,11 @@ local function loadstreams(cache,filename,sub,instance)
local names, encoding, streams, metadata = pfb.loadvector(filename,false,true)
if streams then
local fontbbox = metadata.fontbbox or { 0, 0, 0, 0 }
+ -- local widths = { }
for i=0,#streams do
- streams[i] = streams[i].stream or "\14"
+ local s = streams[i]
+ streams[i] = s.stream or "\14"
+ -- widths [i] = s.width or 0
end
data = {
filename = filename,
@@ -268,6 +277,7 @@ local function loadstreams(cache,filename,sub,instance)
time = time,
format = "type1",
streams = streams,
+ -- widths = widths,
fontheader = {
fontversion = metadata.version,
units = 1000, -- can this be different?
@@ -346,7 +356,8 @@ local function getstreamhash(fontid)
local fontdata = identifiers[fontid]
if fontdata then
local properties = fontdata.properties
- return makehash(properties.filename,properties.subfont,properties.instance), fontdata
+ local fonthash = makehash(properties.filename,properties.subfont,properties.instance)
+ return fonthash, fontdata
end
end