summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-01-29 18:17:06 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2017-01-29 18:17:09 +0100
commit6b324ecd8b9f092e93ca12390ab4378ebe18dfe6 (patch)
tree54d1ee8290af60ccc6bca37ce7c84349f7626677
parent0baccc9623891f57a302d51d40a3d1c380d910d0 (diff)
downloadluaotfload-6b324ecd8b9f092e93ca12390ab4378ebe18dfe6.tar.gz
[db] scale optical sizes to pt
Fix #389
-rw-r--r--src/luaotfload-database.lua54
1 files changed, 33 insertions, 21 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index c6ccaa6..d0a2420 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -520,7 +520,7 @@ load_names = function (dry_run, no_rebuild)
names_version = names.version
if db_version ~= names_version then
logreport ("both", 0, "db",
- [[Version mismatch; expected %4.3f, got %4.3f.]],
+ [[Version mismatch; expected %d, got %d.]],
names_version, db_version)
if not fonts_reloaded then
logreport ("both", 0, "db", [[Force rebuild.]])
@@ -1322,28 +1322,40 @@ local load_font_file = function (filename, subfont)
return ret
end
---- rawdata -> (int * int * int | bool)
+local get_size_info do --- too many upvalues :/
+ local design_dimension_bp = true
+ local pt, bp = 7227.0, 7200.0
-local get_size_info = function (rawinfo)
- local design_size = rawinfo.design_size
- local design_range_top = rawinfo.design_range_top
- local design_range_bottom = rawinfo.design_range_bottom
+ --- rawdata -> (int * int * int | bool)
- local fallback_size = design_size ~= 0 and design_size
- or design_range_bottom ~= 0 and design_range_bottom
- or design_range_top ~= 0 and design_range_top
+ get_size_info = function (rawinfo)
+ local design_size = rawinfo.design_size
+ local design_range_top = rawinfo.design_range_top
+ local design_range_bottom = rawinfo.design_range_bottom
- if fallback_size then
- design_size = (design_size or fallback_size) / 10
- design_range_top = (design_range_top or fallback_size) / 10
- design_range_bottom = (design_range_bottom or fallback_size) / 10
- return {
- design_size, design_range_top, design_range_bottom,
- }
- end
+ local fallback_size = design_size ~= 0 and design_size
+ or design_range_bottom ~= 0 and design_range_bottom
+ or design_range_top ~= 0 and design_range_top
- return false
-end
+ if fallback_size then
+ design_size = (design_size or fallback_size) / 10
+ design_range_top = (design_range_top or fallback_size) / 10
+ design_range_bottom = (design_range_bottom or fallback_size) / 10
+
+ if design_dimension_bp == true then
+ design_size = (design_size * bp) / pt
+ design_range_top = (design_range_top * bp) / pt
+ design_range_bottom = (design_range_bottom * bp) / pt
+ end
+
+ return {
+ design_size, design_range_top, design_range_bottom,
+ }
+ end
+
+ return false
+ end
+end ---[local get_size_info]
--[[doc--
map_enlish_names -- Names-table for Lua fontloader objects. This
@@ -2605,7 +2617,7 @@ do
polluting the lookup table. What doesn’t work is, e. g.
treating weights > 500 as bold or allowing synonyms like
“heavy”, “black”.
- --]]--
+ --]]--
if width == normal_width then
if pfmweight == bold_weight then
--- bold spectrum matches
@@ -3599,7 +3611,7 @@ return {
fonts.definers = fonts.definers or { resolvers = { } }
names.blacklist = blacklist
- names.version = 2.9
+ names.version = 3 --- increase monotonically
names.data = nil --- contains the loaded database
names.lookups = nil --- contains the lookup cache