Skip to content

Commit

Permalink
Small doc tweaks. (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Aug 10, 2024
1 parent 9af2072 commit db89c81
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion parley/src/bidi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions parley/src/inline_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions parley/src/layout/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions parley/src/layout/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion parley/src/layout/line/greedy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion parley/src/layout/line/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions parley/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<B: Brush> Layout<B> {
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()
}
Expand Down Expand Up @@ -119,7 +119,7 @@ impl<B: Brush> Layout<B> {
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<f32>) {
self.break_lines()
.break_remaining(max_advance.unwrap_or(f32::MAX));
Expand Down
4 changes: 2 additions & 2 deletions parley/src/layout/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit db89c81

Please sign in to comment.