Skip to content

Commit

Permalink
Maybe not using TOP align fixes discrepancies?
Browse files Browse the repository at this point in the history
  • Loading branch information
davepagurek committed Dec 15, 2024
1 parent 1bc41a4 commit b529598
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/unit/visual/cases/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,8 @@ visualSuite("Typography", function () {
);
p5.background(255);
p5.strokeWeight(2);
p5.textAlign(p5.LEFT, p5.TOP);
p5.textSize(50);
const pts = font.textToPoints('p5*js', 0, 0);
const pts = font.textToPoints('p5*js', 0, 50);
p5.beginShape(p5.POINTS);
for (const { x, y } of pts) p5.vertex(x, y);
p5.endShape();
Expand All @@ -434,9 +433,8 @@ visualSuite("Typography", function () {
);
p5.background(255);
p5.strokeWeight(2);
p5.textAlign(p5.LEFT, p5.TOP);
p5.textSize(50);
const pts = font.textToPoints('p5*js', 0, 0, { sampleFactor: 0.5 });
const pts = font.textToPoints('p5*js', 0, 50, { sampleFactor: 0.5 });
p5.beginShape(p5.POINTS);
for (const { x, y } of pts) p5.vertex(x, y);
p5.endShape();
Expand All @@ -452,9 +450,8 @@ visualSuite("Typography", function () {
);
p5.background(200);
p5.strokeWeight(2);
p5.textAlign(p5.LEFT, p5.TOP);
p5.textSize(50);
const contours = font.textToContours('p5*js', 0, 0, { samplingDensity: 0.5 })
const contours = font.textToContours('p5*js', 0, 50, { samplingDensity: 0.5 })
p5.beginShape();
for (const pts of contours) {
p5.beginContour();
Expand All @@ -474,9 +471,8 @@ visualSuite("Typography", function () {
);
p5.background(200);
p5.strokeWeight(2);
p5.textAlign(p5.LEFT, p5.TOP);
p5.textSize(50);
const cmds = font.textToPaths('p5*js', 0, 0)
const cmds = font.textToPaths('p5*js', 0, 50)
p5.drawingContext.beginPath();
for (const [type, ...args] of cmds) {
if (type === 'M') {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b529598

Please sign in to comment.