From db89c81d34d13c8f3d69941a228d776b31554115 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 10 Aug 2024 17:22:36 +0700 Subject: [PATCH] Small doc tweaks. (#102) --- README.md | 6 +++--- parley/src/bidi.rs | 2 +- parley/src/inline_box.rs | 4 ++-- parley/src/layout/cluster.rs | 12 ++++++------ parley/src/layout/cursor.rs | 4 ++-- parley/src/layout/line/greedy.rs | 2 +- parley/src/layout/line/mod.rs | 2 +- parley/src/layout/mod.rs | 4 ++-- parley/src/layout/run.rs | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 6ee08c00..948401a4 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ It also means collecting metadata about those fonts: whether they are serif, san The library is responsible for loading fonts into memory; it will use memory-mapped IO to load portions into memory lazily and share them between processes on the system. **Font fallback** is matching runs of text to a font. -This is necessary because fonts typically don't cover the entire unicode range: you have different fonts for latin text, chinese text, arabic text, etc and also usually a separate font for emoji. +This is necessary because fonts typically don't cover the entire Unicode range: you have different fonts for latin text, chinese text, arabic text, etc and also usually a separate font for emoji. But if you have, say arabic text or emoji embedded within latin text, you don't typically specify the font for the arabic text or the emoji, one is chosen for you. Font fallback is the process which makes that choice. @@ -50,9 +50,9 @@ Notably it converts the raw glyph representations in font files into scaled, hin ### Swash -Swash implements text shaping and [some miscellaneous unicode-related features](https://github.com/dfrg/swash#text-analysis). +Swash implements text shaping and [some miscellaneous Unicode-related features](https://github.com/dfrg/swash#text-analysis). -**Text shaping** means mapping runs of unicode codepoints to specific glyphs within fonts. +**Text shaping** means mapping runs of Unicode codepoints to specific glyphs within fonts. This includes applying ligatures, resolving emoji modifiers, but also much more complex transformations for some scripts. Swash's implementation is faster but less complete and tested than Harfbuzz and Rustybuzz. diff --git a/parley/src/bidi.rs b/parley/src/bidi.rs index 57335443..daffa820 100644 --- a/parley/src/bidi.rs +++ b/parley/src/bidi.rs @@ -12,7 +12,7 @@ use BidiClass::*; /// Type alias for a bidirectional level. pub type BidiLevel = u8; -/// Resolver for the unicode bidirectional algorithm. +/// Resolver for the Unicode bidirectional algorithm. #[derive(Clone, Default)] pub struct BidiResolver { base_level: BidiLevel, diff --git a/parley/src/inline_box.rs b/parley/src/inline_box.rs index 23dd6315..9731fd9e 100644 --- a/parley/src/inline_box.rs +++ b/parley/src/inline_box.rs @@ -5,10 +5,10 @@ #[derive(Debug, Clone)] pub struct InlineBox { /// User-specified identifier for the box, which can be used by the user to determine which box in - /// parley's output corresponds to which box in it's input. + /// parley's output corresponds to which box in its input. pub id: u64, /// The byte offset into the underlying text string at which the box should be placed. - /// This must not be within a unicode code point. + /// This must not be within a Unicode code point. pub index: usize, /// The width of the box in pixels pub width: f32, diff --git a/parley/src/layout/cluster.rs b/parley/src/layout/cluster.rs index aa6b588c..98650540 100644 --- a/parley/src/layout/cluster.rs +++ b/parley/src/layout/cluster.rs @@ -14,32 +14,32 @@ impl<'a, B: Brush> Cluster<'a, B> { self.data.advance } - /// Returns true if the cluster is the beginning of a ligature. + /// Returns `true` if the cluster is the beginning of a ligature. pub fn is_ligature_start(&self) -> bool { self.data.is_ligature_start() } - /// Returns true if the cluster is a ligature continuation. + /// Returns `true` if the cluster is a ligature continuation. pub fn is_ligature_continuation(&self) -> bool { self.data.is_ligature_component() } - /// Returns true if the cluster is a word boundary. + /// Returns `true` if the cluster is a word boundary. pub fn is_word_boundary(&self) -> bool { self.data.info.is_boundary() } - /// Returns true if the cluster is a soft line break. + /// Returns `true` if the cluster is a soft line break. pub fn is_soft_line_break(&self) -> bool { self.data.info.boundary() == Boundary::Line } - /// Returns true if the cluster is a hard line break. + /// Returns `true` if the cluster is a hard line break. pub fn is_hard_line_break(&self) -> bool { self.data.info.boundary() == Boundary::Mandatory } - /// Returns true if the cluster is a space or no-break space. + /// Returns `true` if the cluster is a space or no-break space. pub fn is_space_or_nbsp(&self) -> bool { self.data.info.whitespace().is_space_or_nbsp() } diff --git a/parley/src/layout/cursor.rs b/parley/src/layout/cursor.rs index 5e063f40..83064e2f 100644 --- a/parley/src/layout/cursor.rs +++ b/parley/src/layout/cursor.rs @@ -144,13 +144,13 @@ impl Cursor { result } - /// Returns true if the cursor is on the leading edge of the target + /// Returns `true` if the cursor is on the leading edge of the target /// cluster. pub fn is_leading(&self) -> bool { self.text_start == self.insert_point } - /// Returns true if the cursor is on the trailing edge of the target + /// Returns `true` if the cursor is on the trailing edge of the target /// cluster. pub fn is_trailing(&self) -> bool { self.text_end == self.insert_point diff --git a/parley/src/layout/line/greedy.rs b/parley/src/layout/line/greedy.rs index 1d83da55..ffce5eb2 100644 --- a/parley/src/layout/line/greedy.rs +++ b/parley/src/layout/line/greedy.rs @@ -496,7 +496,7 @@ impl<'a, B: Brush> BreakLines<'a, B> { continue; } - // Compute the run's advance by summing the advances of it's constituent clusters + // Compute the run's advance by summing the advances of its constituent clusters line_item.advance = self.layout.clusters[line_item.cluster_range.clone()] .iter() .map(|c| c.advance) diff --git a/parley/src/layout/line/mod.rs b/parley/src/layout/line/mod.rs index eaf15f3b..9f1e3349 100644 --- a/parley/src/layout/line/mod.rs +++ b/parley/src/layout/line/mod.rs @@ -21,7 +21,7 @@ impl<'a, B: Brush> Line<'a, B> { self.data.item_range.len() } - /// Returns true if the line is empty. + /// Returns `true` if the line is empty. pub fn is_empty(&self) -> bool { self.data.item_range.is_empty() } diff --git a/parley/src/layout/mod.rs b/parley/src/layout/mod.rs index 5d01d77b..633b8835 100644 --- a/parley/src/layout/mod.rs +++ b/parley/src/layout/mod.rs @@ -85,7 +85,7 @@ impl Layout { self.data.lines.len() } - /// Returns true if the layout is empty. + /// Returns `true` if the layout is empty. pub fn is_empty(&self) -> bool { self.data.lines.is_empty() } @@ -119,7 +119,7 @@ impl Layout { BreakLines::new(&mut self.data) } - /// Breaks all lines with the specified maximum advance + /// Breaks all lines with the specified maximum advance. pub fn break_all_lines(&mut self, max_advance: Option) { self.break_lines() .break_remaining(max_advance.unwrap_or(f32::MAX)); diff --git a/parley/src/layout/run.rs b/parley/src/layout/run.rs index 98a40dc1..43c8305c 100644 --- a/parley/src/layout/run.rs +++ b/parley/src/layout/run.rs @@ -60,7 +60,7 @@ impl<'a, B: Brush> Run<'a, B> { .clone() } - /// Returns true if the run has right-to-left directionality. + /// Returns `true` if the run has right-to-left directionality. pub fn is_rtl(&self) -> bool { self.data.bidi_level & 1 != 0 } @@ -78,7 +78,7 @@ impl<'a, B: Brush> Run<'a, B> { self.cluster_range().len() } - /// Returns true if the run is empty. + /// Returns `true` if the run is empty. pub fn is_empty(&self) -> bool { self.len() == 0 }