Skip to main content

HyphenationDictionaryStore

Struct HyphenationDictionaryStore 

Source
pub struct HyphenationDictionaryStore { /* private fields */ }
Expand description

Hyphenation dictionaries by language. Dictionaries that the app registers are used first, and a dictionary embedded in the build is the fallback when text-hyphenation-embedded is on.

Implementations§

Source§

impl HyphenationDictionaryStore

Source

pub fn new() -> Self

Creates a store with no registered dictionaries.

Source

pub fn register_dictionary_path( &self, locale: &str, path: impl AsRef<Path>, ) -> Result<(), HyphenationDictionaryError>

Registers the dictionary for locale read from the file at path, replacing an earlier one.

Source

pub fn register_dictionary_reader( &self, locale: &str, reader: &mut impl Read, ) -> Result<(), HyphenationDictionaryError>

Registers the dictionary for locale read from reader, replacing an earlier one.

Source

pub fn choose_auto_hyphen_break( &self, line: &str, style: &TextStyle, segment_start_char: usize, measured_break_char: usize, ) -> Option<usize>

Chooses where to hyphenate the word that contains the break at character measured_break_char of line. segment_start_char is the character index where the current line segment starts, and the language comes from the first locale of style, English when it has none. Returns the character index of the break, at least two characters after the segment start and not after measured_break_char, or None when the break is not inside a word or no dictionary is available.

Trait Implementations§

Source§

impl Default for HyphenationDictionaryStore

Available on crate feature text-hyphenation only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.