1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00
This commit is contained in:
Emil Ernerfeldt
2026-03-28 17:13:42 +01:00
parent cb6e91204a
commit cc560acc2b

View File

@@ -16,7 +16,7 @@ use crate::{
use super::{ use super::{
FontsImpl, Galley, Glyph, LayoutJob, LayoutSection, PlacedRow, Row, RowVisuals, FontsImpl, Galley, Glyph, LayoutJob, LayoutSection, PlacedRow, Row, RowVisuals,
VariationCoords, VariationCoords,
font::{Font, FontFace}, font::{Font, FontFace, ShapedGlyph},
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -185,10 +185,10 @@ struct ShapingContext {
#[derive(Debug)] #[derive(Debug)]
struct TextRun { struct TextRun {
/// Which font face should shape this run. /// Which font face should shape this run.
pub font_key: FontFaceKey, font_key: FontFaceKey,
/// Byte range within the section text. /// Byte range within the section text.
pub byte_range: std::ops::Range<usize>, byte_range: std::ops::Range<usize>,
} }
/// Emit shaped glyphs from a [`harfrust::GlyphBuffer`] into a [`Paragraph`]. /// Emit shaped glyphs from a [`harfrust::GlyphBuffer`] into a [`Paragraph`].
@@ -259,7 +259,7 @@ fn layout_shaped_run(
ff.styled_metrics(ctx.pixels_per_point, ctx.font_size, &Default::default()) ff.styled_metrics(ctx.pixels_per_point, ctx.font_size, &Default::default())
}) })
.unwrap_or_default(); .unwrap_or_default();
let shaped = super::font::ShapedGlyph { let shaped = ShapedGlyph {
glyph_id: glyph_info.id.unwrap_or(skrifa::GlyphId::NOTDEF), glyph_id: glyph_info.id.unwrap_or(skrifa::GlyphId::NOTDEF),
advance_width_px: glyph_info.advance_width_unscaled.0 advance_width_px: glyph_info.advance_width_unscaled.0
* fallback_metrics.px_scale_factor, * fallback_metrics.px_scale_factor,
@@ -289,7 +289,7 @@ fn layout_shaped_run(
}); });
paragraph.cursor_x_px += glyph_alloc.advance_width_px; paragraph.cursor_x_px += glyph_alloc.advance_width_px;
} else { } else {
let shaped = super::font::ShapedGlyph { let shaped = ShapedGlyph {
glyph_id, glyph_id,
advance_width_px: x_advance_px, advance_width_px: x_advance_px,
h_pos: paragraph.cursor_x_px + x_offset_px, h_pos: paragraph.cursor_x_px + x_offset_px,
@@ -698,7 +698,7 @@ fn replace_last_glyph_with_overflow_character(
{ {
// we are done // we are done
let shaped = super::font::ShapedGlyph { let shaped = ShapedGlyph {
glyph_id: glyph_info.id.unwrap_or(skrifa::GlyphId::NOTDEF), glyph_id: glyph_info.id.unwrap_or(skrifa::GlyphId::NOTDEF),
advance_width_px: glyph_info.advance_width_unscaled.0 advance_width_px: glyph_info.advance_width_unscaled.0
* font_face_metrics.px_scale_factor, * font_face_metrics.px_scale_factor,