|
|
@ -94,14 +94,17 @@ impl CachingShaper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn reset_font_loader(&mut self) {
|
|
|
|
fn reset_font_loader(&mut self) {
|
|
|
|
// Calculate the new fudge factor required to scale the font width to the nearest exact pixel
|
|
|
|
|
|
|
|
// NOTE: This temporarily loads the font without any fudge factor, since the interface
|
|
|
|
|
|
|
|
// needs a size and we don't know the exact one until it's calculated.
|
|
|
|
|
|
|
|
self.fudge_factor = 1.0;
|
|
|
|
self.fudge_factor = 1.0;
|
|
|
|
let mut font_size = self.current_size();
|
|
|
|
let mut font_size = self.current_size();
|
|
|
|
debug!("Original font_size: {:.2}px", font_size);
|
|
|
|
debug!("Original font_size: {:.2}px", font_size);
|
|
|
|
|
|
|
|
|
|
|
|
self.font_loader = FontLoader::new(font_size);
|
|
|
|
self.font_loader = FontLoader::new(font_size);
|
|
|
|
let (metrics, font_width) = self.info();
|
|
|
|
let (metrics, font_width) = self.info();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
debug!("Original font_width: {:.2}px", font_width);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if !self.options.allow_float_size {
|
|
|
|
|
|
|
|
// Calculate the new fudge factor required to scale the font width to the nearest exact pixel
|
|
|
|
debug!(
|
|
|
|
debug!(
|
|
|
|
"Font width: {:.2}px (avg: {:.2}px)",
|
|
|
|
"Font width: {:.2}px (avg: {:.2}px)",
|
|
|
|
font_width, metrics.average_width
|
|
|
|
font_width, metrics.average_width
|
|
|
@ -111,8 +114,8 @@ impl CachingShaper {
|
|
|
|
font_size = self.current_size();
|
|
|
|
font_size = self.current_size();
|
|
|
|
debug!("Fudged font size: {:.2}px", font_size);
|
|
|
|
debug!("Fudged font size: {:.2}px", font_size);
|
|
|
|
debug!("Fudged font width: {:.2}px", self.info().1);
|
|
|
|
debug!("Fudged font width: {:.2}px", self.info().1);
|
|
|
|
|
|
|
|
|
|
|
|
self.font_loader = FontLoader::new(font_size);
|
|
|
|
self.font_loader = FontLoader::new(font_size);
|
|
|
|
|
|
|
|
}
|
|
|
|
self.blob_cache.clear();
|
|
|
|
self.blob_cache.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|