[−][src]Struct kas_text::Environment
Environment in which text is prepared for display
An Environment
can be default-constructed (without line-wrapping).
Fields
flags: EnvFlags
Flags enabling/disabling certain features
Bidirectional text
If enabled, right-to-left text embedded within left-to-right text and LTR within RTL will be re-ordered according to the Unicode Bidirectional Algorithm (Unicode Technical Report #9).
If disabled, the base paragraph direction may be LTR or RTL depending on
Environment::dir
, but embedded text is not re-ordered.
Default value: true
. This should normally be enabled unless there is
a specific reason to disable it.
Line wrapping
By default, this is true and long text lines are wrapped based on the
width bounds. If set to false, lines are not wrapped at the width
boundary, but explicit line-breaks such as \n
still result in new
lines.
dir: Direction
Default text direction
Usually this may be left to its default value of Direction::Auto
.
If bidi == true
, this parameter sets the "paragraph embedding level"
(whose main affect is on lines without strongly-directional characters).
If bidi == false
this directly sets the line direction, unless
dir == Auto
, in which case direction is auto-detected.
dpp: f32
Pixels-per-point
This is a scaling factor used to convert font sizes (in points) to a
size in pixels (dots). Units are pixels/point
. See crate::fonts
documentation.
Default value: 96.0 / 72.0
pt_size: f32
Default font size in points
We use "point sizes" (Points per Em), since this is a widely used
measure of font size. See crate::fonts
module documentation.
Default value: 11.0
bounds: Vec2
The available (horizontal and vertical) space
This defaults to infinity (implying no bounds). To enable line-wrapping set at least a horizontal bound. The vertical bound is required for alignment (when aligning to the centre or bottom). Glyphs outside of these bounds may not be drawn.
align: (Align, Align)
Alignment (horiz, vert)
By default, horizontal alignment is left or right depending on the
text direction (see Environment::dir
), and vertical alignment is
to the top.
Implementations
impl Environment
[src]
pub fn height(&self, font_id: FontId) -> f32
[src]
Returns the height of standard horizontal text
This depends on the pt_size
and dpp
fields.
To use "the standard font", use Default::default()
.
impl Environment
[src]
Trait Implementations
impl Clone for Environment
[src]
pub fn clone(&self) -> Environment
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Environment
[src]
impl Default for Environment
[src]
impl PartialEq<Environment> for Environment
[src]
pub fn eq(&self, other: &Environment) -> bool
[src]
pub fn ne(&self, other: &Environment) -> bool
[src]
impl StructuralPartialEq for Environment
[src]
Auto Trait Implementations
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,