Skip to content

Commit

Permalink
Refactor: Clean up font_id selection. (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
coastalwhite authored May 7, 2023
1 parent 518fda0 commit 5bf93dd
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,11 @@ impl Text {

fn font_id(&self) -> FontId {
let base = self.font * 4;
let font = if self.is_bold {
if self.is_italic {
base + 3
} else {
base + 2
}
} else if self.is_italic {
base + 1
} else {
base
let font = base + match (self.is_bold, self.is_italic) {
(false, false) => 0,
(false, true) => 1,
(true, false) => 2,
(true, true) => 3,
};
FontId(font)
}
Expand Down

0 comments on commit 5bf93dd

Please sign in to comment.