From be287eab025da90f5640d71f5576a5a8a399578e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 9 Feb 2025 04:18:31 +0000 Subject: [PATCH] [trak] Don't shift glyphs That's what CoreText does and fonts are designed for. Who are we to improve on... --- src/hb-aat-layout-trak-table.hh | 4 ---- test/shape/data/in-house/tests/aat-trak.tests | 14 +++++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh index a7b49a808..8d088576b 100644 --- a/src/hb-aat-layout-trak-table.hh +++ b/src/hb-aat-layout-trak-table.hh @@ -206,24 +206,20 @@ struct trak { const TrackData &trackData = this+horizData; float tracking = trackData.get_tracking (this, ptem); - hb_position_t offset_to_add = c->font->em_scalef_x (tracking / 2); hb_position_t advance_to_add = c->font->em_scalef_x (tracking); foreach_grapheme (buffer, start, end) { buffer->pos[start].x_advance += advance_to_add; - buffer->pos[start].x_offset += offset_to_add; } } else { const TrackData &trackData = this+vertData; float tracking = trackData.get_tracking (this, ptem); - hb_position_t offset_to_add = c->font->em_scalef_y (tracking / 2); hb_position_t advance_to_add = c->font->em_scalef_y (tracking); foreach_grapheme (buffer, start, end) { buffer->pos[start].y_advance += advance_to_add; - buffer->pos[start].y_offset += offset_to_add; } } diff --git a/test/shape/data/in-house/tests/aat-trak.tests b/test/shape/data/in-house/tests/aat-trak.tests index ec49614ae..808b935d6 100644 --- a/test/shape/data/in-house/tests/aat-trak.tests +++ b/test/shape/data/in-house/tests/aat-trak.tests @@ -1,8 +1,8 @@ ../fonts/TRAK.ttf;;U+0041,U+0042,U+0043;[A.alt=0+1000|B=1+1000|C.alt=2+1000] -../fonts/TRAK.ttf;--font-ptem=.5;U+0041,U+0042,U+0043;[A.alt=0@100,0+1200|B=1@100,0+1200|C.alt=2@100,0+1200] -../fonts/TRAK.ttf;--font-ptem=1;U+0041,U+0042,U+0043;[A.alt=0@100,0+1200|B=1@100,0+1200|C.alt=2@100,0+1200] -../fonts/TRAK.ttf;--font-ptem=2;U+0041,U+0042,U+0043;[A.alt=0@100,0+1200|B=1@100,0+1200|C.alt=2@100,0+1200] -../fonts/TRAK.ttf;--font-ptem=9;U+0041,U+0042,U+0043;[A.alt=0@30,0+1060|B=1@30,0+1060|C.alt=2@30,0+1060] -../fonts/TRAK.ttf;--font-ptem=24;U+0041,U+0042,U+0043;[A.alt=0@-7,0+986|B=1@-7,0+986|C.alt=2@-7,0+986] -../fonts/TRAK.ttf;--font-ptem=72;U+0041,U+0042,U+0043;[A.alt=0@-36,0+929|B=1@-36,0+929|C.alt=2@-36,0+929] -../fonts/TRAK.ttf;--font-ptem=144;U+0041,U+0042,U+0043;[A.alt=0@-50,0+900|B=1@-50,0+900|C.alt=2@-50,0+900] +../fonts/TRAK.ttf;--font-ptem=.5;U+0041,U+0042,U+0043;[A.alt=0+1200|B=1+1200|C.alt=2+1200] +../fonts/TRAK.ttf;--font-ptem=1;U+0041,U+0042,U+0043;[A.alt=0+1200|B=1+1200|C.alt=2+1200] +../fonts/TRAK.ttf;--font-ptem=2;U+0041,U+0042,U+0043;[A.alt=0+1200|B=1+1200|C.alt=2+1200] +../fonts/TRAK.ttf;--font-ptem=9;U+0041,U+0042,U+0043;[A.alt=0+1060|B=1+1060|C.alt=2+1060] +../fonts/TRAK.ttf;--font-ptem=24;U+0041,U+0042,U+0043;[A.alt=0+986|B=1+986|C.alt=2+986] +../fonts/TRAK.ttf;--font-ptem=72;U+0041,U+0042,U+0043;[A.alt=0+929|B=1+929|C.alt=2+929] +../fonts/TRAK.ttf;--font-ptem=144;U+0041,U+0042,U+0043;[A.alt=0+900|B=1+900|C.alt=2+900]