meo-skia-canvas
    Preparing search index...

    Class Paragraph

    A shaped block of text, built by ParagraphBuilder and painted with CanvasRenderingContext2D.drawParagraph.

    Nothing here reports anything useful until Paragraph.layout has run.

    🧪 Not in the HTML Canvas standard.

    Index
    • Whether layout dropped content past the style's maxLines.

      Returns boolean

    • Distance from the top of the paragraph down to the first line's alphabetic baseline -- the line Latin glyphs rest on.

      Returns number

    • 🧪 Not in CanvasKit.

      The distance from the paragraph's top edge to the first line's baseline, which is what to add to a y coordinate to place text by its baseline rather than by its top.

      The same number as getLineMetrics()[0].ascent, and 0 for an empty paragraph, which has no first line to measure.

      Returns number

    • The text position nearest (x, y), in coordinates relative to the paragraph's top-left corner -- what a click maps to when placing a caret. affinity says which side of the offset the point fell on.

      Parameters

      • x: number
      • y: number

      Returns GlyphPosition

    • Total height of the laid-out lines, in pixels.

      Returns number

    • Distance from the top of the paragraph down to the first line's ideographic baseline, which sits below the alphabetic one.

      Returns number

    • Width of the widest line actually produced -- the tight bounding box, normally narrower than the width layout was given.

      Returns number

    • The width that would fit every line without wrapping. Laying out any wider changes nothing.

      Returns number

    • The width passed to layout, not the width the text came out at.

      Returns number

    • The width of the widest unbreakable word. Laying out any narrower changes nothing, since there is nowhere left to break.

      Returns number

    • Number of laid-out lines.

      Returns number

    • Bounding boxes of the inline placeholders, in insertion order -- the readback counterpart to ParagraphBuilder.addPlaceholder.

      Returns TextBox[]

    • The boxes covering text positions start up to end, as a selection highlight would draw them. One box per line the range touches, or per direction run within a line in bidirectional text.

      hStyle chooses how tall each box is: 0 tight to the glyphs (the default), 1 the full line height, 2, 3 and 4 distributing line spacing to the middle, top and bottom, and 5 the strut's height. wStyle is 0 for tight or 1 to stretch the last box of a line to the layout width.

      Parameters

      Returns TextBox[]

    • Codepoints no font in the collection could resolve (tofu / missing glyphs), for validating automated multi-language renders.

      Returns number[]

    • Breaks the text into lines at width pixels.

      Required before drawing or measuring: every getter below, and CanvasRenderingContext2D.drawParagraph, depends on it. Drawing an un-laid-out paragraph is a silent no-op. Safe to call again with a different width to re-wrap.

      Parameters

      • width: number

      Returns void