From 75d10aeae1b9118df1739ec5042536754c7bf49c Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Wed, 15 May 2024 01:24:10 +0700 Subject: [PATCH] Use intra-doc link syntax and fix 2 broken links. (#104) --- glyph/src/font.rs | 32 ++++++++++++++++---------------- glyph/src/scale.rs | 8 ++++---- glyph/src/ttfp.rs | 16 ++++++++-------- rasterizer/src/geometry.rs | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/glyph/src/font.rs b/glyph/src/font.rs index 5f489fd..3025c65 100644 --- a/glyph/src/font.rs +++ b/glyph/src/font.rs @@ -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 /// @@ -58,17 +58,17 @@ 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() @@ -76,45 +76,45 @@ pub trait Font { /// 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. @@ -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 /// ``` @@ -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>(self, scale: S) -> PxScaleFont where @@ -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 diff --git a/glyph/src/scale.rs b/glyph/src/scale.rs index 27e2bcc..31875e5 100644 --- a/glyph/src/scale.rs +++ b/glyph/src/scale.rs @@ -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 @@ -135,7 +135,7 @@ pub trait ScaleFont { 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 @@ -207,7 +207,7 @@ pub trait ScaleFont { /// 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. @@ -237,7 +237,7 @@ impl> ScaleFont 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 { pub font: F, diff --git a/glyph/src/ttfp.rs b/glyph/src/ttfp.rs index efece69..5b021f7 100644 --- a/glyph/src/ttfp.rs +++ b/glyph/src/ttfp.rs @@ -18,9 +18,9 @@ impl From 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 /// ``` @@ -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 /// ``` @@ -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 /// ``` @@ -81,9 +81,9 @@ impl<'font> FontRef<'font> { } /// Font data handle stored in a `Vec` + 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 /// ``` @@ -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 /// ``` @@ -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 /// ``` diff --git a/rasterizer/src/geometry.rs b/rasterizer/src/geometry.rs index d943423..456cbf6 100644 --- a/rasterizer/src/geometry.rs +++ b/rasterizer/src/geometry.rs @@ -28,7 +28,7 @@ impl Point { } } -/// [`Point`](struct.Point.html) constructor. +/// [`Point`] constructor. /// /// # Example /// ```