Skip to content

Commit

Permalink
create font atlas that can contains fonts of any size
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Jan 8, 2022
1 parent 458cb7a commit dd63d36
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/bevy_text/src/font_atlas_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ impl FontAtlasSet {
)
};
if !font_atlases.iter_mut().any(add_char_to_font_atlas) {
let glyph_max_size = glyph_texture
.texture_descriptor
.size
.height
.max(glyph_texture.texture_descriptor.size.width);
let containing = (1u32 << 32 - glyph_max_size.leading_zeros()).max(512) as f32;
font_atlases.push(FontAtlas::new(
textures,
texture_atlases,
Vec2::new(512.0, 512.0),
Vec2::new(containing, containing),
));
if !font_atlases.last_mut().unwrap().add_glyph(
textures,
Expand Down

0 comments on commit dd63d36

Please sign in to comment.