From 94353abbdd9ce19c6ea417288bac4c97e6e1d3b3 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 31 Jan 2017 21:49:31 +0100 Subject: =?UTF-8?q?[parsers]=20remove=20=E2=80=9Cexperimental=E2=80=9D=20f?= =?UTF-8?q?lag=20from=20kpse,=20my=20lookups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These have stabilized a long time ago and will be supported. --- src/luaotfload-parsers.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua index ffb6401..c2b4f2e 100644 --- a/src/luaotfload-parsers.lua +++ b/src/luaotfload-parsers.lua @@ -615,9 +615,7 @@ local prefixed = P"name:" * ws * Cg(fontname, "name") --- we’ll emit a warning. + P"file:" * ws * Cg(unsupported, "path") + P"file:" * ws * Cg(fontname, "file") ---- EXPERIMENTAL: kpse lookup + P"kpse:" * ws * Cg(fontname, "kpse") ---- EXPERIMENTAL: custom lookup + P"my:" * ws * Cg(fontname, "my") local unprefixed = Cg(fontname, "anon") local path_lookup = lbrk * Cg(C((1-rbrk)^1), "path") * rbrk -- cgit v1.2.3 From 7250ac958d842f45d28220db87203506d3ae65c0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 2 Feb 2017 07:38:03 +0100 Subject: [features] remove unneeded tlig features Fix #397 These four features should not be inserted automatically. --- src/luaotfload-features.lua | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src') diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua index a57aac3..5c35031 100644 --- a/src/luaotfload-features.lua +++ b/src/luaotfload-features.lua @@ -1288,10 +1288,6 @@ local tlig_specification = { data = { [0x2013] = {0x002D, 0x002D}, -- endash [0x2014] = {0x002D, 0x002D, 0x002D}, -- emdash - [0x201C] = {0x2018, 0x2018}, -- quotedblleft - [0x201D] = {0x2019, 0x2019}, -- quotedblright - [0x00A1] = {0x0021, 0x2018}, -- exclamdown - [0x00BF] = {0x003F, 0x2018}, -- questiondown --- next three originate in T1 encoding; Xetex applies --- them too [0x201E] = {0x002C, 0x002C}, -- quotedblbase @@ -1302,19 +1298,6 @@ local tlig_specification = { order = { "tlig" }, prepend = true, }, - { - type = "ligature", - features = everywhere, - data = { - [0x201C] = {0x0060, 0x0060}, -- quotedblleft - [0x201D] = {0x0027, 0x0027}, -- quotedblright - [0x00A1] = {0x0021, 0x0060}, -- exclamdown - [0x00BF] = {0x003F, 0x0060}, -- questiondown - }, - flags = noflags, - order = { "tlig" }, - prepend = true, - }, } local rot13_specification = { -- cgit v1.2.3 From 184148b97861cb13728c1b7d6a8d8e909fc4cf90 Mon Sep 17 00:00:00 2001 From: Yan Zhou Date: Thu, 2 Feb 2017 19:30:23 +0800 Subject: =?UTF-8?q?Avoid=20more=20than=20one=20`inrange`=20when=20there?= =?UTF-8?q?=E2=80=99s=20no=20overlap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/luaotfload-database.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 5e4fd7a..97fdfc1 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -928,7 +928,7 @@ local choose_size = function (sizes, askedsize) --- exact match, this is what we were looking for exact = index goto skip - elseif askedsize < low then + elseif askedsize <= low then --- below range, add to the norange table local d = low - askedsize norange [#norange + 1] = { d, index } -- cgit v1.2.3 From 228e15f4a8452e3120e1fca4f5cdcda3bdf8bf82 Mon Sep 17 00:00:00 2001 From: Yan Zhou Date: Thu, 2 Feb 2017 19:50:32 +0800 Subject: use design size to calculate the distance for `inrange` --- src/luaotfload-database.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 5e4fd7a..c494318 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -938,10 +938,19 @@ local choose_size = function (sizes, askedsize) norange [#norange + 1] = { d, index } else --- range match - local d = ((low + high) / 2) - askedsize + local d = 0 + + -- should always be true. Just in case there's some + -- weried fonts out there + if dsnsize > low and dsnsize < high then + d = dsnsize - askedsize + else + d = ((low + high) / 2) - askedsize + end if d < 0 then d = -d end + inrange [#inrange + 1] = { d, index } end end -- cgit v1.2.3 From 529578f58c8221f7fe3deaceecec3a4cf3ff8f2d Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 2 Feb 2017 22:59:15 +0100 Subject: [db] fix design size scaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As discussed in issue #398. Ad futuram rei memoriam the gist of it: - For the index, all values are scaled (decipoints * sp) / 10 * (7227 / 7200). - The ``bp`` case (the default, OT-standard), needs no conversion because it matches how values are stored in the index. - The ``pt`` case essentially reverts the bp→pt part of scaling done for the database by scaling the asked size by the same factor, i. e. by 7227 / 7200. - The ``dd`` needs an extra 1238 / 1157. Requesting a font at 10pt will then: - ask for a size of 655360 for ``bp`` / default; - ask for 657817 for ``pt``; - ask for 703870 for ``dd``. --- src/luaotfload-database.lua | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 5e4fd7a..fbe0961 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -1042,22 +1042,27 @@ local lookup_fontname = function (specification, name, style) return nil, nil end -local design_size_dimension -local set_size_dimension +local design_size_dimension --- scale asked size if not using bp +local set_size_dimension --- called from config do - --- cf. TeXbook p. 57 + --- cf. TeXbook p. 57; the index stores sizes pre-scaled from bp to + --- sp. This allows requesting sizes we got from the TeX end + --- without further conversion. For the other options *pt* and *dd* + --- we scale the requested size as though the value in the font was + --- specified in the requested unit. + local dimens = { - pt = function (v) return v end, - bp = function (v) return (v * 7227) / 7200 end, - dd = function (v) return (v * 1238) / 1157 end, + bp = false, + pt = function (v) return v * (7227 / 7200) end, + dd = function (v) return v * (7227 / 7200) * (1238 / 1157) end, } design_size_dimension = dimens.bp set_size_dimension = function (dim) local f = dimens [dim] - if f then + if f ~= nil then logreport ("both", 4, "db", "Interpreting design sizes as %q, factor %.6f.", dim, f (1.000000)) @@ -1135,7 +1140,10 @@ lookup_font_name = function (specification) askedsize = 0 end end - askedsize = design_size_dimension (askedsize) + + if design_size_dimension ~= false then + askedsize = design_size_dimension (askedsize) + end resolved, subfont = lookup_familyname (specification, name, @@ -1350,9 +1358,16 @@ local load_font_file = function (filename, subfont) return ret end +--- Design sizes in the fonts are specified in decipoints. For the +--- index these values are prescaled to sp which is what we’re dealing +--- with at the TeX end. + local get_size_info do --- too many upvalues :/ --- rawdata -> (int * int * int | bool) + local sp = 2^16 -- pt + local bp = 7227 / 7200 -- pt + get_size_info = function (rawinfo) local design_size = rawinfo.design_size local design_range_top = rawinfo.design_range_top @@ -1363,13 +1378,13 @@ local get_size_info do --- too many upvalues :/ or design_range_top ~= 0 and design_range_top if fallback_size then - design_size = ((design_size or fallback_size) * 2^16) / 10 - design_range_top = ((design_range_top or fallback_size) * 2^16) / 10 - design_range_bottom = ((design_range_bottom or fallback_size) * 2^16) / 10 + design_size = ((design_size or fallback_size) * sp) / 10 + design_range_top = ((design_range_top or fallback_size) * sp) / 10 + design_range_bottom = ((design_range_bottom or fallback_size) * sp) / 10 - design_size = (design_size * 7227) / 7200 - design_range_top = (design_range_top * 7227) / 7200 - design_range_bottom = (design_range_bottom * 7227) / 7200 + design_size = design_size * bp + design_range_top = design_range_top * bp + design_range_bottom = design_range_bottom * bp return { design_size, design_range_top, design_range_bottom, -- cgit v1.2.3 From 6971d4a0340aad6736ef6bd7bd16361d156142dd Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 3 Feb 2017 07:39:11 +0100 Subject: [db] fix dd conversion of asked size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Includes @zhouyan’s description of the conversion in case we’ll ever add further units. Reviewed-by: Yan Zhou --- src/luaotfload-database.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 199eca8..87b4101 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -1061,10 +1061,33 @@ do --- we scale the requested size as though the value in the font was --- specified in the requested unit. + --- From @zhouyan: + + --- Let P be the asked size in pt, and Aᵤ = CᵤP, where u is the + --- designed unit, pt, bp, or dd, and + --- + --- Cpt = 1, Cbp = 7200/7227, Cdd = 1157/1238. + --- + --- That is, Aᵤ is the asked size in the desired unit. Let D be the + --- de-sign size (assumed to be in the unit of bp) as reported by + --- the font (divided by 10; in all the following we ignore the + --- factor 2^16 ). + --- + --- For simplicity, consider only the case of exact match to the + --- design size. That is, we would like to have Aᵤ = D. Let A′ᵤ = αᵤP + --- and D′ = βD be the scaled values used in comparisons. For the + --- comparison to work correctly, we need, + --- + --- Aᵤ = D ⟺ A′ᵤ = D′ , + --- + --- and thus αᵤ = βCᵤ. The fix in PR 400 is the case of β = 1. The + --- fix for review is β = 7227/7200, and the value of αᵤ is thus + --- correct for pt, bp, but not for dd. + local dimens = { bp = false, pt = function (v) return v * (7227 / 7200) end, - dd = function (v) return v * (7227 / 7200) * (1238 / 1157) end, + dd = function (v) return v * (7227 / 7200) * (1157 / 1238) end, } design_size_dimension = dimens.bp -- cgit v1.2.3 From 7308f84bf07382407df5efe14a7a9e96f0cb5e3a Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 3 Feb 2017 07:52:23 +0100 Subject: [db] omit the extra funcall when converting units --- src/luaotfload-database.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 87b4101..950d126 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -1086,19 +1086,19 @@ do local dimens = { bp = false, - pt = function (v) return v * (7227 / 7200) end, - dd = function (v) return v * (7227 / 7200) * (1157 / 1238) end, + pt = 7227 / 7200, + dd = (7227 / 7200) * (1157 / 1238), } design_size_dimension = dimens.bp set_size_dimension = function (dim) - local f = dimens [dim] - if f ~= nil then + local conv = dimens [dim] + if conv ~= nil then logreport ("both", 4, "db", "Interpreting design sizes as %q, factor %.6f.", - dim, f (1.000000)) - design_size_dimension = f + dim, conv) + design_size_dimension = conv return end logreport ("both", 0, "db", @@ -1174,7 +1174,7 @@ lookup_font_name = function (specification) end if design_size_dimension ~= false then - askedsize = design_size_dimension (askedsize) + askedsize = design_size_dimension * askedsize end resolved, subfont = lookup_familyname (specification, -- cgit v1.2.3