1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Apply documentation changes

This commit is contained in:
valadaptive
2025-09-08 05:30:32 -04:00
parent abe9a2d91d
commit 61351d170e
3 changed files with 7 additions and 1 deletions

View File

@@ -516,10 +516,14 @@ impl Font<'_> {
}
}
/// Metrics for a font at a specific screen-space scale.
#[derive(Clone, Copy, Debug, PartialEq, Default)]
pub struct ScaledMetrics {
/// The DPI part of the screen-space scale.
pub pixels_per_point: f32,
/// Scale factor, relative to the font's units per em (so, probably much less than 1).
pub px_scale_factor: f32,
/// Vertical offset, in UI points (not screen-space).
pub y_offset_in_points: f32,
/// This is the distance from the top to the baseline.
///

View File

@@ -799,7 +799,7 @@ impl FontsImpl {
}
}
/// Get the right font implementation from [`FontFamily`].
/// Get the right font implementation from [`FontFamily`].
pub fn font(&mut self, family: &FontFamily) -> Font<'_> {
let cached_family = self.family_cache.entry(family.clone()).or_insert_with(|| {
let fonts = &self.definitions.families.get(family);

View File

@@ -173,7 +173,9 @@ fn layout_section(
let mut last_glyph_id = None;
// Optimization: only recompute `ScaledMetrics` when `FontFaceKey` changes.
let mut last_font: Option<(FontFaceKey, Option<ScaledMetrics>)> = None;
for chr in job.text[byte_range.clone()].chars() {
if job.break_on_newline && chr == '\n' {
out_paragraphs.push(Paragraph::from_section_index(section_index));