Skip to content

Commit

Permalink
fix: fix issue with top alignement when text contains spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
romgere committed May 30, 2024
1 parent 882e873 commit f0431be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/services/text-maker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,13 @@ export default class TextMakerService extends Service {
const x = ox + info.dx;
const y = info.dy;

const emptyGlyph = lineText.glyphs[info.g].length === 0;

const glyphBounds = this.getSVGPathSegmentsBoundingBox(lineText.glyphs[info.g]);
const glyphHeight = glyphBounds.y2 - glyphBounds.y1;

const minY = Math.min(glyphBounds.y1, glyphBounds.y2);
const maxY = Math.max(glyphBounds.y1, glyphBounds.y2);
const minY = emptyGlyph ? 0 : Math.min(glyphBounds.y1, glyphBounds.y2);
const maxY = emptyGlyph ? 0 : Math.max(glyphBounds.y1, glyphBounds.y2);

lineMinMaxY.maxY = Math.max(lineMinMaxY.maxY, maxY);
lineMinMaxY.minY = Math.min(lineMinMaxY.minY, minY);
Expand Down

0 comments on commit f0431be

Please sign in to comment.