[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Use right side for italic correction (972a510)
Marcel Fabian Krüger
tex at 2krueger.de
Sun Mar 15 14:05:26 CET 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/972a510f2a511edc4da1e6a84150a011bea8d200
>---------------------------------------------------------------
commit 972a510f2a511edc4da1e6a84150a011bea8d200
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Sun Mar 15 14:04:19 2020 +0100
Use right side for italic correction
We should look if this leads to pproblems with arabic or other r2l text
>---------------------------------------------------------------
972a510f2a511edc4da1e6a84150a011bea8d200
src/luaotfload-harf-define.lua | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/luaotfload-harf-define.lua b/src/luaotfload-harf-define.lua
index 1050e0b..caf08d4 100644
--- a/src/luaotfload-harf-define.lua
+++ b/src/luaotfload-harf-define.lua
@@ -116,6 +116,7 @@ local function loadfont(spec)
-- too slow.
local glyphcount = hbface:get_glyph_count()
local glyphs = {}
+ local autoitalic = slant ~= 0 and 20 or nil -- the magic 20 is taken from ConTeXt where it came from Dohyun Kim. We keep it to be metric compatible as far as possible
for gid = 0, glyphcount - 1 do
local width = hbfont:get_glyph_h_advance(gid)
local height, depth, italic = nil, nil, nil
@@ -123,8 +124,9 @@ local function loadfont(spec)
if extents then
height = extents.y_bearing
depth = extents.y_bearing + extents.height
- if extents.x_bearing < 0 then
- italic = -extents.x_bearing
+ local right_bearing = extents.x_bearing + extents.width - width
+ if autoitalic and right_bearing > -autoitalic then
+ italic = right_bearing + autoitalic
end
end
glyphs[gid] = {
More information about the latex3-commits
mailing list.