Commit 6b175cf
authored
Round sub pixel font sizes (#22646)
# Objective
Sub-pixel font sizes don't provide much benefit with bitmap fonts and
rounding them to the nearest pixel massively reduces the number of font
atlases when a text entity's font size is naively interpolated.
fixes #22626
## Solution
Round the font sizes before adding them to the Cosmic Text `Attrs`.
## Testing
```
cargo run --example animated_ui
```
In main, the window is blank and it rapidly generates gigabytes of font
atlase images.
With this PR, the text is visible and animated, and memory usage remains
stable.1 parent 789891f commit 6b175cf
2 files changed
+13
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
595 | 601 | | |
596 | 602 | | |
597 | 603 | | |
598 | 604 | | |
599 | 605 | | |
600 | 606 | | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
608 | 611 | | |
609 | 612 | | |
610 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
372 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
373 | 374 | | |
374 | 375 | | |
375 | 376 | | |
| |||
794 | 795 | | |
795 | 796 | | |
796 | 797 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | 798 | | |
807 | 799 | | |
808 | 800 | | |
| |||
0 commit comments