Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong baseline? #8

Closed
htdag opened this issue Aug 14, 2020 · 7 comments
Closed

Wrong baseline? #8

htdag opened this issue Aug 14, 2020 · 7 comments
Assignees
Labels

Comments

@htdag
Copy link

htdag commented Aug 14, 2020

Just compare fontbm vs BMFont vs Hiero, chars: A Á Â Ấ Ắ Ễ Ỗ
From image, I found some issues

  • Glyph rendered, not good as Hiero (freetype).
  • The baseline seem wrong
    BMFont: size=-48, lineHeight=56 base=44
    fontbm: size=48, lineHeight=57 base=36
@vladimirgamalyan
Copy link
Owner

vladimirgamalyan commented Oct 29, 2020

Fixed and released, thank you and sorry for the late reply =)
(baseline is still different from BMFont version, the last one slightly crops some glyphs, for example Consolas as you can see on your screenshot)

@htdag
Copy link
Author

htdag commented May 4, 2021

Thanks, but it still not correct (char g).

@vladimirgamalyan
Copy link
Owner

I guess you use common/lineHeight parameter for your canvas height, so bottom of 'g' doesn't fit into the picture. Actually lineHeight means how far the cursor should be moved vertically when moving to the next line (see http://www.angelcode.com/products/bmfont/doc/render_text.html). To calculate required canvas height you can get the maximum value out of all yoffset + height.

@vladimirgamalyan
Copy link
Owner

I added the --extra-info flag, it adds a common/totalHeight value that you can use as total canvas height to fit any glyphs from the font.

@htdag
Copy link
Author

htdag commented Dec 2, 2021

I use lineHeight
But, it displays correctly for bmfont.

@vladimirgamalyan
Copy link
Owner

BMFont uses TEXTMETRIC.tmAscent as common/base value (without TEXTMETRIC.tmInternalLeading) and crops top of glyphs above this value:

image

As result of this cropping - you could fit your text in lineHeight.

fontbm uses distance from topmost possible pixel (for all font glyphs) to baseline as common/base, so it is not the same value as BMFont, and rendered text looks below a bit (to fit all accent marks and other diacritical characters), but in this case lineHeight is not enough to fit all the glyphs and should be used only as distance between baselines.

@vladimirgamalyan
Copy link
Owner

The last release generates more similar base values, maybe this will suit your case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants