diff --git a/index.js b/index.js index 2cd12a1..0b645b3 100644 --- a/index.js +++ b/index.js @@ -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; @@ -380,8 +380,8 @@ function generateImage (opt, callback) { char: String(char), width: width, height: height, - xoffset: Math.round(bBox.x1) - pad, - yoffset: Math.round(bBox.y1) + pad + baseline, + xoffset: bBox.x1 - pad, + yoffset: bBox.y1 - pad + baseline, xadvance: glyph.advanceWidth * scale, chnl: 15 }