Chlumsky / msdfgen

Multi-channel signed distance field generator
MIT License
3.9k stars 404 forks source link

Inverting Y Axis makes uneven baseline #178

Closed noorwachid closed 1 year ago

noorwachid commented 1 year ago
scale = 1.0f / metrics.emSize; // metrics from getFontMetrics
float atlasScale = 1.0f / atlasPx; // atlasPx is the size of texture atlas

TextCharacterInformation info;

info.position.x = 0;
info.position.y = scale * bounds.b; // bounds from shape.getBounds
// info.position.y = 1.0f - (scale * bounds.t); // Activate if using Y is down or shape.inverseYAxis = true
info.size = scale * size;

info.textureIndex = hotTextureIndex; // the texture that still has free space
info.texturePosition = atlasScale * Vector2(xOffsetPx, yOffsetPx); // offsetPx is the carriage from atlas packing
info.textureSize = atlasScale * subbytesSize; // subbytesSize is the size of bitmap from generateMSDF
Screenshot 2023-04-15 at 20 58 22 Screenshot 2023-04-15 at 20 53 26

Some glyph like v and z are hovering above baseline.

Screenshot 2023-04-15 at 21 01 48
Chlumsky commented 1 year ago

And what exactly makes you think that the bug is in msdfgen and not in your code?

Chlumsky commented 1 year ago

Reopen when you provide a way to reproduce this and show how this is a bug in msdfgen.