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

Fix baseline alignment #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

frank-weindel
Copy link

@frank-weindel frank-weindel commented Apr 15, 2024

I've noticed that the common.base property does not actually line up with the baseline of the SDF glyphs when they are laid out according to the yoffset of each glyph. This seems related to the distance range "pad" that is added to both the baseline and the yoffset for each glyph.

Baseline Adjustment
I don't think that the baseline itself needs the pad added to it as the distance range itself should not generally affect where the glyph is actually drawn (unless a user opts to render glyphs thicker or thinner than the original font).

Y-Offset Adjustment
Just like its done for the xoffset already, the pad for yoffset is subtracted from the bBox value instead of added.

Before Change

before-change

After Change

after-change

@frank-weindel frank-weindel force-pushed the fix/baseline-alignment branch from 08ecffb to b95a98f Compare April 15, 2024 22:52
frank-weindel added a commit to lightning-js/msdf-generator that referenced this pull request Apr 22, 2024
- Converted to TypeScript / NodeJS
- More detailed documentation
- Adjustments made to SDF JSON data
  - Fixes an [issue](soimy/msdf-bmfont-xml#93) I've discovered in the generated JSON data from [msdf-bmfont-xml](https://github.com/soimy/msdf-bmfont-xml). That project does not seem to be actively maintained anymore so this is a stop gap until that fix can be accepted and released.
 
Planning on some more updates that could provide better metrics for alignment / line height for the SDF text renderer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant