Struct zng_ext_font::HYPHENATION
source · pub struct HYPHENATION;
Expand description
Hyphenation service.
Note that dictionary data is required to support a language, if the feature "hyphenation_embed_all"
is enabled
dictionaries for all supported languages is embedded, otherwise dictionaries must be loaded using a HyphenationDataSource
.
You can use the HyphenationDataDir
to use external files, see the hyphenation
for more details about the data files.
Implementations§
source§impl HYPHENATION
impl HYPHENATION
sourcepub fn init_data_source(&self, source: impl HyphenationDataSource)
pub fn init_data_source(&self, source: impl HyphenationDataSource)
Set the hyphenation dictionaries source and clear cache.
Note that this applies immediately and does not notify, it should only be called once during app init.
sourcepub fn hyphenate(&self, lang: &Lang, word: &str) -> Vec<usize>
pub fn hyphenate(&self, lang: &Lang, word: &str) -> Vec<usize>
Try to hyphenate the word
using the lang
dictionary and rules.
Returns a vector of indexes that allow a line break.
sourcepub fn hyphenate_opt(&self, lang: &Lang, word: &str) -> Option<Vec<usize>>
pub fn hyphenate_opt(&self, lang: &Lang, word: &str) -> Option<Vec<usize>>
Try to hyphenate the word
using the lang
dictionary and rules.
Returns a vector of indexes that allow a line break. Returns None
if the lang
is not supported or the
word
contains non-word characters.
sourcepub fn lang_to_hyphenation_language(&self, lang: &Lang) -> Option<Language>
pub fn lang_to_hyphenation_language(&self, lang: &Lang) -> Option<Language>
Get the best hyphenation::Language
for the lang
.
Auto Trait Implementations§
impl Freeze for HYPHENATION
impl RefUnwindSafe for HYPHENATION
impl Send for HYPHENATION
impl Sync for HYPHENATION
impl Unpin for HYPHENATION
impl UnwindSafe for HYPHENATION
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more