diff options
| author | Philipp Gesang <phg@phi-gamma.net> | 2017-02-03 07:39:11 +0100 | 
|---|---|---|
| committer | Philipp Gesang <phg@phi-gamma.net> | 2017-02-03 08:12:15 +0100 | 
| commit | 6971d4a0340aad6736ef6bd7bd16361d156142dd (patch) | |
| tree | 33b621ba6a4aeea92b5cb13b655227e0b946aa9a /src | |
| parent | af4355dc4406482a04b0a23a44969f55fcb0de37 (diff) | |
| download | luaotfload-6971d4a0340aad6736ef6bd7bd16361d156142dd.tar.gz | |
[db] fix dd conversion of asked size
Includes @zhouyan’s description of the conversion in case we’ll ever add
further units.
Reviewed-by: Yan Zhou <zhouyan@me.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/luaotfload-database.lua | 25 | 
1 files changed, 24 insertions, 1 deletions
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  | 
