-
Notifications
You must be signed in to change notification settings - Fork 36
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
Implement MSDF font rendering #203
Conversation
44110c6
to
e2050f4
Compare
7563f73
to
fa182de
Compare
|
It seems the text_height is not calculated correctly. This is slightly confusing: let x = physical_glyph.x as f32 + glyph_coordinate.offset_left;
let y = run.line_y + physical_glyph.y as f32 - glyph_coordinate.offset_top;
let width = glyph_coordinate.width;
let height = glyph_coordinate.height;
text_height = text_height.max(y + height);
let position = Rectangle::new(Point2::new(x, y), Point2::new(x + width, y + height));
let color = layout_glyph.color_opt.map(|color| color.into()).unwrap_or(default_color);
glyphs.push(GlyphInstruction {
position,
texture_coordinate: glyph_coordinate.texture_coordinate,
color,
}); We use the x/y/width/height also for the glyph position. Since the glyphs are layed out correct, I wonder why the text height is incorrect. Maybe the glyph stores now offets in a different "direction"? I have to debug this more to understand the true cause for this (we didn't change the layout rendering itself in a fundamental way, only the "gylph storage"). |
fa182de
to
650ee8d
Compare
@eleriaqueen @kokosha I think I fixed the issue. I took out the glyphs out of the equation and use the line height directly. This should fix the wrapping issues you have encountered. Would be happy if you could test again. |
We now use Noto Sans, since it has the broadest Unicode support of the open source fonts. I added a README.md in the font folder, so that people can change the font if the need should arise to do so. With this change, we unified our text rendering to use MSDF rendering. For this we have to generate the whole font map offline in advance.
650ee8d
to
4b0672a
Compare
It is working now! |
Yep looks like you fixed the issue. |
No description provided.