Closed spencerkohan closed 2 years ago
I'm attempting to render the text "hola" using glyphs generated by fontdue, using the font Courier New.
I create the metrics like so:
let font = include_bytes!("../res/Courier-New.ttf") as &[u8]; let font = Font::from_bytes( font, fontdue::FontSettings { collection_index: 0, scale: 12.0, }, ) .unwrap(); let char_data: Vec<((Metrics, Vec<u8>), char)> = (32..127) .map(char::from_u32) .flatten() .map(|c| (font.rasterize(c, 12.0), c)) .collect();
When I render based on these metrics, the spacing is clearly wrong, as the characters are too far apart:
When I look at the metrics for the character 'h' I get the following:
Metrics { xmin: 1, ymin: -1, width: 6, height: 7, advance_width: 7.201172, advance_height: 0.0, bounds: OutlineBounds { xmin: 1.0019531, ymin: -0.19335938, width: 5.4375, height: 5.4433594, }, }
I compared this with the metrics produced by fontdrop.info, and the ratios between the width of the character and the advance width are not the same:
So it would appear fontdue is giving me the incorrect glyph metrics here
Never mind, this was an unrelated issue, and I was getting the incorrect glyph metrics
I'm attempting to render the text "hola" using glyphs generated by fontdue, using the font Courier New.
I create the metrics like so:
When I render based on these metrics, the spacing is clearly wrong, as the characters are too far apart:
When I look at the metrics for the character 'h' I get the following:
I compared this with the metrics produced by fontdrop.info, and the ratios between the width of the character and the advance width are not the same:
So it would appear fontdue is giving me the incorrect glyph metrics here