Skip to content

Commit

Permalink
fix foliojs#182: apply rounding after delta interpolation (foliojs#332)
Browse files Browse the repository at this point in the history
rounding after the delta interpolation instead of before prevents rounding issues leading do wrong value, e.g. in the unicode test suite case GVAR-9, column 4
  • Loading branch information
Connum authored Apr 12, 2024
1 parent a5fe0a1 commit 5b10bbd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/glyph/GlyphVariationProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export default class GlyphVariationProcessor {
let point = outPoints[idx];
hasDelta[idx] = true;

point.x += Math.round(xDeltas[i] * factor);
point.y += Math.round(yDeltas[i] * factor);
point.x += xDeltas[i] * factor;
point.y += yDeltas[i] * factor;
}
}

Expand All @@ -171,8 +171,8 @@ export default class GlyphVariationProcessor {
let deltaX = outPoints[i].x - origPoints[i].x;
let deltaY = outPoints[i].y - origPoints[i].y;

glyphPoints[i].x += deltaX;
glyphPoints[i].y += deltaY;
glyphPoints[i].x = Math.round(glyphPoints[i].x + deltaX);
glyphPoints[i].y = Math.round(glyphPoints[i].y + deltaY);
}
}

Expand Down

0 comments on commit 5b10bbd

Please sign in to comment.