Vixen
dd8b0a81
csharp
public enum TextAlign

CSS Text §7.1's text-align proper: where the items on a line box sit along the inline axis.

Read the guide page for this →

Remarks

⚠ The other half of LegacyTextAlign, and the two are separate fields on purpose. One CSS property carries both sets of keywords and they govern different boxes: the legacy three move a block container's block-level children and this one distributes the inline-level items on a line. A container can have both kinds of child, so one field could not hold both answers — which is the argument LegacyTextAlign's remarks make and this enum is the other end of.

⚠ Read by the inline walk and by nothing else, so it moves a line's items and never a glyph. Text inside a leaf is aligned a layer out, in Vixen.Ui's TextAlignShift, because that needs the shaped line's width and this project has no font. The two compose the way CSS says they do — a centred line box holding a shrink-to-fit leaf whose own lines are centred inside it — and neither is the other's approximation.

⚠ justify is not here, and it is refused rather than approximated. Justifying distributes a line's slack between its word boundaries, and a text leaf is one atomic item to this walk — so the only slack this store could distribute is the space between whole inline-level boxes, which is not what the keyword asks for and would look like it on a line that happened to hold several. LayoutStyleBuilder drops it, the same way it drops the five font-relative vertical-align values, and the shape falls back to Start — which is where CSS puts a justified block's last line anyway.

Fields and properties (5)

  • Start

    The line's items begin at the inline start edge. The initial value.

  • End

    The line's items end at the inline end edge.

  • Left

    Against the left edge whatever Direction says.

  • Right

    Against the right edge whatever Direction says.

  • Center

    Centred in the space the line box has.

Used by (6)

  • InlineTextAlignTestsVixen.Ui.Layout.Tests
  • KeywordsVixen.Ui
  • LayoutStyleVixen.Ui.Layout
  • LayoutStyleBridgeTestsVixen.Ui.Tests
  • LayoutStyleBuilderVixen.Ui
  • LayoutTreeVixen.Ui.Layout