Slight char_width refactor.
This requires an extra function call but
removes duplication of "W", so it's more
safe for future editing.
@@ -553,13 +553,7 @@ pub fn char_width(&self, text: &mut PietText, font_size: f64) -> f64 {
/// Calculate the width of the character "W" (being the widest character)
/// in the editor's current font family and current font size.
pub fn editor_char_width(&self, text: &mut PietText) -> f64 {
- Self::editor_text_size_internal(
- self.editor.font_family(),
- self.editor.font_size as f64,
- text,
- "W",
- )
- .width
+ self.char_width(text, self.editor.font_size as f64)
}
/// Calculate the width of `text_to_measure` in the editor's current font family and font size.
