Expand max font atlas size from 8k to 16k (#5257)

When using fonts with an average of 50,000 characters,
'epaint texture atlas overflowed!' may be printed and cause problems.
It is necessary to expand the max value related to texture.

* Closes #5256

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
rustbasic 2024-10-29 18:42:28 +09:00 committed by GitHub
parent 68352fc13e
commit 288c74e332
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -633,7 +633,7 @@ impl FontsImpl {
"pixels_per_point out of range: {pixels_per_point}"
);
let texture_width = max_texture_side.at_most(8 * 1024);
let texture_width = max_texture_side.at_most(16 * 1024);
let initial_height = 32; // Keep initial font atlas small, so it is fast to upload to GPU. This will expand as needed anyways.
let atlas = TextureAtlas::new([texture_width, initial_height]);

View File

@ -159,8 +159,8 @@ impl TextureAtlas {
}
fn max_height(&self) -> usize {
// the initial width is likely the max texture side size
self.image.width()
// the initial width is set to the max size
self.image.height().max(self.image.width())
}
/// When this get high, it might be time to clear and start over!