From be6f51fbca8dce8d42831747b90dea99f6e1bf9e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 22 Jan 2025 16:21:44 -0700 Subject: [PATCH] [hvgl] Make axis value setting work Yay! --- src/hb-aat-var-hvgl-table.cc | 7 ++++--- src/hb-aat-var-hvgl-table.hh | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/hb-aat-var-hvgl-table.cc b/src/hb-aat-var-hvgl-table.cc index 4a9c37913..970f6b66a 100644 --- a/src/hb-aat-var-hvgl-table.cc +++ b/src/hb-aat-var-hvgl-table.cc @@ -79,11 +79,12 @@ PartShape::get_path_at (const struct hvgl &hvgl, { unsigned axis_index = _.first; float coord = _.second; + bool pos = coord > 0; if (!coord) continue; - bool pos = coord >= 0; - double scalar = fabsf (coord); + double scalar = fabs(coord); + unsigned column_idx = axis_index * 2 + pos; - const auto delta = deltas.get_column (axis_index * 2 + pos, axisCount, segmentCount); + const auto delta = deltas.get_column (column_idx, axisCount, segmentCount); unsigned count = hb_min (v.length, delta.length); for (unsigned i = 0; i < count; i++) v.arrayZ[i] += scalar * delta.arrayZ[i]; diff --git a/src/hb-aat-var-hvgl-table.hh b/src/hb-aat-var-hvgl-table.hh index 82258045c..29009b86e 100644 --- a/src/hb-aat-var-hvgl-table.hh +++ b/src/hb-aat-var-hvgl-table.hh @@ -179,18 +179,18 @@ struct ExtremumColumnStarts const auto &extremumRowIndex = StructAfter (masterRowIndex, master_axis_value_deltas.length); hb_array_t extremum_row_index = extremumRowIndex.as_array (extremum_axis_value_deltas.length); - for (unsigned col_idx = 0; col_idx < 2 * axis_count; col_idx++) + for (unsigned column_idx = 0; column_idx < 2 * axis_count; column_idx++) { - const auto &sparse_row_start = extremumColumnStart[col_idx]; - const auto &sparse_row_end = extremumColumnStart[col_idx + 1]; + const auto &sparse_row_start = extremumColumnStart[column_idx]; + const auto &sparse_row_end = extremumColumnStart[column_idx + 1]; if (sparse_row_start == sparse_row_end) continue; - bool pos = col_idx & 1; - unsigned axis_idx = col_idx / 2; + bool pos = column_idx & 1; + unsigned axis_idx = column_idx / 2; float coord = coords[axis_idx]; - if (!coord || (pos ^ (coord < 0))) + if (!coord || (pos != (coord > 0))) continue; float scalar = fabsf (coord);