Get the one true descender value

This commit is contained in:
Wez Furlong committed 2018-03-01 09:12:31 -08:00
1 parent 0af1be0f40
commit 41f1cf9966
2 files changed
+3 -16

No files matched your search

+3 -1
View File
@@ -59,7 +59,9 @@ impl Font for FontImpl {
FontMetrics {
cell_height: self.cell_height,
cell_width: self.cell_width,
descender: unsafe { (*face.face).descender },
// Note: face.face.descender is useless, we have to go through
// face.face.size.metrics to get to the real descender!
descender: unsafe { (*(*face.face).size).metrics.descender as i16 },
}
}
-15
View File
@@ -294,21 +294,6 @@ impl Renderer {
cell_height, cell_width, descender
);
// The descender isn't always reliable. If it looks implausible then we
// cook up something more reasonable. For example, if the descender pulls
// the basline up into the top half of the cell then it is probably bad
// so we halve that distance, putting it closer to the bottom quarter instead.
let descender = if descender.abs() >= cell_height as isize / 2 {
let alt_desc = descender / 2;
eprintln!(
"descender {} is >=50% the cell height, using {} instead",
descender, alt_desc
);
alt_desc
} else {
descender
};
let cell_height = cell_height.ceil() as usize;
let cell_width = cell_width.ceil() as usize;