summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-22 21:17:44 +0000
committerKarl Berry <karl@freefriends.org>2019-05-22 21:17:44 +0000
commit31de23b1c0c3951f92b39f6456a725219639872e (patch)
treead54074f26ea2b12205f3a515552528ae0d564b8 /Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua
parent33287ebde9b1ee5d46becf889a8e562394db014e (diff)
luaotfload
git-svn-id: svn://tug.org/texlive/trunk@51190 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua58
1 files changed, 34 insertions, 24 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua
index 48bf117feb8..5387516b4d5 100644
--- a/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua
+++ b/Master/texmf-dist/tex/luatex/luaotfload/fontloader-font-one.lua
@@ -86,14 +86,16 @@ function afm.load(filename)
local name = file.removesuffix(file.basename(filename))
local data = containers.read(afm.cache,name)
local attr = lfs.attributes(filename)
- local size, time = attr and attr.size or 0, attr and attr.modification or 0
+ local size = attr and attr.size or 0
+ local time = attr and attr.modification or 0
--
local pfbfile = file.replacesuffix(name,"pfb")
local pfbname = resolvers.findfile(pfbfile,"pfb") or ""
if pfbname == "" then
pfbname = resolvers.findfile(file.basename(pfbfile),"pfb") or ""
end
- local pfbsize, pfbtime = 0, 0
+ local pfbsize = 0
+ local pfbtime = 0
if pfbname ~= "" then
local attr = lfs.attributes(pfbname)
pfbsize = attr.size or 0
@@ -324,7 +326,8 @@ local addthem = function(rawdata,ligatures)
local one = descriptions[unicodes[ligname]]
if one then
for _, pair in next, ligdata do
- local two, three = unicodes[pair[1]], unicodes[pair[2]]
+ local two = unicodes[pair[1]]
+ local three = unicodes[pair[2]]
if two and three then
local ol = one.ligatures
if ol then
@@ -392,7 +395,7 @@ local function enhance_add_extra_kerns(rawdata) -- using shcodes is not robust h
if what then
for complex, simple in next, what do
complex = unicodes[complex]
- simple = unicodes[simple]
+ simple = unicodes[simple]
if complex and simple then
local complexdescription = descriptions[complex]
if complexdescription then -- optional
@@ -445,7 +448,8 @@ local function adddimensions(data) -- we need to normalize afm to otf i.e. index
for unicode, description in next, data.descriptions do
local bb = description.boundingbox
if bb then
- local ht, dp = bb[4], -bb[2]
+ local ht = bb[4]
+ local dp = -bb[2]
if ht == 0 or ht < 0 then
-- no need to set it and no negative heights, nil == 0
else
@@ -479,8 +483,9 @@ local function copytotfm(data)
local filename = constructors.checkedfilename(resources)
local fontname = metadata.fontname or metadata.fullname
local fullname = metadata.fullname or metadata.fontname
- local endash = 0x0020 -- space
+ local endash = 0x2013
local emdash = 0x2014
+ local space = 0x0020 -- space
local spacer = "space"
local spaceunits = 500
--
@@ -492,28 +497,33 @@ local function copytotfm(data)
parameters.italicangle = italicangle
parameters.charwidth = charwidth
parameters.charxheight = charxheight
- -- same as otf
+ -- nearly the same as otf, catches
+ local d_endash = descriptions[endash]
+ local d_emdash = descriptions[emdash]
+ local d_space = descriptions[space]
+ if not d_space or d_space == 0 then
+ d_space = d_endash
+ end
+ if d_space then
+ spaceunits, spacer = d_space.width or 0, "space"
+ end
if properties.monospaced then
- if descriptions[endash] then
- spaceunits, spacer = descriptions[endash].width, "space"
- end
- if not spaceunits and descriptions[emdash] then
- spaceunits, spacer = descriptions[emdash].width, "emdash"
- end
- if not spaceunits and charwidth then
- spaceunits, spacer = charwidth, "charwidth"
+ if spaceunits == 0 and d_emdash then
+ spaceunits, spacer = d_emdash.width or 0, "emdash"
end
else
- if descriptions[endash] then
- spaceunits, spacer = descriptions[endash].width, "space"
- end
- if not spaceunits and charwidth then
- spaceunits, spacer = charwidth, "charwidth"
+ if spaceunits == 0 and d_endash then
+ spaceunits, spacer = d_emdash.width or 0, "endash"
end
end
- spaceunits = tonumber(spaceunits)
- if spaceunits < 200 then
- -- todo: warning
+ if spaceunits == 0 and charwidth then
+ spaceunits, spacer = charwidth or 0, "charwidth"
+ end
+ if spaceunits == 0 then
+ spaceunits = tonumber(spaceunits) or 500
+ end
+ if spaceunits == 0 then
+ spaceunits = 500
end
--
parameters.slant = 0
@@ -757,7 +767,7 @@ local function check_afm(specification,fullname)
if foundname == "" then
foundname = fonts.names.getfilename(fullname,"afm") or ""
end
- if foundname == "" and afm.autoprefixed then
+ if fullname and foundname == "" and afm.autoprefixed then
local encoding, shortname = match(fullname,"^(.-)%-(.*)$") -- context: encoding-name.*
if encoding and shortname and fonts.encodings.known[encoding] then
shortname = findbinfile(shortname,'afm') or "" -- just to be sure