Skip to content

Commit

Permalink
Use intradoc links, suppress generated doc warnings. (#218)
Browse files Browse the repository at this point in the history
* harfbuzz-sys: Suppress doc warnings from generated bindings.

* docs: Update to intradoc link syntax.
  • Loading branch information
waywardmonkeys authored Aug 19, 2023
1 parent a6b33af commit 1c883c5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 48 deletions.
2 changes: 2 additions & 0 deletions harfbuzz-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ extern "C" {
#[allow(non_snake_case)]
#[allow(non_upper_case_globals)]
#[allow(clippy::unreadable_literal)]
#[allow(rustdoc::bare_urls)]
#[allow(rustdoc::broken_intra_doc_links)]
mod bindings;

pub use crate::bindings::*;
47 changes: 21 additions & 26 deletions harfbuzz/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,20 @@ use crate::{Direction, Language};
///
/// * Direction: The direction in which the output glyphs flow. This is
/// typically left to right or right to left. This is controlled via
/// the [`set_direction`] method on `Buffer`.
/// the [`Buffer::set_direction()`] method.
/// * Script: Script is crucial for choosing the proper shaping behaviour
/// for scripts that require it (e.g. Arabic) and the which OpenType
/// features defined in the font to be applied. This is controlled via
/// the [`set_script`] method on `Buffer`.
/// the [`Buffer::set_script()`] method.
/// * Language: Languages are crucial for selecting which OpenType feature
/// to apply to the buffer which can result in applying language-specific
/// behaviour. Languages are orthogonal to the scripts, and though they
/// are related, they are different concepts and should not be confused
/// with each other. This is controlled via the [`set_language`] method
/// on `Buffer`.
/// with each other. This is controlled via the [`Buffer::set_language()`]
/// method.
///
/// Additionally, Harfbuzz can attempt to infer the values for these
/// properties using the [`guess_segment_properties`] method on `Buffer`:
/// properties using the [`Buffer::guess_segment_properties()`] method:
///
/// ```
/// # use harfbuzz::{Buffer, Direction, sys};
Expand All @@ -61,11 +61,6 @@ use crate::{Direction, Language};
/// assert_eq!(b.get_direction(), Direction::RTL);
/// assert_eq!(b.get_script(), sys::HB_SCRIPT_ARABIC);
/// ```
///
/// [`set_direction`]: #method.set_direction
/// [`set_script`]: #method.set_script
/// [`set_language`]: #method.set_language
/// [`guess_segment_properties`]: #method.guess_segment_properties
pub struct Buffer {
/// The underlying `hb_buffer_t` from the `harfbuzz-sys` crate.
///
Expand Down Expand Up @@ -193,7 +188,7 @@ impl Buffer {
/// that has a script other than `HB_SCRIPT_COMMON`,
/// `HB_SCRIPT_INHERITED`, and `HB_SCRIPT_UNKNOWN`.
///
/// Next, if buffer direction is not set (ie. is `Direction::Invalid`),
/// Next, if buffer direction is not set (ie. is [`Direction::Invalid`]),
/// it will be set to the natural horizontal direction of the buffer
/// script as returned by `hb_script_get_horizontal_direction()`.
///
Expand All @@ -212,12 +207,12 @@ impl Buffer {
///
/// See also:
///
/// * [`get_direction`](#method.get_direction)
/// * [`set_direction`](#method.set_direction)
/// * [`get_script`](#method.get_script)
/// * [`set_script`](#method.set_script)
/// * [`get_language`](#method.get_language)
/// * [`set_language`](#method.set_language)
/// * [`Buffer::get_direction`]
/// * [`Buffer::set_direction`]
/// * [`Buffer::get_script`]
/// * [`Buffer::set_script`]
/// * [`Buffer::get_language`]
/// * [`Buffer::set_language`]
pub fn guess_segment_properties(&mut self) {
unsafe { sys::hb_buffer_guess_segment_properties(self.raw) };
}
Expand All @@ -234,8 +229,8 @@ impl Buffer {
///
/// See also:
///
/// * [`get_direction`](#method.get_direction)
/// * [`guess_segment_properties`](#method.guess_segment_properties)
/// * [`Buffer::get_direction()`]
/// * [`Buffer::guess_segment_properties()`]
pub fn set_direction(&mut self, direction: Direction) {
unsafe { sys::hb_buffer_set_direction(self.raw, direction.into()) };
}
Expand All @@ -244,7 +239,7 @@ impl Buffer {
///
/// See also:
///
/// * [`set_direction`](#method.set_direction)
/// * [`Buffer::set_direction()`]
pub fn get_direction(&self) -> Direction {
(unsafe { sys::hb_buffer_get_direction(self.raw) }).into()
}
Expand All @@ -257,8 +252,8 @@ impl Buffer {
///
/// See also:
///
/// * [`get_script`](#method.get_script)
/// * [`guess_segment_properties`](#method.guess_segment_properties)
/// * [`Buffer::get_script()`]
/// * [`Buffer::guess_segment_properties()`]
pub fn set_script(&mut self, script: sys::hb_script_t) {
unsafe { sys::hb_buffer_set_script(self.raw, script) };
}
Expand All @@ -267,7 +262,7 @@ impl Buffer {
///
/// See also:
///
/// * [`set_script`](#method.set_script)
/// * [`Buffer::set_script()`]
pub fn get_script(&self) -> sys::hb_script_t {
unsafe { sys::hb_buffer_get_script(self.raw) }
}
Expand All @@ -282,8 +277,8 @@ impl Buffer {
///
/// See also:
///
/// * [`get_language`](#method.get_language)
/// * [`guess_segment_properties`](#method.guess_segment_properties)
/// * [`Buffer::get_language()`]
/// * [`Buffer::guess_segment_properties()`]
pub fn set_language(&mut self, language: Language) {
unsafe { sys::hb_buffer_set_language(self.raw, language.as_raw()) };
}
Expand All @@ -292,7 +287,7 @@ impl Buffer {
///
/// See also:
///
/// * [`set_language`](#method.set_language)
/// * [`Buffer::set_language()`]
pub fn get_language(&self) -> Language {
unsafe { Language::from_raw(sys::hb_buffer_get_language(self.raw)) }
}
Expand Down
29 changes: 7 additions & 22 deletions harfbuzz/src/direction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::sys;

/// Direction of text flow during layout.
///
/// This maps to the [`hb_direction_t`] from
/// [`harfbuzz-sys`]. It can be converted to
/// This maps to the [`hb_direction_t`](crate::sys::hb_direction_t) from
/// [`harfbuzz-sys`](crate::sys). It can be converted to
/// or from `hb_direction_t` using the [`From`]
/// and [`Into`] traits:
///
Expand All @@ -27,42 +27,27 @@ use crate::sys;
/// let dir: Direction = sys::HB_DIRECTION_TTB.into();
/// assert_eq!(dir, Direction::TTB);
/// ```
///
/// [`hb_direction_t`]: ../harfbuzz_sys/type.hb_direction_t.html
/// [`harfbuzz-sys`]: ../harfbuzz_sys/index.html
/// [`From`]: https://doc.rust-lang.org/std/convert/trait.From.html
/// [`Into`]: https://doc.rust-lang.org/std/convert/trait.Into.html
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
pub enum Direction {
/// Initial, unset direction.
///
/// This corresponds to [`HB_DIRECTION_INVALID`].
///
/// [`HB_DIRECTION_INVALID`]: ../harfbuzz_sys/constant.HB_DIRECTION_INVALID.html
/// This corresponds to [`HB_DIRECTION_INVALID`](crate::sys::HB_DIRECTION_INVALID).
Invalid,
/// Text is set horizontally from left to right.
///
/// This corresponds to [`HB_DIRECTION_LTR`].
///
/// [`HB_DIRECTION_LTR`]: ../harfbuzz_sys/constant.HB_DIRECTION_LTR.html
/// This corresponds to [`HB_DIRECTION_LTR`](crate::sys::HB_DIRECTION_LTR).
LTR,
/// Text is set horizontally from right to left.
///
/// This corresponds to [`HB_DIRECTION_RTL`].
///
/// [`HB_DIRECTION_RTL`]: ../harfbuzz_sys/constant.HB_DIRECTION_RTL.html
/// This corresponds to [`HB_DIRECTION_RTL`](crate::sys::HB_DIRECTION_RTL).
RTL,
/// Text is set vertically from top to bottom.
///
/// This corresponds to [`HB_DIRECTION_TTB`].
///
/// [`HB_DIRECTION_TTB`]: ../harfbuzz_sys/constant.HB_DIRECTION_TTB.html
/// This corresponds to [`HB_DIRECTION_TTB`](crate::sys::HB_DIRECTION_TTB).
TTB,
/// Text is set vertically from bottom to top.
///
/// This corresponds to [`HB_DIRECTION_BTT`].
///
/// [`HB_DIRECTION_BTT`]: ../harfbuzz_sys/constant.HB_DIRECTION_BTT.html
/// This corresponds to [`HB_DIRECTION_BTT`](crate::sys::HB_DIRECTION_BTT).
BTT,
}

Expand Down

0 comments on commit 1c883c5

Please sign in to comment.