[trak] Only adjust around first glyph

Assumes graphemes only have one base glyph.
This commit is contained in:
Behdad Esfahbod 2018-10-11 10:22:01 -04:00
parent 071a2cbcdd
commit d06c4a867f
1 changed files with 6 additions and 6 deletions

View File

@ -174,24 +174,24 @@ struct trak
{ {
const TrackData &trackData = this+horizData; const TrackData &trackData = this+horizData;
float tracking = trackData.get_tracking (this, ptem); float tracking = trackData.get_tracking (this, ptem);
hb_position_t advance_to_add = c->font->em_scalef_x (tracking / 2); 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) foreach_grapheme (buffer, start, end)
{ {
buffer->pos[start].x_offset += advance_to_add;
buffer->pos[start].x_advance += advance_to_add; buffer->pos[start].x_advance += advance_to_add;
buffer->pos[end].x_advance += advance_to_add; buffer->pos[start].x_offset += offset_to_add;
} }
} }
else else
{ {
const TrackData &trackData = this+vertData; const TrackData &trackData = this+vertData;
float tracking = trackData.get_tracking (this, ptem); float tracking = trackData.get_tracking (this, ptem);
hb_position_t advance_to_add = c->font->em_scalef_y (tracking / 2); 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) foreach_grapheme (buffer, start, end)
{ {
buffer->pos[start].y_offset += advance_to_add;
buffer->pos[start].y_advance += advance_to_add; buffer->pos[start].y_advance += advance_to_add;
buffer->pos[end].y_advance += advance_to_add; buffer->pos[start].y_offset += offset_to_add;
} }
} }