graphics
graphics copied to clipboard
Zero character height for different characters
I'm assuming that the height method for Characters measures from bottom to top, including space left, since the same is mentioned for width. I'm getting zero height for different characters for multiple fonts (given one example with Fira Mono below, also tried Liberation Mono and Ubuntu Mono).
extern crate piston_window;
extern crate find_folder;
extern crate graphics;
use piston_window::*;
use graphics::character::CharacterCache;
fn main() {
let window: PistonWindow = WindowSettings::new(
"piston-tutorial",
[600, 600]
).exit_on_esc(true).build().unwrap();
let assets = find_folder::Search::ParentsThenKids(3, 3)
.for_folder("assets").unwrap();
let ref font = assets.join("FiraMono-Regular.otf");
let factory = window.factory.borrow().clone();
let mut glyphs = Glyphs::new(font, factory).unwrap();
let chars = vec!['M','g','-','y'];
for x in chars {
print!("offset={:?}", glyphs.character(100,x).offset);
println!(" size={:?}", glyphs.character(100,x).size);//,
}
}
The output for offset is correct (I checked this by drawing the characters and bounding rectangles) but for size, size[1] (height) always turns out to be 0.
offset=[3, 69] size=[60, 0]
offset=[6, 59] size=[60, 0]
offset=[12, 35] size=[60, 0]
offset=[6, 53] size=[60, 0]
From Cargo.toml:
[dependencies]
piston2d-graphics = "0.11.0"
find_folder = "0.3.0"
piston_window = "0.28.0"
Any status on it? As an aside, the documentation says height is a setter which it is not.
http://docs.piston.rs/graphics/graphics/character/struct.Character.html#method.height