Docsv2.12.12
Back to API Reference
Class

RubyModifier

Inherits:BaseModifier

Sets ruby (furigana) — small annotation text placed above a base run to show its reading or meaning, as used in Japanese and other East-Asian typography.

Remarks

Pair it with RubyParseRule for standard markup <ruby>漢字<rt>かんじ</rt></ruby> and the shorthand <ruby=かんじ>漢字</ruby>: uniText.AddStyle(new Style { Rule = new RubyParseRule(), Modifier = new RubyModifier() }). The reading reaches the modifier as the range parameter, so any rule that supplies one works. A single base+reading is group-ruby; several <rt> segments give mono-ruby (one reading per character): <ruby>東<rt>とう</rt>京<rt>きょう</rt></ruby>. Layout follows CSS Ruby / JIS X 4051: the annotation is half the base size by default and is centered over the base. When the annotation is narrower than the base it is distributed by Align (default SpaceAround — the JIS 1:2:1 rule); when it is wider, the base columns are spread to fit it. The annotation raises the line height of the rows it sits on, so allow clearance above the first line (top padding or vertical centering). Horizontal, line-over annotations on left-to-right base text.

Nested Types

public float RubyScale{ get; set }

Annotation font size as a fraction of the base size. Default 0.5 (the typographic norm). Clamped to [0.1, 1].

public RubyAlign Align{ get; set }

How a narrower annotation is distributed over its base column.

public RubyPosition Position{ get; set }

Annotation side relative to the base: above (over) or below (under).

protected override void OnEnable()
protected override void OnDisable()
protected override void OnDestroy()
protected override void OnApply()

See Also