Commit 1051d990 authored by Matt Keeler's avatar Matt Keeler Committed by Peter van der meulen

scale the font size in the macos rasterizer’s load_font function

This correctly handles scaling the fonts as the dpr changes when moving the window between screens that have different dprs.
parent ca1268ce
......@@ -148,15 +148,16 @@ impl ::Rasterize for Rasterizer {
}
fn load_font(&mut self, desc: &FontDesc, size: Size) -> Result<FontKey, Error> {
let scaled_size = Size::new(size.as_f32_pts() * self.device_pixel_ratio);
self.keys
.get(&(desc.to_owned(), size))
.get(&(desc.to_owned(), scaled_size))
.map(|k| Ok(*k))
.unwrap_or_else(|| {
let font = self.get_font(desc, size)?;
let key = FontKey::next();
self.fonts.insert(key, font);
self.keys.insert((desc.clone(), size), key);
self.keys.insert((desc.clone(), scaled_size), key);
Ok(key)
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment