Expand description
§Cranpose Text
cranpose-text holds the values text is described with, as Compose’s
ui-text does: TextStyle with its SpanStyle and ParagraphStyle parts,
AnnotatedString with spans, links and string annotations, font families,
weights and styles, text units, decorations and shadows, line boxes, and the
options that limit lines and choose the overflow behavior. Application code
reaches them through cranpose::prelude and cranpose_ui::text.
use cranpose_text::{AnnotatedString, FontWeight, SpanStyle, TextStyle, TextUnit};
let style = TextStyle {
span_style: SpanStyle {
font_size: TextUnit::Sp(16.0),
font_weight: Some(FontWeight::BOLD),
..SpanStyle::default()
},
..TextStyle::default()
};
let text = AnnotatedString::new("Hello".to_owned());
assert_eq!(text.text, "Hello");
let _ = style;Re-exports§
pub use annotated_string::AnnotatedString;pub use annotated_string::LinkAnnotation;pub use annotated_string::LinkKey;pub use annotated_string::RangeStyle;pub use annotated_string::RenderString;pub use annotated_string::SpanBoundaries;pub use annotated_string::StringAnnotation;pub use bidi_level::BidiLevel;pub use decoration::Shadow;pub use decoration::TextDecoration;pub use font::FileBackedFontFamily;pub use font::FontFamily;pub use font::FontFile;pub use font::FontStyle;pub use font::FontSynthesis;pub use font::FontWeight;pub use font::LoadedTypefacePath;pub use font_family_resolver::FontFamilyResolver;pub use font_family_resolver::FontRequest;pub use font_feature::FontFeature;pub use font_feature::FontFeatureSettings;pub use font_feature::font_feature_settings;pub use glyph_id::GlyphId;pub use glyph_outline::GlyphOutline;pub use glyph_outline::OutlineSegment;pub use glyph_outline::OutlineTransform;pub use hyphenator::HyphenationError;pub use hyphenator::Hyphenator;pub use itemizer::Itemizer;pub use itemizer::TextItem;pub use layout_input::LayoutInput;pub use layout_input::ParagraphLengths;pub use layout_options::TextLayoutOptions;pub use layout_options::TextOptions;pub use layout_options::TextOverflow;pub use line_box::FontExtent;pub use line_box::LineBox;pub use line_box::line_box;pub use line_box::paragraph_line_box;pub use paragraph::Hyphens;pub use paragraph::LineBreak;pub use paragraph::ResolvedTextDirection;pub use paragraph::TextAlign;pub use paragraph::TextDirection;pub use paragraph::TextIndent;pub use paragraph::resolve_text_direction;pub use script::Script;pub use shaper::Shaper;pub use shaping_span::ShapingSpan;pub use style::BaselineShift;pub use style::LocaleList;pub use style::ParagraphStyle;pub use style::PlatformParagraphStyle;pub use style::PlatformSpanStyle;pub use style::PlatformTextStyle;pub use style::SpanStyle;pub use style::TextDrawStyle;pub use style::TextGeometricTransform;pub use style::TextMotion;pub use style::TextShaping;pub use style::TextStyle;pub use synthesized_style::SynthesizedStyle;pub use text_layout::CaretDirection;pub use text_layout::GlyphRun;pub use text_layout::PositionedGlyph;pub use text_layout::TextLayout;pub use text_layouter::TextLayouter;pub use typeface::DecorationMetrics;pub use typeface::FontBytes;pub use typeface::FontFamilyKey;pub use typeface::LineMetrics;pub use typeface::Synthesis;pub use typeface::Typeface;pub use typeface::TypefaceError;pub use unit::TextUnit;pub use word_boundary::word_boundary;
Modules§
- annotated_
string - Styled text: spans, links and string annotations.
- bidi_
level - The embedding levels of the Unicode bidirectional algorithm.
- decoration
- Text decorations (underline, line through) and text shadows.
- font
- Font weight, style, family and synthesis settings.
- font_
family_ resolver - Which typeface draws each part of a text: Compose’s
FontFamily.Resolverwith Android’s fallback rules. - font_
feature - OpenType feature settings, Compose’s
fontFeatureSettings. - glyph_
id - Glyph indices.
- glyph_
outline - Glyph outlines drawn as coverage.
- hyphenator
- itemizer
- Splitting text into the items a shaper takes.
- layout_
input - A paragraph to lay out and the lengths of its style.
- layout_
options - Options that limit lines, control wrapping and choose the overflow behavior.
- line_
box - Where a line of text sits inside the height it was given, and what a paragraph gives back at its edges.
- paragraph
- Paragraph settings: alignment, direction, line breaking, hyphenation and indent.
- script
- Writing systems and the script runs of text.
- shaper
- Shaping text items into glyphs with HarfRust.
- shaping_
span - The stretches of a paragraph that shape alike.
- style
- Text styles:
SpanStyle,ParagraphStyleandTextStyle. - synthesized_
style - The bold and the italic a layout’s glyphs ask of faces that lack them. The bold and the italic a layout’s glyphs ask of faces that lack them.
- text_
layout - A paragraph laid out in lines, and Compose’s
TextLayoutResultqueries. - text_
layouter - Laying paragraphs out in lines.
- typeface
- A font loaded for text: Compose’s
Typeface. - unit
- Text size units: scaled pixels and multiples of the font size.
- word_
boundary - The words of a text.
Structs§
- Glyph
Offset - How far right of the pen and up from the baseline a glyph draws, in design units.
- Line
Height Style - The line-height policy lives with the drawing-side text types, because a
DrawScopehas to be able to name it too: a run drawn through a canvas and aTextcomposable on the same screen must resolve their line boxes by the same rule, and the only style a draw scope can carry is the flat one fromcranpose-ui-graphics. How a line of text sits inside the height it was given, and what a paragraph gives back at its edges. - Paragraph
Intrinsics - The widths of a paragraph that do not depend on the width it is laid
out at: Compose’s
ParagraphIntrinsics. Each includes the indent of the line it is measured on. - Shaped
Glyph - A glyph shaping placed: its id, the text offset of its cluster and how
far it moves the pen. Where it draws from the pen stands apart, in
ShapedGlyphs, since most glyphs draw at the pen. - Shaped
Glyphs - Glyphs in the order shaping placed them, with where each draws from the pen.
Enums§
- Line
Height Alignment - The line-height policy lives with the drawing-side text types, because a
DrawScopehas to be able to name it too: a run drawn through a canvas and aTextcomposable on the same screen must resolve their line boxes by the same rule, and the only style a draw scope can carry is the flat one fromcranpose-ui-graphics. Where the leading — the difference between a line’s box and the font’s own ascent-plus-descent extent — is spent. - Line
Height Mode - The line-height policy lives with the drawing-side text types, because a
DrawScopehas to be able to name it too: a run drawn through a canvas and aTextcomposable on the same screen must resolve their line boxes by the same rule, and the only style a draw scope can carry is the flat one fromcranpose-ui-graphics. What a requested line height means when the font does not fit inside it. - Line
Height Trim - The line-height policy lives with the drawing-side text types, because a
DrawScopehas to be able to name it too: a run drawn through a canvas and aTextcomposable on the same screen must resolve their line boxes by the same rule, and the only style a draw scope can carry is the flat one fromcranpose-ui-graphics. Which edges of a text block give their leading back.