Struct Typography
pub struct Typography {
pub sans_family: String,
pub serif_family: String,
pub mono_family: String,
pub distinct_letters: bool,
/* private fields */
}Expand description
A theme’s type: three families and the scale every role derives from.
Fields§
§sans_family: String§serif_family: String§mono_family: String§distinct_letters: bool“Always distinguish similar letters”, resolved: every look-alike (I,
l, 1 and 0, O) set apart in all text, not only in identifiers, codes
and links. From the theme’s type role
(crate::theme::ThemeType::distinguishes_letters) and the
accessibility layer; the renderer applies it
(crate::text_render::TextRenderer::set_distinct_letters).
Implementations§
§impl Typography
impl Typography
pub fn set_face(&mut self, face: &str)
pub fn set_face(&mut self, face: &str)
Set the UI face from a theme document’s type role: a built-in face
by name (UiFace::name) or any installed family by its name.
pub fn with_face(self, face: &str) -> Typography
pub fn with_face(self, face: &str) -> Typography
This typography with the UI face face (Self::set_face).
pub fn face_name(&self) -> String
pub fn face_name(&self) -> String
The UI face as a theme document names it: a built-in face’s name, or the family name of any other face.
pub fn set_reading_face(&mut self, face: &str)
pub fn set_reading_face(&mut self, face: &str)
Set the reading face from a theme document’s type role: a built-in
face by name (ReadingFace::name) or any installed family by its
name.
pub fn with_reading_face(self, face: &str) -> Typography
pub fn with_reading_face(self, face: &str) -> Typography
This typography with the reading face face
(Self::set_reading_face).
pub fn reading_face_name(&self) -> String
pub fn reading_face_name(&self) -> String
The reading face as a theme document names it: a built-in face’s name, or the family name of any other face.
pub fn ground(&self) -> TextGround
pub fn ground(&self) -> TextGround
The ground the theme’s roles are set on (TextGround).
pub fn set_ground(&mut self, ground: TextGround)
pub fn set_ground(&mut self, ground: TextGround)
Set the ground the theme’s roles are set on: the theme’s content ground, or the ground a widget’s container hands it.
pub fn with_base_size(self, body_px: f32) -> Typography
pub fn with_base_size(self, body_px: f32) -> Typography
Set the 1× body size every role derives from. Theme authors call this on a fresh theme, before the text or UI scale is applied.
pub fn style(&self, role: TextRole) -> TextStyle
pub fn style(&self, role: TextRole) -> TextStyle
Resolve a role into the complete style consumed by both text
measurement and painting. The size already carries the theme’s UI and
text scale, so the style is TextScaling::Resolved.
pub fn size(&self, role: TextRole) -> f32
pub fn size(&self, role: TextRole) -> f32
The resolved size of role, for a custom painter that has to size
geometry (an icon, a swatch) against a line of that role. Paint the
text itself with Self::style.
Trait Implementations§
§impl Clone for Typography
impl Clone for Typography
§fn clone(&self) -> Typography
fn clone(&self) -> Typography
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for Typography
impl Debug for Typography
§impl Default for Typography
impl Default for Typography
§fn default() -> Typography
fn default() -> Typography
§impl PartialEq for Typography
impl PartialEq for Typography
impl StructuralPartialEq for Typography
Auto Trait Implementations§
impl Freeze for Typography
impl RefUnwindSafe for Typography
impl Send for Typography
impl Sync for Typography
impl Unpin for Typography
impl UnsafeUnpin for Typography
impl UnwindSafe for Typography
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> 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