Skip to content

Commit

Permalink
Fix baseline alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-weindel committed Apr 15, 2024
1 parent 5a2495a commit b95a98f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function generateBMFont (fontPath, opt, callback) {
}); // Remove duplicate & control chars

const os2 = font.tables.os2;
const baseline = os2.sTypoAscender * (fontSize / font.unitsPerEm) + (distanceRange >> 1);
const baseline = os2.sTypoAscender * (fontSize / font.unitsPerEm);

const fontface = typeof fontPath === 'string' ? path.basename(fontPath, path.extname(fontPath)) : filename;

Expand Down Expand Up @@ -381,7 +381,7 @@ function generateImage (opt, callback) {
width: width,
height: height,
xoffset: Math.round(bBox.x1) - pad,
yoffset: Math.round(bBox.y1) + pad + baseline,
yoffset: Math.round(bBox.y1) - pad + baseline,
xadvance: glyph.advanceWidth * scale,
chnl: 15
}
Expand Down

0 comments on commit b95a98f

Please sign in to comment.