mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 15:20:05 -04:00
Apply documentation changes
This commit is contained in:
@@ -516,10 +516,14 @@ impl Font<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Metrics for a font at a specific screen-space scale.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Default)]
|
#[derive(Clone, Copy, Debug, PartialEq, Default)]
|
||||||
pub struct ScaledMetrics {
|
pub struct ScaledMetrics {
|
||||||
|
/// The DPI part of the screen-space scale.
|
||||||
pub pixels_per_point: f32,
|
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,
|
pub px_scale_factor: f32,
|
||||||
|
/// Vertical offset, in UI points (not screen-space).
|
||||||
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.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -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<'_> {
|
pub fn font(&mut self, family: &FontFamily) -> Font<'_> {
|
||||||
let cached_family = self.family_cache.entry(family.clone()).or_insert_with(|| {
|
let cached_family = self.family_cache.entry(family.clone()).or_insert_with(|| {
|
||||||
let fonts = &self.definitions.families.get(family);
|
let fonts = &self.definitions.families.get(family);
|
||||||
|
|||||||
@@ -173,7 +173,9 @@ fn layout_section(
|
|||||||
|
|
||||||
let mut last_glyph_id = None;
|
let mut last_glyph_id = None;
|
||||||
|
|
||||||
|
// Optimization: only recompute `ScaledMetrics` when `FontFaceKey` changes.
|
||||||
let mut last_font: Option<(FontFaceKey, Option<ScaledMetrics>)> = None;
|
let mut last_font: Option<(FontFaceKey, Option<ScaledMetrics>)> = None;
|
||||||
|
|
||||||
for chr in job.text[byte_range.clone()].chars() {
|
for chr in job.text[byte_range.clone()].chars() {
|
||||||
if job.break_on_newline && chr == '\n' {
|
if job.break_on_newline && chr == '\n' {
|
||||||
out_paragraphs.push(Paragraph::from_section_index(section_index));
|
out_paragraphs.push(Paragraph::from_section_index(section_index));
|
||||||
|
|||||||
Reference in New Issue
Block a user