Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use intra-doc link syntax and fix 2 broken links. #104

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions glyph/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::{

/// Functionality required from font data.
///
/// See also [`FontArc`](struct.FontArc.html), [`FontRef`](struct.FontRef.html)
/// and [`FontVec`](struct.FontVec.html).
/// See also [`FontArc`](crate::FontArc), [`FontRef`](crate::FontRef)
/// and [`FontVec`](crate::FontVec).
///
/// ## Units
///
Expand Down Expand Up @@ -58,63 +58,63 @@ pub trait Font {

/// Unscaled glyph ascent.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn ascent_unscaled(&self) -> f32;

/// Unscaled glyph descent.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn descent_unscaled(&self) -> f32;

/// Unscaled height `ascent - descent`.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
#[inline]
fn height_unscaled(&self) -> f32 {
self.ascent_unscaled() - self.descent_unscaled()
}

/// Unscaled line gap.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn line_gap_unscaled(&self) -> f32;

/// Lookup a `GlyphId` matching a given `char`.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn glyph_id(&self, c: char) -> GlyphId;

/// Unscaled horizontal advance for a given glyph id.
///
/// Returns `0.0` if the font does not define this value.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn h_advance_unscaled(&self, id: GlyphId) -> f32;

/// Unscaled horizontal side bearing for a given glyph id.
///
/// Returns `0.0` if the font does not define this value.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn h_side_bearing_unscaled(&self, id: GlyphId) -> f32;

/// Unscaled vertical advance for a given glyph id.
///
/// Returns `0.0` if the font does not define this value.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn v_advance_unscaled(&self, id: GlyphId) -> f32;

/// Unscaled vertical side bearing for a given glyph id.
///
/// Returns `0.0` if the font does not define this value.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn v_side_bearing_unscaled(&self, id: GlyphId) -> f32;

/// Returns additional unscaled kerning to apply for a particular pair of glyph ids.
///
/// Scaling can be done with [as_scaled](trait.Font.html#method.as_scaled).
/// Scaling can be done with [`as_scaled`](Self::as_scaled).
fn kern_unscaled(&self, first: GlyphId, second: GlyphId) -> f32;

/// Compute unscaled glyph outline curves & bounding box.
Expand Down Expand Up @@ -216,8 +216,7 @@ pub trait Font {
Some(OutlinedGlyph::new(glyph, outline, scale_factor))
}

/// Construct a [`PxScaleFontRef`](struct.PxScaleFontRef.html) by associating with the
/// given pixel `scale`.
/// Construct a [`PxScaleFont`] by associating with the given pixel `scale`.
///
/// # Example
/// ```
Expand All @@ -242,8 +241,7 @@ pub trait Font {
}
}

/// Move into a [`PxScaleFont`](struct.PxScaleFont.html) associated with the
/// given pixel `scale`.
/// Move into a [`PxScaleFont`] associated with the given pixel `scale`.
#[inline]
fn into_scaled<S: Into<PxScale>>(self, scale: S) -> PxScaleFont<Self>
where
Expand All @@ -266,6 +264,8 @@ pub trait Font {
/// assert_eq!(font.font_data(), owned_font_data);
/// # Ok(()) }
/// ```
///
/// [`FontArc::try_from_slice`]: crate::FontArc::try_from_slice
#[inline]
fn font_data(&self) -> &[u8] {
// panic impl prevents this method from breaking external Font impls
Expand Down
8 changes: 4 additions & 4 deletions glyph/src/scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct PxScaleFactor {
pub vertical: f32,
}

/// A [`Font`](trait.Font.html) with an associated pixel scale. This can be used to provide
/// A [`Font`] with an associated pixel scale. This can be used to provide
/// pixel scale values for glyph advances, heights etc.
///
/// # Example
Expand Down Expand Up @@ -135,7 +135,7 @@ pub trait ScaleFont<F: Font> {
self.font().glyph_id(c)
}

/// Construct a [`Glyph`](struct.Glyph.html) with the font's pixel scale at
/// Construct a [`Glyph`] with the font's pixel scale at
/// position `point(0.0, 0.0)`.
///
/// # Example
Expand Down Expand Up @@ -207,7 +207,7 @@ pub trait ScaleFont<F: Font> {

/// Returns an iterator of all distinct `(GlyphId, char)` pairs. Not ordered.
///
/// Same as [`Font::codepoint_ids`](trait.Font.html#tymethod.codepoint_ids).
/// Same as [`Font::codepoint_ids`].
fn codepoint_ids(&self) -> crate::CodepointIdIter<'_>;

/// Compute glyph outline ready for drawing.
Expand Down Expand Up @@ -237,7 +237,7 @@ impl<F: Font, SF: ScaleFont<F>> ScaleFont<F> for &SF {
}
}

/// A [`Font`](trait.Font.html) and an associated pixel scale.
/// A [`Font`] and an associated pixel scale.
#[derive(Clone, Copy, Debug)]
pub struct PxScaleFont<F> {
pub font: F,
Expand Down
16 changes: 8 additions & 8 deletions glyph/src/ttfp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ impl From<GlyphId> for ttfp::GlyphId {
}

/// Font data handle stored as a `&[u8]` + parsed data.
/// See [`Font`](trait.Font.html) for more methods.
/// See [`Font`] for more methods.
///
/// Also see the owned version [`FontVec`](struct.FontVec.html).
/// Also see the owned version [`FontVec`].
///
/// # Example
/// ```
Expand All @@ -45,7 +45,7 @@ impl<'font> FontRef<'font> {
/// Creates an `FontRef` from a byte-slice.
///
/// For font collections see
/// [`FontRef::try_from_slice_and_index`](#method.try_from_slice_and_index).
/// [`FontRef::try_from_slice_and_index`].
///
/// # Example
/// ```
Expand All @@ -62,7 +62,7 @@ impl<'font> FontRef<'font> {
/// Creates an `FontRef` from byte-slice.
///
/// You can set index for font collections. For simple fonts use `0` or
/// [`FontRef::try_from_slice`](#method.try_from_slice).
/// [`FontRef::try_from_slice`].
///
/// # Example
/// ```
Expand All @@ -81,9 +81,9 @@ impl<'font> FontRef<'font> {
}

/// Font data handle stored in a `Vec<u8>` + parsed data.
/// See [`Font`](trait.Font.html) for more methods.
/// See [`Font`] for more methods.
///
/// Also see [`FontRef`](struct.FontRef.html).
/// Also see [`FontRef`].
///
/// # Example
/// ```
Expand All @@ -108,7 +108,7 @@ impl FontVec {
/// Creates an `FontVec` from owned data.
///
/// For font collections see
/// [`FontVec::try_from_vec_and_index`](#method.try_from_vec_and_index).
/// [`FontVec::try_from_vec_and_index`].
///
/// # Example
/// ```
Expand All @@ -126,7 +126,7 @@ impl FontVec {
/// Creates an `FontVec` from owned data.
///
/// You can set index for font collections. For simple fonts use `0` or
/// [`FontVec::try_from_vec`](#method.try_from_vec).
/// [`FontVec::try_from_vec`].
///
/// # Example
/// ```
Expand Down
2 changes: 1 addition & 1 deletion rasterizer/src/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl Point {
}
}

/// [`Point`](struct.Point.html) constructor.
/// [`Point`] constructor.
///
/// # Example
/// ```
Expand Down