Sign in

    Milky2018/mgstudio/text does not have a README file

    ComputedTextBlock

    pub struct ComputedTextBlock {
    buffer : CosmicBuffer
    needs_rerender : Bool
    entities : Array[TextEntity]
    }

    ComputedTextBlock::buffer

    ComputedTextBlock::default

    ComputedTextBlock::entities

    ComputedTextBlock::needs_rerender

    fn ComputedTextBlock::needs_rerender(self : ComputedTextBlock) -> Bool

    CosmicBuffer

    pub struct CosmicBuffer {
    text : String
    spans : Array[TextSpanRange]
    font_size : Float
    line_height : Float
    justify : Justify
    linebreak : LineBreak
    max_width : Float?
    max_height : Float?
    }

    CosmicBuffer::default

    fn CosmicBuffer::default() -> CosmicBuffer

    FontAtlas

    FontAtlas::add_glyph

    fn FontAtlas::add_glyph(self : FontAtlas, cache_key : GlyphCacheKey, raster : GlyphRaster) -> Bool

    FontAtlas::get_glyph_index

    fn FontAtlas::get_glyph_index(self : FontAtlas, cache_key : GlyphCacheKey) -> GlyphAtlasLocation?

    FontAtlas::has_glyph

    fn FontAtlas::has_glyph(self : FontAtlas, cache_key : GlyphCacheKey) -> Bool

    FontAtlas::new

    FontAtlasKey

    pub struct FontAtlasKey {
    font_id : Int
    font_size_bits : Int
    font_smoothing : FontSmoothing
    }

    FontAtlasKey::new

    FontAtlasSet

    pub struct FontAtlasSet {
    entries : Array[FontAtlasSetEntry]
    }

    FontAtlasSet::default

    fn FontAtlasSet::default() -> FontAtlasSet

    FontAtlasSet::get

    FontAtlasSet::get_or_insert

    fn FontAtlasSet::get_or_insert(self : FontAtlasSet, key : FontAtlasKey) -> Array[FontAtlas]

    FontAtlasSet::has_glyph

    fn FontAtlasSet::has_glyph(self : FontAtlasSet, cache_key : GlyphCacheKey, font_key : FontAtlasKey) -> Bool

    FontAtlasSetEntry

    pub struct FontAtlasSetEntry {
    key : FontAtlasKey
    atlases : Array[FontAtlas]
    }

    FontSmoothing

    pub(all) enum FontSmoothing {
    None
    AntiAliased
    }

    GlyphAtlasLocation

    pub struct GlyphAtlasLocation {
    glyph_index : Int
    offset :
    IVec2

    }

    GlyphCacheKey

    pub struct GlyphCacheKey {
    glyph_id : Int
    subpixel_x : Int
    subpixel_y : Int
    font_weight : Int
    flags : UInt
    }

    GlyphCacheKey::new

    fn GlyphCacheKey::new(glyph_id : Int, subpixel_x : Int, subpixel_y : Int, font_weight : Int, flags : UInt) -> GlyphCacheKey

    GlyphRaster

    pub struct GlyphRaster {
    glyph_id : Int
    size :
    UVec2

    offset :
    IVec2

    pixels_rgba8 : Bytes
    }

    Justify

    pub(all) enum Justify {
    Left
    Center
    Right
    Justified
    }

    LineBreak

    pub(all) enum LineBreak {
    WordBoundary
    AnyCharacter
    WordOrCharacter
    NoWrap
    }

    LineHeight

    pub(all) enum LineHeight {
    Px(Float)
    RelativeToFont(Float)
    }

    LineHeight::default

    fn LineHeight::default() -> LineHeight

    LineHeight::eval

    fn LineHeight::eval(self : LineHeight, font_size : Float) -> Float

    PositionedGlyph

    pub struct PositionedGlyph {
    position :
    Vec2

    size :
    Vec2

    atlas_info : GlyphAtlasInfo
    span_index : Int
    line_index : Int
    byte_index : Int
    byte_length : Int
    }

    RunGeometry

    pub struct RunGeometry {
    span_index : Int
    bounds :
    Rect

    strikethrough_y : Float
    strikethrough_thickness : Float
    underline_y : Float
    underline_thickness : Float
    }

    RunGeometry::strikethrough_position

    fn RunGeometry::strikethrough_position(self : RunGeometry) ->
    Vec2

    RunGeometry::strikethrough_size

    RunGeometry::underline_position

    RunGeometry::underline_size

    Text2d

    pub struct Text2d {
    content : String
    }

    Text2d::new

    fn Text2d::new(content : String) -> Text2d

    Text2dBundle

    Text2dBundle::new

    Text2dBundle::new_with_layers

    Text2dBundle::spawn

    fn Text2dBundle::spawn(self : Text2dBundle) -> TextHandle

    Text2dBundle::with_anchor

    Set the anchor used for world-space Text2d positioning (Bevy-aligned).

    Text2dBundle::with_bounds

    fn Text2dBundle::with_bounds(self : Text2dBundle, bounds : TextBounds) -> Text2dBundle

    Text2dBundle::with_color

    fn Text2dBundle::with_color(self : Text2dBundle, color : TextColor) -> Text2dBundle

    Text2dBundle::with_layout

    fn Text2dBundle::with_layout(self : Text2dBundle, layout : TextLayout) -> Text2dBundle

    Text2dBundle::with_line_height

    fn Text2dBundle::with_line_height(self : Text2dBundle, line_height : LineHeight) -> Text2dBundle

    Text2dBundle::with_shadow

    fn Text2dBundle::with_shadow(self : Text2dBundle, shadow : Text2dShadow?) -> Text2dBundle

    Text2dBundle::with_y_axis

    fn Text2dBundle::with_y_axis(self : Text2dBundle, y_axis : YAxisOrientation) -> Text2dBundle

    Set the layout coordinate orientation.

    Text2dShadow

    Text2dShadow::default

    fn Text2dShadow::default() -> Text2dShadow

    TextBounds

    pub struct TextBounds {
    width : Float?
    height : Float?
    }

    TextBounds::default

    fn TextBounds::default() -> TextBounds

    TextBounds::new

    fn TextBounds::new(width : Float, height : Float) -> TextBounds

    TextBounds::new_horizontal

    fn TextBounds::new_horizontal(width : Float) -> TextBounds

    TextBounds::new_vertical

    fn TextBounds::new_vertical(height : Float) -> TextBounds

    TextColor

    pub struct TextColor {
    color :
    Color

    }

    TextColor::default

    fn TextColor::default() -> TextColor

    TextDebugGlyphDraw

    pub struct TextDebugGlyphDraw {
    text_id : Int
    bounds :
    Rect

    scissor :
    Rect
    ?
    texture_id : Int
    uv_min :
    Vec2

    uv_max :
    Vec2

    }

    TextDebugTextInfo

    pub struct TextDebugTextInfo {
    text_id : Int
    content : String
    }

    TextEntity

    pub struct TextEntity {
    id : Int
    depth : Int
    font_smoothing : FontSmoothing
    }

    TextFont

    pub struct TextFont {
    font :
    Handle
    [
    Font
    ]
    font_size : Float
    font_smoothing : FontSmoothing
    }

    TextFont::default

    fn TextFont::default() -> TextFont

    TextFont::with_font_size

    fn TextFont::with_font_size(self : TextFont, font_size : Float) -> TextFont

    TextFont::with_font_smoothing

    fn TextFont::with_font_smoothing(self : TextFont, font_smoothing : FontSmoothing) -> TextFont

    TextHandle

    pub struct TextHandle {
    id : Int
    }

    TextHandle::id

    fn TextHandle::id(self : TextHandle) -> Int

    TextHandle::new

    fn TextHandle::new(id : Int) -> TextHandle

    TextLayout

    pub struct TextLayout {
    justify : Justify
    linebreak : LineBreak
    }

    TextLayout::default

    fn TextLayout::default() -> TextLayout

    TextLayout::new

    fn TextLayout::new(justify : Justify, linebreak : LineBreak) -> TextLayout

    TextLayout::new_with_justify

    fn TextLayout::new_with_justify(justify : Justify) -> TextLayout

    TextLayout::new_with_linebreak

    fn TextLayout::new_with_linebreak(linebreak : LineBreak) -> TextLayout

    TextLayout::new_with_no_wrap

    fn TextLayout::new_with_no_wrap() -> TextLayout

    TextLayout::with_justify

    fn TextLayout::with_justify(self : TextLayout, justify : Justify) -> TextLayout

    TextLayout::with_linebreak

    fn TextLayout::with_linebreak(self : TextLayout, linebreak : LineBreak) -> TextLayout

    TextLayout::with_no_wrap

    fn TextLayout::with_no_wrap(self : TextLayout) -> TextLayout

    TextLayoutInfo

    pub struct TextLayoutInfo {
    scale_factor : Float
    glyphs : Array[PositionedGlyph]
    run_geometry : Array[RunGeometry]
    size :
    Vec2

    }

    TextLayoutInfo::clear

    TextLayoutInfo::default

    TextPipeline

    pub struct TextPipeline {
    }

    TextPipeline::default

    fn TextPipeline::default() -> TextPipeline

    TextSpan

    pub struct TextSpan {
    content : String
    }

    TextSpan::new

    fn TextSpan::new(content : String) -> TextSpan

    TextSpanBundle

    pub struct TextSpanBundle {
    span : TextSpan
    font : TextFont
    color : TextColor
    line_height : LineHeight
    }

    TextSpanBundle::new

    fn TextSpanBundle::new(span : TextSpan, font : TextFont) -> TextSpanBundle

    TextSpanBundle::spawn

    TextSpanHandle

    pub struct TextSpanHandle {
    id : Int
    }

    TextSpanHandle::new

    fn TextSpanHandle::new(id : Int) -> TextSpanHandle

    TextSpanRange

    pub struct TextSpanRange {
    start : Int
    length : Int
    }

    YAxisOrientation

    pub(all) enum YAxisOrientation {
    TopToBottom
    BottomToTop
    }

    • BottomToTop: origin at bottom-left, +Y goes up (world-style layout).

    add_glyph_to_atlas

    fn add_glyph_to_atlas(font_atlases : Array[FontAtlas], cache_key : GlyphCacheKey, raster : GlyphRaster, font_smoothing : FontSmoothing) -> GlyphAtlasInfo?

    font_measure_advance

    fn font_measure_advance(font :
    Handle
    [
    Font
    ], font_size : Float, codepoint : Int) -> Float

    font_rasterize_cache_key

    fn font_rasterize_cache_key(font_system :
    FontSystem
    , cache_key :
    CacheKey
    , smoothing : FontSmoothing) -> GlyphRaster?

    Rasterize a glyph directly from cosmic physical cache key (Bevy parity).

    This follows Bevy's physical_glyph.cache_key -> swash_cache.get_image_uncached flow and avoids rebuilding a partial key from layout_glyph.

    font_rasterize_glyph

    fn font_rasterize_glyph(font :
    Handle
    [
    Font
    ], font_size : Float, codepoint : Int, smoothing : FontSmoothing) -> GlyphRaster?

    font_rasterize_glyph_id

    fn font_rasterize_glyph_id(font :
    Handle
    [
    Font
    ], font_size : Float, glyph_id : Int, smoothing : FontSmoothing) -> GlyphRaster?

    Rasterize a glyph by its glyph ID (already shaped).

    This is required for complex shaping (ligatures, marks) where mapping from codepoint -> glyph_id is not sufficient.

    font_rasterize_glyph_id_subpixel

    fn font_rasterize_glyph_id_subpixel(font :
    Handle
    [
    Font
    ], font_size : Float, glyph_id : Int, smoothing : FontSmoothing, subpixel_x : Int, subpixel_y : Int) -> GlyphRaster?

    Rasterize a glyph with a subpixel cache key (cosmic-text compatible).

    subpixel_x/subpixel_y are bin indices in [0..3], matching cosmic-text/moon_cosmic (Zero/One/Two/Three → 0/1/2/3).

    get_glyph_atlas_info

    fn get_glyph_atlas_info(atlases : Array[FontAtlas], cache_key : GlyphCacheKey) -> GlyphAtlasInfo?

    text_debug_all_draws

    fn text_debug_all_draws() -> Array[TextDebugGlyphDraw]

    text_debug_clear_frame

    fn text_debug_clear_frame() -> Unit

    text_debug_draw_count

    fn text_debug_draw_count(handle : TextHandle) -> Int

    text_debug_draws

    fn text_debug_draws(handle : TextHandle) -> Array[TextDebugGlyphDraw]

    text_debug_overlap_count

    fn text_debug_overlap_count(lhs : TextHandle, rhs : TextHandle) -> Int

    text_debug_push_glyph

    fn text_debug_push_glyph(text_id : Int, bounds :
    Rect
    , scissor :
    Rect
    ?, texture_id : Int, uv_min :
    Vec2
    , uv_max :
    Vec2
    ) -> Unit

    text_debug_text_infos

    fn text_debug_text_infos() -> Array[TextDebugTextInfo]

    text_debug_visible_draw_count

    fn text_debug_visible_draw_count(handle : TextHandle) -> Int

    text_debug_visible_overlap_count

    fn text_debug_visible_overlap_count(lhs : TextHandle, rhs : TextHandle) -> Int

    text_get_content

    fn text_get_content(handle : TextHandle) -> String?

    Get the current text content for a handle.

    text_get_layout_size

    fn text_get_layout_size(handle : TextHandle) ->
    Vec2
    ?

    Get the last computed logical layout size (may lag by one frame).

    text_get_transform

    fn text_get_transform(handle : TextHandle) ->
    Transform
    ?

    Get the current transform for a text handle.

    text_get_ui_scissor

    fn text_get_ui_scissor(handle : TextHandle) ->
    Rect
    ?

    Get current optional UI clip rect for a text handle.

    text_get_visual_bounds

    fn text_get_visual_bounds(handle : TextHandle) ->
    Rect
    ?

    Compute current world-space visual bounds from positioned glyph quads.

    This reflects the same transform path used by text_render_system, so UI tests can assert the rendered placement instead of only transform center/z.

    text_set_anchor

    fn text_set_anchor(handle : TextHandle, anchor :
    Anchor
    ) -> Unit

    Update the anchor of a text handle without marking it as needing rerender.

    text_set_content

    fn text_set_content(handle : TextHandle, content : String) -> Unit

    text_set_layers

    fn text_set_layers(handle : TextHandle, layers :
    RenderLayers
    ) -> Unit

    Update the render layers of a text handle without marking it as needing rerender.

    text_set_transform

    fn text_set_transform(handle : TextHandle, transform :
    Transform
    ) -> Unit

    Update the transform of a text handle without marking it as needing rerender.

    text_set_ui_node_size

    fn text_set_ui_node_size(handle : TextHandle, size :
    Vec2
    ?) -> Unit

    This does not affect shaping, but it changes how glyphs are positioned when rendered.

    text_set_ui_scissor

    fn text_set_ui_scissor(handle : TextHandle, scissor :
    Rect
    ?) -> Unit

    Set optional UI clip rect for a text handle.

    text_set_y_axis

    fn text_set_y_axis(handle : TextHandle, y_axis : YAxisOrientation) -> Unit

    Update the y-axis orientation of a text handle without marking it as needing rerender.

    text_spawn

    fn text_spawn(bundle : Text2dBundle) -> TextHandle

    text_spawn_span

    fn text_spawn_span(parent : TextHandle, bundle : TextSpanBundle) -> TextSpanHandle

    text_update_system

    fn[W] text_update_system(_world : W) -> Unit