Class Rt<T extends Rt<T>>


public class Rt<T extends Rt<T>> extends PhrasingContentElement<T>
Represents an HTML <rt> (ruby text) element that provides pronunciation or translation annotations.

The <rt> element specifies the ruby text component of a ruby annotation, which is used to show pronunciation guides (like furigana in Japanese) or translation notes for East Asian characters. The ruby text is typically displayed above or to the right of the base text in a smaller font.

Features:

  • Displays pronunciation guides for characters
  • Commonly used for East Asian typography (Japanese, Chinese, Korean)
  • Rendered in smaller font above or beside base text
  • Must be used within a <ruby> element
  • Often paired with <rp> elements for fallback
  • Supports furigana, pinyin, and other phonetic guides

Usage:


 // Japanese kanji with furigana
 Ruby word = new Ruby();
 word.addText("東京");  // Tokyo in kanji
 word.addElement(new Rp("("));
 Rt reading = new Rt();
 reading.addText("とうきょう");  // Pronunciation in hiragana
 word.addElement(reading);
 word.addElement(new Rp(")"));

 // Chinese with pinyin
 Ruby chinese = new Ruby();
 chinese.addText("中国");
 chinese.addElement(new Rp("("));
 Rt pinyin = new Rt();
 pinyin.addText("Zhōngguó");
 chinese.addElement(pinyin);
 chinese.addElement(new Rp(")"));

 // Multiple ruby annotations
 Ruby phrase = new Ruby();
 phrase.addText("明日");
 Rt tomorrow = new Rt();
 tomorrow.addText("あした");
 phrase.addElement(tomorrow);
 // Displays: 明日 with あした shown above
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Rt

      public Rt()
      Constructs a new Rt element.

      Creates an HTML <rt> element for ruby text annotations. This element should be nested within a <ruby> element and will contain the pronunciation guide or translation text.