mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
e2916fbad1
# Objective Glyph positions don't account for padding added to the font texture atlas, resulting in them being off by one physical pixel in both axis. ## Example ```rust use bevy::{ prelude::*, window::WindowResolution }; fn main() { App::new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { resolution: WindowResolution::default().with_scale_factor_override(1.), ..Default::default() }), ..Default::default() })) .add_systems(Startup, setup) .run(); } fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { commands.spawn(Camera2dBundle::default()); commands.spawn( TextBundle::from_section( "QQQQQ", TextStyle { font: asset_server.load("FiraMono-Medium.ttf"), font_size: 14.0, ..default() }, ) .with_style(Style { left:Val::Px(10.), top: Val::Px(10.), ..default() }) .with_background_color(Color::RED) ); } ``` <img width="350" alt="QQQQQ-bad" src="https://github.com/bevyengine/bevy/assets/27962798/6a509aee-64c8-4ee8-a8c1-77ee65355898"> The coordinates are off by one in physical coordinates, not logical. So the difference only becomes obvious with `UiScale` and the window scale factor set to low values. ## Solution Translate glyph positions by -1 in both axes. <img width="300" alt="QQQQQ-good" src="https://github.com/bevyengine/bevy/assets/27962798/16e3f6d9-1223-48e0-9fdd-b682a3e8ade4"> --- ## Changelog * Translate the positions for each glyph by -1 in both axes in `bevy_text::glyph_brush::process_glyphs` --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_ecs_compile_fail_tests | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_macros_compile_fail_tests | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_reflect_compile_fail_tests | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |