pub struct Text { /* private fields */ }Expand description
A piece of text rendered as voxels.
Each Text contains:
- A string, as
ArcStr. - A
Font. Blocks defining voxel colors and attributes used.- A
Resolutiondefining the font size. - A bounding box within which the text is positioned (but may overflow).
- A
Positioningspecifying how the text is positioned within the box.
To create a block or multiblock group from this, use Primitive::Text.
To combine the text with other shapes, use Modifier::Composite.
Implementations§
Source§impl Text
impl Text
Sourcepub fn builder() -> TextBuilder
pub fn builder() -> TextBuilder
Returns a TextBuilder which may be used to construct a Text value with explicit
or default options.
Sourcepub fn into_builder(self) -> TextBuilder
pub fn into_builder(self) -> TextBuilder
Converts this into a TextBuilder so that it may be modified.
Sourcepub fn resolution(&self) -> &Font
pub fn resolution(&self) -> &Font
Returns the voxel resolution which the text blocks will have.
Sourcepub fn layout_bounds(&self) -> GridAab
pub fn layout_bounds(&self) -> GridAab
Returns the bounding box, within the blocks at the specified resolution, of the text.
This does not reflect the actual size of the text but the configuration with which this
Text value was constructed.
The text may overflow this bounding box depending on its length and the
positioning().
Sourcepub fn positioning(&self) -> Positioning
pub fn positioning(&self) -> Positioning
Returns the Positioning parameters this uses.
Sourcepub fn bounding_voxels(&self) -> GridAab
pub fn bounding_voxels(&self) -> GridAab
Returns the bounding box of the text as displayed, in voxels at the
resolution().
This box is in the same units as Self::layout_bounds() but reflects the actual text
layout rather than the configuration.
Sourcepub fn bounding_blocks(&self) -> GridAab
pub fn bounding_blocks(&self) -> GridAab
Returns the bounding box of the text, in blocks — the set of Primitive::Text offsets
that will render all of it.
This is identical to Self::bounding_voxels() scaled down by Self::resolution().
Sourcepub fn installation(
&self,
transform: Gridgid,
block_fn: impl Fn(Block) -> Block,
) -> SpaceTransaction
pub fn installation( &self, transform: Gridgid, block_fn: impl Fn(Block) -> Block, ) -> SpaceTransaction
Returns a transaction which places Primitive::Text blocks containing this text.
The text lies within the volume Self::bounding_blocks() transformed by transform.
Each individual block is given to block_fn to allow alterations.
The transaction has no preconditions.
Panics if transform causes coordinate overflow.
Sourcepub fn single_block(self) -> Block
pub fn single_block(self) -> Block
Returns a Block whose primitive is this text with no offset,
for quickly creating blocks from text that fits in one block.
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for Text
Available on crate feature arbitrary only.
impl<'a> Arbitrary<'a> for Text
arbitrary only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read moreSource§impl VisitHandles for Text
impl VisitHandles for Text
Source§fn visit_handles(&self, visitor: &mut dyn HandleVisitor)
fn visit_handles(&self, visitor: &mut dyn HandleVisitor)
impl Eq for Text
impl StructuralPartialEq for Text
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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