[HarfBuzz] harfbuzz: Branch 'master'
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Oct 16 20:25:17 UTC 2018
src/hb-ot-kern-table.hh | 18 ++++++++++++------
src/hb-ot-shape-fallback.cc | 2 +-
2 files changed, 13 insertions(+), 7 deletions(-)
New commits:
commit 661340c475dc928f227d54b3f36eaf6f41c2b6e3
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Oct 16 13:24:29 2018 -0700
[kern] Scale kern pairs before applying
Fixes https://github.com/harfbuzz/harfbuzz/issues/1255
Fixes https://github.com/harfbuzz/harfbuzz/issues/1252
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index 3cc11d10..63551d31 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -38,9 +38,10 @@ struct hb_kern_machine_t
hb_kern_machine_t (const Driver &driver_) : driver (driver_) {}
HB_NO_SANITIZE_SIGNED_INTEGER_OVERFLOW
- inline void kern (hb_font_t *font,
- hb_buffer_t *buffer,
- hb_mask_t kern_mask) const
+ inline void kern (hb_font_t *font,
+ hb_buffer_t *buffer,
+ hb_mask_t kern_mask,
+ bool scale = true) const
{
OT::hb_ot_apply_context_t c (1, font, buffer);
c.set_lookup_mask (kern_mask);
@@ -69,7 +70,6 @@ struct hb_kern_machine_t
unsigned int i = idx;
unsigned int j = skippy_iter.idx;
- hb_position_t kern1, kern2;
hb_position_t kern = driver.get_kerning (info[i].codepoint,
info[j].codepoint);
@@ -78,17 +78,23 @@ struct hb_kern_machine_t
if (likely (!kern))
goto skip;
- kern1 = kern >> 1;
- kern2 = kern - kern1;
if (horizontal)
{
+ if (scale)
+ kern = font->em_scale_x (kern);
+ hb_position_t kern1 = kern >> 1;
+ hb_position_t kern2 = kern - kern1;
pos[i].x_advance += kern1;
pos[j].x_advance += kern2;
pos[j].x_offset += kern2;
}
else
{
+ if (scale)
+ kern = font->em_scale_y (kern);
+ hb_position_t kern1 = kern >> 1;
+ hb_position_t kern2 = kern - kern1;
pos[i].y_advance += kern1;
pos[j].y_advance += kern2;
pos[j].y_offset += kern2;
diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index 655f45ca..4c5ccc97 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -466,7 +466,7 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
return;
hb_ot_shape_fallback_kern_driver_t driver (font, buffer);
hb_kern_machine_t<hb_ot_shape_fallback_kern_driver_t> machine (driver);
- machine.kern (font, buffer, plan->kern_mask);
+ machine.kern (font, buffer, plan->kern_mask, false);
}
More information about the HarfBuzz
mailing list