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

Lint vertical spacing in the code (#3224)

* Lint vertical spacing in the code

* Add some vertical spacing for readability
This commit is contained in:
Emil Ernerfeldt
2023-08-10 15:26:54 +02:00
committed by GitHub
parent 83c18498e9
commit d568d9f5d0
22 changed files with 215 additions and 14 deletions

View File

@@ -78,11 +78,15 @@ impl Default for GlyphInfo {
pub struct FontImpl {
name: String,
ab_glyph_font: ab_glyph::FontArc,
/// Maximum character height
scale_in_pixels: u32,
height_in_points: f32,
// move each character by this much (hack)
y_offset: f32,
ascent: f32,
pixels_per_point: f32,
glyph_info_cache: RwLock<ahash::HashMap<char, GlyphInfo>>, // TODO(emilk): standard Mutex
@@ -320,8 +324,10 @@ type FontIndex = usize;
/// Wrapper over multiple [`FontImpl`] (e.g. a primary + fallbacks for emojis)
pub struct Font {
fonts: Vec<Arc<FontImpl>>,
/// Lazily calculated.
characters: Option<BTreeSet<char>>,
replacement_glyph: (FontIndex, GlyphInfo),
pixels_per_point: f32,
row_height: f32,

View File

@@ -193,8 +193,10 @@ impl std::hash::Hash for LayoutJob {
pub struct LayoutSection {
/// Can be used for first row indentation.
pub leading_space: f32,
/// Range into the galley text
pub byte_range: Range<usize>,
pub format: TextFormat,
}
@@ -218,12 +220,18 @@ impl std::hash::Hash for LayoutSection {
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct TextFormat {
pub font_id: FontId,
/// Text color
pub color: Color32,
pub background: Color32,
pub italics: bool,
pub underline: Stroke,
pub strikethrough: Stroke,
/// If you use a small font and [`Align::TOP`] you
/// can get the effect of raised text.
pub valign: Align,