Skip to content

Commit

Permalink
Fix weird letter misalignments
Browse files Browse the repository at this point in the history
  • Loading branch information
davepagurek committed Dec 8, 2024
1 parent 579a56c commit 84b937a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
p.textSize(80);
p.textAlign(p.LEFT, p.TOP)
p.textFont(f)
p.text('hello,\nworld!', 10, 30, p.width);
p.text('hello, world!', 10, 30, p.width);
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/webgl/shaders/font.vert
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void main() {
1. / length(newOrigin - newDX),
1. / length(newOrigin - newDY)
);
vec2 offset = pixelScale * normalize(aTexCoord - vec2(0.5, 0.5)) * vec2(1., -1.);
vec2 offset = pixelScale * normalize(aTexCoord - vec2(0.5, 0.5));
vec2 textureOffset = offset * (1. / vec2(
uGlyphRect.z - uGlyphRect.x,
uGlyphRect.w - uGlyphRect.y
Expand Down
4 changes: 2 additions & 2 deletions src/webgl/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ function text(p5, fn){
}
case 'Q': {
const [, x1, y1, x, y] = command;
return { type, x, y, x1, y1 };
return { type, x1, y1, x, y };
}
case 'C': {
const [, x1, y1, x2, y2, x, y] = command;
return { type, x, y, x1, y1, x2, y2 };
return { type, x1, y1, x2, y2, x, y };
}
default: {
throw new Error(`Unexpected path command: ${type}`);
Expand Down

0 comments on commit 84b937a

Please sign in to comment.