1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

Small naming and docstring improvements

This commit is contained in:
Emil Ernerfeldt
2025-09-08 14:32:39 +02:00
parent 4e15f5306f
commit 45a109633f
2 changed files with 7 additions and 8 deletions

View File

@@ -293,7 +293,7 @@ impl FontImpl {
}
#[inline]
pub(super) fn pair_kerning_screen_space(
pub(super) fn pair_kerning_pixels(
&self,
metrics: &ScaledMetrics,
last_glyph_id: ab_glyph::GlyphId,
@@ -309,7 +309,7 @@ impl FontImpl {
last_glyph_id: ab_glyph::GlyphId,
glyph_id: ab_glyph::GlyphId,
) -> f32 {
self.pair_kerning_screen_space(metrics, last_glyph_id, glyph_id) / metrics.pixels_per_point
self.pair_kerning_pixels(metrics, last_glyph_id, glyph_id) / metrics.pixels_per_point
}
#[inline(always)]
@@ -534,7 +534,7 @@ pub struct ScaledMetrics {
/// Translates "unscaled" units to physical (screen) pixels.
pub px_scale_factor: f32,
/// Vertical offset, in UI points (not screen-space).
/// Vertical offset, in UI points.
pub y_offset_in_points: f32,
/// This is the distance from the top to the baseline.

View File

@@ -204,11 +204,10 @@ fn layout_section(
if let (Some(font_impl), Some(last_glyph_id), Some(glyph_id)) =
(&font_impl, last_glyph_id, glyph_info.id)
{
paragraph.cursor_x_px += font_impl.pair_kerning_screen_space(
&font_impl_metrics,
last_glyph_id,
glyph_id,
);
paragraph.cursor_x_px +=
font_impl.pair_kerning_pixels(&font_impl_metrics, last_glyph_id, glyph_id);
// Only apply extra_letter_spacing to glyphs after the first one:
paragraph.cursor_x_px += extra_letter_spacing * pixels_per_point;
}