Skip to content

Commit

Permalink
reduce changes introduced due to variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
TotalKrill committed Nov 12, 2023
1 parent 7ba9300 commit 8cd333d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
3 changes: 0 additions & 3 deletions crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ async-io = ["bevy_tasks/async-io"]
wayland = ["bevy_winit/wayland"]
x11 = ["bevy_winit/x11"]

# enable rendering of font glyphs using subpixel accuracy
subpixel_glyph_atlas = ["bevy_text/subpixel_glyph_atlas"]

# Transmission textures in `StandardMaterial`:
pbr_transmission_textures = ["bevy_pbr?/pbr_transmission_textures", "bevy_gltf?/pbr_transmission_textures"]

Expand Down
16 changes: 8 additions & 8 deletions crates/bevy_text/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ impl TextPipeline {

if !text_settings.allow_dynamic_font_size
&& !font_atlas_warning.warned
&& font_atlas_set.len() > text_settings.max_font_atlases.get()
&& font_atlas_set.len() > text_settings.soft_max_font_atlases.get()
{
warn!("warning[B0005]: Number of font atlases has exceeded the maximum of {}. Performance and memory usage may suffer.", text_settings.max_font_atlases.get());
warn!("warning[B0005]: Number of font atlases has exceeded the maximum of {}. Performance and memory usage may suffer.", text_settings.soft_max_font_atlases.get());
font_atlas_warning.warned = true;
}

Expand Down Expand Up @@ -410,8 +410,8 @@ impl TextPipeline {
};

Ok(TextMeasureInfo {
min_width_content_size,
max_width_content_size,
min: min_width_content_size,
max: max_width_content_size,
font_system: Arc::clone(&self.font_system.0),
buffer: Mutex::new(buffer),
})
Expand Down Expand Up @@ -460,17 +460,17 @@ pub struct TextLayoutInfo {
///
/// Generated via [`TextPipeline::create_text_measure`].
pub struct TextMeasureInfo {
pub min_width_content_size: Vec2,
pub max_width_content_size: Vec2,
pub min: Vec2,
pub max: Vec2,
buffer: Mutex<cosmic_text::Buffer>,
font_system: Arc<Mutex<cosmic_text::FontSystem>>,
}

impl std::fmt::Debug for TextMeasureInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("TextMeasureInfo")
.field("min_width_content_size", &self.min_width_content_size)
.field("max_width_content_size", &self.max_width_content_size)
.field("min_width_content_size", &self.min)
.field("max_width_content_size", &self.max)
.field("buffer", &"_")
.field("font_system", &"_")
.finish()
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_text/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub enum TextAlignment {
/// Describes the style of a [`TextSection`].
#[derive(Clone, Debug, Reflect)]
pub struct TextStyle {
pub font: FontRef,
pub font: Handle<Font>,
pub font_size: f32,
pub color: Color,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ pub fn extract_text_uinodes(
}
let atlas = texture_atlases.get(&atlas_info.texture_atlas).unwrap();

let mut rect = atlas.textures[atlas_info.glyph_index];
let mut rect = atlas.textures[atlas_info.location.glyph_index];
rect.min *= inverse_scale_factor;
rect.max *= inverse_scale_factor;
extracted_uinodes.uinodes.insert(
Expand Down
8 changes: 3 additions & 5 deletions crates/bevy_ui/src/widget/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ impl Measure for TextMeasure {
.map_or_else(
|| match available_width {
AvailableSpace::Definite(_) => self.info.compute_size(Vec2::new(x, f32::MAX)),
AvailableSpace::MinContent => Vec2::new(x, self.info.min_width_content_size.y),
AvailableSpace::MaxContent => Vec2::new(x, self.info.max_width_content_size.y),
AvailableSpace::MinContent => Vec2::new(x, self.info.min.y),
AvailableSpace::MaxContent => Vec2::new(x, self.info.max.y),
},
|y| Vec2::new(x, y),
)
Expand All @@ -94,9 +94,7 @@ fn create_text_measure(
) {
Ok(measure) => {
if text.linebreak_behavior == BreakLineOn::NoWrap {
content_size.set(FixedMeasure {
size: measure.max_width_content_size,
});
content_size.set(FixedMeasure { size: measure.max });
} else {
content_size.set(TextMeasure { info: measure });
}
Expand Down

0 comments on commit 8cd333d

Please sign in to comment.