Struct zng::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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for 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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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