mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -04:00
Small naming and docstring improvements
This commit is contained in:
@@ -293,7 +293,7 @@ impl FontImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(super) fn pair_kerning_screen_space(
|
pub(super) fn pair_kerning_pixels(
|
||||||
&self,
|
&self,
|
||||||
metrics: &ScaledMetrics,
|
metrics: &ScaledMetrics,
|
||||||
last_glyph_id: ab_glyph::GlyphId,
|
last_glyph_id: ab_glyph::GlyphId,
|
||||||
@@ -309,7 +309,7 @@ impl FontImpl {
|
|||||||
last_glyph_id: ab_glyph::GlyphId,
|
last_glyph_id: ab_glyph::GlyphId,
|
||||||
glyph_id: ab_glyph::GlyphId,
|
glyph_id: ab_glyph::GlyphId,
|
||||||
) -> f32 {
|
) -> 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)]
|
#[inline(always)]
|
||||||
@@ -534,7 +534,7 @@ pub struct ScaledMetrics {
|
|||||||
/// Translates "unscaled" units to physical (screen) pixels.
|
/// Translates "unscaled" units to physical (screen) pixels.
|
||||||
pub px_scale_factor: f32,
|
pub px_scale_factor: f32,
|
||||||
|
|
||||||
/// Vertical offset, in UI points (not screen-space).
|
/// Vertical offset, in UI points.
|
||||||
pub y_offset_in_points: f32,
|
pub y_offset_in_points: f32,
|
||||||
|
|
||||||
/// This is the distance from the top to the baseline.
|
/// This is the distance from the top to the baseline.
|
||||||
|
|||||||
@@ -204,11 +204,10 @@ fn layout_section(
|
|||||||
if let (Some(font_impl), Some(last_glyph_id), Some(glyph_id)) =
|
if let (Some(font_impl), Some(last_glyph_id), Some(glyph_id)) =
|
||||||
(&font_impl, last_glyph_id, glyph_info.id)
|
(&font_impl, last_glyph_id, glyph_info.id)
|
||||||
{
|
{
|
||||||
paragraph.cursor_x_px += font_impl.pair_kerning_screen_space(
|
paragraph.cursor_x_px +=
|
||||||
&font_impl_metrics,
|
font_impl.pair_kerning_pixels(&font_impl_metrics, last_glyph_id, glyph_id);
|
||||||
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;
|
paragraph.cursor_x_px += extra_letter_spacing * pixels_per_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user