A simple set of rules for placement of Ruby text in Japanese typography.

This document was initially written in Japanese and translated to English by the Japanese Writing Technology Working Group of the Advanced Publishing Laboratory of Keio University.

It represents the subjective view of its authors and contributors as to one possible approach to address the problem, and does not claim to be the only possible solution. It is submitted to present a non-Japanese speaking audience with this particular approach, and to encourage discussion of this topic.

The original Japanese version is available in PDF format.

Purpose of this document

Ruby is the name given to the small annotations in Japanese content that are rendered alongside base text, usually to provide a pronunciation guide, but sometimes to provide other information. (See the article “What is ruby” by the internationalization Working Group for more information.)

As a guide for implementers of rendering engines, this document describes a simple method of ruby composition that can be used for Japanese layout realized with technologies like CSS, SVG, and XML-FO. Unlike JLReq [[JLREQ]], in this document only one layout method is presented for each alternative, taking into consideration best practices and important points related to Japanese layout. The points taken into consideration are described in [[[#matters-considered-by-the-simple-placement-rules]]]. In addition, this document provides recommendations for double-sided ruby, where two distinct runs of ruby annotation are attached to the same ruby base (this is not described in [[JLREQ]].

[[JLREQ]] is largely a record of Japanese layout as established for the printing industry. It explains multiple ways to achieve one thing, and sometimes these approaches can be very complex. Ruby is one such case. There are so many factors to consider, and often contradictory requirements (see some examples), leading to a complexity that makes it challenging to automate ruby fully, per JLReq.

It would therefore be beneficial to outline a method that is adequate for automatic processing of ruby in general, but which is paired down to be simple and robust. In such cases, rather than ideal positioning, we must at least make sure that the positioning causes no misunderstanding.

The following is a proposal for just such a simple processing system. The target audience is implementers and specification writers. It is expected that a full system may be more complex that what is described here, both due to the interaction with other features or other writing systems, and because those designing such system may wish to provide alternative options. Note that the terminology is based on that defined in [[JLREQ]].

Considerations for the placement rules

The difficulties of ruby processing

When performing ruby layout in Japanese, the following factors need to be considered in order to decide on the placement:

  1. How to handle the correspondence between the base text and the ruby annotation.
  2. What to do when the base text is wider than its ruby annotation.
  3. What to do when the ruby annotation is wider than its base text.
  4. When the ruby annotation is wider than its base text, whether it can be allowed to overhang the characters preceding or following, and whether this affects the position of the base text.

  5. When the ruby annotation is wider than its base text and the base text is at the start or the end of the line, whether the base text or the ruby annotation should be aligned with the line edge.

  6. When there are multiple characters in base text, whether there can be a line wrap opportunity between them.

Designing a system based on movable typesetting is very complex, considering all the possibilities that existed. In movable type typography, such matters were resolved based on generic principles, but could always be corrected during the proofreading phase. Essentially, each case was adjusted individually in a flexible manner.

In computer-based typesetting, the layout needs to be more or less determined based on predetermined rules. However, it remains necessary to allow for adjustment of the results in certain cases, for example by changing the association between base text and the ruby annotation, or by switching to a different placement policy.

When thinking about computing placement for web content, it is not practical to decide on the positioning case by case as was done in movable type typography. It is therefore necessary to decide upon comprehensive rules that provide solutions to all the problems listed above, so that placement may be determined fully automatically. The system to be designed needs to be very complex, like ones described in Positioning of Jukugo-ruby in [[?JLREQ]], but there exists some remaining issues even with these complex rules. Therefore simple placement rules for fully automatic processing with securing certain level of quality is worth considering, and this document describes one proposal of simple placement rules of Japanese ruby.

Considerations for simple placement rules

Here are the fundamental assumptions underlying the simple placement rules. In this document we refer to the ruby annotation and its base text, collectively, as the ruby block.

  1. Ruby is used to display the reading or the meaning of characters of the base text. Therefore, the number one priority here is to avoid misreadings. Specifically, this method does not allow a ruby annotation which is wider than its base text to overhang the characters preceding or following the ruby block, whether they are kanji or kana characters.

  2. The method is agnostic to horizontal vs vertical writing, and will use the same logic in either case. Specifically, the center of the ruby annotation and of the ruby base are aligned in the inline direction for mono-ruby.
  3. Processing is done in two steps. In the first step, processing of layout only considers the relative positions of the ruby annotation and its base text. In the second step, layout processing decides the position of the ruby block in the line, taking into consideration the preceding and following characters. In other words relative positions of the ruby annotation and its base text as decided in the first step are not modified regardless of any characters preceding and following the ruby block. Also, when the ruby block is placed at the line edge the method used in this document does not align the first or last character of the base text to the line edge by modifying the relative positions of the ruby annotation and its base text. To summarise, the relative positions decided in the first step are not modified by the second step at all.

  4. Although there are cases where [[JLREQ]] and [[JISX4051]] list multiple ways of positioning ruby, this document only describes one method, based on the policies described above. Also, methods described in this document are mostly chosen from those provided in [[JISX4051]]. In some cases, this document suggests optional methods to be allowed as implementation defined, such as that a ruby annotation wider than its base text should not overhang any preceding or following kana characters.
  5. There is a demand to use larger (or smaller) font sizes for ruby annotations. In this document, the default font size of a ruby annotation is set to be half of the font size of its base text, and the examples in figures use this default font size. Sizes of spacing adjustments during justification are defined based on the font size of the base text, but not that of the ruby annotation, and this makes layout methods applicable for cases where the font size of the ruby annotation is not half that of its base text.

Types of ruby

Ruby in Japanese may be divided into the following 3 different types, based on the relationship between the ruby annotation and the ruby base (see JLReq “3.3.1 Usage of Ruby”).

  1. Mono-ruby
  2. Jukugo-ruby
  3. Group-ruby
Types of ruby.

Which one to use depends on the relationship between the ruby annotation and the ruby base. Mono-ruby is used to connect ruby annotation to base text consisted of a single character, Jukugo-ruby is used when each character of the base text have a corresponding ruby annotation and at the same time the whole group needs to be processed together, and Group-ruby is used when ruby is attached to a group of base characters together (see for examples).

Mono-ruby is defined to have a single character as its ruby base. When the ruby base of one ruby block has multiple characters, it is either Group-ruby and Jukugo-ruby. When the ruby base is segmented into each character, and a ruby annotation is attached to each, then it is a Jukugo-ruby. When a ruby annotation is attached to the whole ruby base, then it is a Group-ruby.

Rules for Simple Placement of Japanese Ruby

Ruby character size and character placement

The font size of characters of the ruby annotation and their placement in the block direction relative to the ruby base are as follows:

  1. The size of characters of the ruby annotation is by default set to half of the size of characters of the ruby base.
  2. In vertical text, ruby annotation is placed to the right of the ruby base, and the character frame of the ruby annotation is placed flush against the character frame of the ruby base. (See also JLReq section 2.1.2 Kanji, Hiragana and Katakana for details on character frame.) (The 'character frame' is described in [[JLREQ]].)
    Example of vertical ruby.
  3. In horizontal text, ruby annotation is placed to the top of the ruby base, and the character frame of the ruby annotation is placed flush against the character frame of the ruby base.
    Example of horizontal ruby.

The following sections describe in detail the placement of mono-ruby, Jukugo-ruby, and group-ruby. However, since Jukugo-ruby is more complex, it is explained last.

Placement of mono-ruby

Mono-ruby is used to connect ruby annotation to a ruby base consisted of a single character.

To align the following items to the two-step processing method described in [[[#matters-considered-by-the-placement-rules]]], points (1), (2), and (3) belong to the first step, and points (4) and (5) belong to the second.

  1. When the ruby annotation consists of two or more characters, each character in the annotation is placed immediately next to its neighboring character, without any inter-character spacing. Furthermore, when the ruby annotation is composed of characters such as Grouped numerals (cl-24), Unit symbols (cl-25), Western word space (cl-26), or Western characters (cl-27) which have their own individual width, they are placed according to each character’s metrics.

    Example of mono-ruby with western characters.
  2. The center of the ruby annotation and of its base text are aligned in the inline direction (see [[[#mono-ex-1]]]).
  3. Since the base text and its associated ruby annotation form a single unit there is no line wrapping opportunity inside mono-ruby.
  4. When the ruby annotation is wider than its base text, the part of the annotation that extends beyond the base text must not overhang the characters preceding or following (see [[[#mono-ex-1]]]). Spacing is introduced accordingly between these preceding or following characters and the base text.

    Example 1 of mono-ruby where the annotation is wider than its base text.

    However, in the following cases, where punctuation marks like Full stops (cl-06) have blank space before or after the letter face, ruby annotation characters do overhang the preceding or following characters (see [[[#mono-ex-2]]]). (Here, the difference in the processing of punctuation marks, etc. is that they play an important role as sentence breaks, and there is blank space before and after them. It is preferable to maintain constant spacing for such preceding or following characters, as far as possible, especially because when these blank spaces become large, the meaning of the break may change. Also there are no issues like those described in the note in [[[#the-difficulties-of-ruby-processing]]], therefore, this method can use a different approach to layout on punctuation marks like Full stops (cl-06).)

    • If the character preceding the base text is one of Closing brackets (cl-02), Full stops (cl-06), Commas (cl-07), Full-width ideographic space (cl-14), or Middle dots (cl-05), then the ruby annotation must hang over the blank portion at the end the character. (This blank portion is usually half the character’s width, except in the case of Middle dots (cl-05) where it is a fourth of the character width). However, if this blank part has been compressed due to justification or similar processing of the line, then the ruby annotation may only hang over the resulting compressed blank spacing (e.g. if it was reduced from half to a quarter em, hang at most a quarter em).
    • If the character following the base text is one of Opening brackets (cl-01) or Full-width ideographic space (cl-14), Middle dots (cl-05), then the ruby annotation must hang over the blank portion at the start the character. (This blank portion is usually half the character’s width for Opening brackets (cl-01), or a quarter of the character’s width for Middle dots (cl-05).) However, if this blank part has been compressed due to justification or similar processing of the line, then the ruby annotation may only hang over the resulting compressed blank spacing (e.g. if it was reduced from half to a quarter em, hang at most a quarter em).
    Example 2 of mono-ruby where the annotation is wider than its base text.
  5. When the ruby annotation is wider than its base text, and the annotation falls at the start of the line, then the start of the ruby annotation is aligned with the line’s start edge (see [[[#line-start-mono]]]), while if the annotation falls at the end of the line, then the end of the ruby annotation is aligned with the line’s end edge (see [[[#line-end-mono]]]). This rule allows a gap between the ruby base and the line edge as long as the ruby annotation touches. [[?JISX4051]] adopts this rule.

    Example of mono-ruby at the line start.
    Example of mono-ruby at the line end.

Placement of group-ruby

This section describes placement rules for group-ruby in terms of two groups of characters. Western characters have proportional width and include characters like Grouped numerals (cl-24), Unit symbols (cl-25), Western word space (cl-26), and Western characters (cl-27). Japanese characters have fixed fullwidth size and includes characters like Hiragana (cl-15), Katakana (cl-16), and Ideographic characters (cl-19) (see also 2.1.2 Kanji, Hiragana and Katakana). Western characters are read as clusters of multiple characters, and it is desirable to avoid adding spacing between characters for justification. The way items are positioned depends on how their respective lengths would compare if they were each laid out without any inter-character spacing. When their respective lengths are the same, both are laid out without inter-character spacing and placed such that their respective centers are aligned in the inline direction (see [[[#group-ruby]]]). For other cases, the placement depends on the following.

In terms of the above-mentioned two-step processing method described in [[[#matters-considered-by-the-placement-rules]]], points (1), (2), (3) and (4) belong to the first step, and (5) to the second.

  1. When both the ruby annotation and its base text contain Japanese characters, the placement depends on the following:

    • When their respective lengths are the same, both are laid out without inter-letter spacing and placed such that their respective centers in the inline direction are aligned (see [[[#group-ruby]]]).

      Example 1 of group-ruby.
    • When the ruby annotation is less wide than its base text, spacing is inserted between every character in the ruby annotation as well as at the start and the end of the ruby annotation so that it becomes the same width as the base text, then their centers in the inline direction are aligned. The size of the spacing inserted between each character of the ruby annotation is twice the size of the spacing inserted at the end and at the start (see [[[#group-2]]]).

      Example 2 of group-ruby.

      However, the size of the spacing inserted at the start and the end must be capped at no more than half the size of one character of base text, and the spacing inserted between each character of the ruby annotation is enlarged to compensate (see [[[#group-3]]]).

      Example 3 of group-ruby.
    • When the ruby annotation is wider than its base text, spacing is inserted between every character in the base text as well as at the start and the end of the base text so that it becomes the same length as the ruby annotation, then their centers in the inline direction are aligned. The size of the spacing inserted between each character of the base text is twice the size of the spacing inserted at the end and at the start (see [[[#group-4]]]).

      Example 4 of group-ruby.
  2. Where a ruby annotation consists of Japanese characters and its ruby base consists of Western characters, the placement depends on the following (see [[[#ruby-west]]]):

    • When the ruby annotation is less wide than its base text, spacing is inserted between every character in the ruby annotation as well as at the start and the end of the ruby annotation so that ruby annotation becomes the same length as the base text, then their centers in the inline direction are aligned. The size of the spacing inserted between each character of the ruby annotation is twice the size of the spacing inserted at the end and at the start.
    • When the ruby annotation is wider than its base text, both are laid out without inter-character spacing and placed such that their respective centers in the inline direction are aligned. In this case, the ruby annotation extends beyond its base text.
    Example of ruby with western characters.
  3. Where a ruby annotation consists of Western characters and its ruby base text consists of Japanese characters, the placement depends on the following (see [[[#ruby-west]]]):

    • When the ruby annotation is less wide than its base text, both are laid out without inter-character spacing and placed such that their respective centers in the inline direction are aligned.
    • When the ruby annotation is wider than its base text, spacing is inserted between every character in the base text as well as at the start and the end of the base text so that it becomes the same length as the ruby annotation, then their centers in the inline direction are aligned. The size of the spacing inserted between each character of the base text is twice the size of the spacing inserted at the end and at the start.
  4. In the case of group-ruby, the base text and its associated ruby annotation are treated as a unit, so there is no line wrapping opportunity inside either string.

  5. When the ruby annotation is wider than its base text and extends beyond it, whether and how it hangs over characters preceding or following the base text is handled in the same way as for mono-ruby (see [[[#protruding-group]]]). Also, when the ruby annotation is wider than its base text and extends beyond it and is located at the start or the end of the line, the resulting layout is also identical to that for mono-ruby.

    Example of group-ruby where the ruby annotation is wider than its base text.

Placement of Jukugo-ruby

In terms of the above-mentioned two-step processing method described in [[[#matters-considered-by-the-placement-rules]]], points (1), (2) and (3) belong to the first step, and (4) to the second.

  1. With jukugo-ruby, each base text is associated with its own ruby annotation. When the length of all of these ruby annotations laid out without inter-character spacing is less wide than the length of all their corresponding base texts, placement is determined as follows:

    • When the ruby annotation associated with an individual base text is 1 character long, the ruby annotation and the base text are placed such that their respective centers in the inline direction are aligned (see [[[#jukugo-1]]]).

      Example 1 of jukugo-ruby.
    • When the ruby annotation associated with an individual character in base text is 2 characters long or more, the ruby annotation is laid out without inter-character spacing, and placed such that its center and the center of its base text are aligned in the inline direction (see [[[#jukugo-1]]]).

  2. For simple ruby implementations, if even a single ruby annotation is longer than its corresponding base text when laid out without inter-character spacing, the resulting layout would look identical to group-ruby (see [[[#jukugo-2]]] and [[[#jukugo-3]]]).

    Example 2 of jukugo-ruby.
    Example 3 of jukugo-ruby.
  3. With Jukugo-ruby, individual base texts and their associated ruby annotations are treated as a unit, and line wrap opportunities are allowed between two base texts. When such a line wrap occurs, if a single base text that is part of the jukugo-ruby is placed alone at the end or at the start of a line, it is laid out identically to mono-ruby; conversely when several base texts that are part of the jukugo are placed together at the end or the start of a line, they are laid out together as has been described in this section about jukugo-ruby (see [[[#wrap-jukugo]]]).

    Example of wrapping jukugo-ruby.
  4. When the ruby annotation is wider than its base text and extends beyond it, whether and how it hangs over characters preceding or following the base text is handled in the same way as for mono-ruby. Also, when the ruby annotation is wider than its base text, extends beyond it, and is located at the start or the end of the line, the resulting layout is also identical to that of mono-ruby.

Placement of Double-Sided Ruby

Placement of double-sided ruby by combinations of ruby types

Quite complex methods are required to apply the full rules for placement of double-sided ruby. For simple placement of double-sided ruby, rules can be written for each of the combinations of mono-ruby, group-ruby, and jukugo-ruby for two sides. As we are using two-step processing, consideration of ruby annotations that extend beyond the ruby base text and their relationship with preceding and following characters, or placement at the line edge, are processed in the same way as when the ruby annotation is on one side only.

Space between adjacent lines and double-sided ruby

When two adjacent rows have double-sided ruby, the configuration of the inter-line spacing could cause an undesirable overlap of two ruby annotations. The following methods could be applied to avoid such cases:

  1. Configure the space between lines across the whole document in advance to avoid the potential overlap of two ruby annotations.
  2. Avoid overlap by using a wider line gap where the overlap of two ruby annotations happens. In some methods, a rule is applied to give an additional quarter em gap between two ruby annotation.
  3. Place lines with double-sided ruby in regions that are surrounded by multiple lines, instead of having wider line gaps. For example, lines with double-sided ruby are set at the center of a two line space (see JLReq "Processing of Gyou-dori").
  4. Extend not only the line spacing where overlap has occurred, but the line spacing of the entire relevant paragraph so that ruby annotation does not overlap.

In letterpress printing, the first method was used for cases where the document had a large number of ruby annotations or many reference marks. The second or third method was used for cases where a document has less ruby annotations. In automatic processing used for the Web documents, the third method might be suitable. Using the third method in an area with an integral number of line spaces around it (for example, centering across a two line space) limits the disruption to that line, and maintains the alignment of lines against those in any adjacent column. (See also JLReq "Adjustment of Processing of Realm in Block Direction".)

Double-sided ruby combinations

Double-sided ruby can be classified into five combinations:

  1. mono-ruby and mono-ruby
  2. group-ruby and group-ruby
  3. mono-ruby and group-ruby
  4. mono-ruby and jukugo-ruby
  5. jukugo-ruby with group-ruby or jukugo-ruby

Combinations of ruby types and placement methods

[[JISX4051]] provides procedures for handling (1), (2), and (3) (see a note in JLReq). But (3) is actually handled as (2) by first concatenating mono-ruby strings to form a single group-ruby.

We propose to handle (4) as (1) by first converting jukugo-ruby to mono-ruby, and to handle (5) as (2) by first converting jukugo-ruby to group-ruby.

To summarize, cases (3) and (5) are equivalent to case (2), and case (4) is equivalent to case (1) using the above conversion rules. This document, therefore, provides rules for simple placement of double-sided ruby for cases (1) and (2).

Placement of the combination mono-ruby and mono-ruby

In the combination mono-ruby plus mono-ruby, ruby annotations are set solid, and are placed so that their center aligns with that of the ruby base text (see [[[#double-mono]]]). For other points, follow the rules for placement of mono-ruby described in [[[#placement-of-mono-ruby]]].

Double-sided ruby where both sides are mono-ruby.

Placement of the combination group-ruby and group-ruby

When both of the ruby annotations are less wide than the ruby base text, follow the rules for placement of group-ruby described in [[[#placement-of-group-ruby]]]. When the ruby annotation consists of Japanese characters, defined in [[[#placement-of-group-ruby]]], spacing is inserted between every character in the ruby annotation as well as the start and the end of the ruby annotation (see [[[#double-group-1]]]).

Double-sided ruby where both sides are group-ruby.

When at least one of the ruby annotations is wider than its base text, pick up the ruby annotation with longer length and place that ruby annotation following the rules for placement of group-ruby, as described in [[[#placement-of-group-ruby]]]. When the ruby base text consists of Japanese characters, as defined in [[[#placement-of-group-ruby]]], spacing is inserted between every character in the ruby base text as well as at the start and the end of the ruby base text. Following placement of the ruby base text, place the shorter ruby annotations based on the length of the ruby base text without spacing at the start and the end but with inter-character spacing when the ruby base text is Japanese characters.

When the width of the shorter ruby annotation is longer than its ruby base text with inter-character spacing, the shorter ruby annotation is set solid and is placed so that its center matches that of its base text (see [[[#double-group-2]]]).

Second example of double-sided ruby where both sides are group-ruby.

When the width of the shorter ruby annotation is shorter than its base text with inter-character spacing, follow the rules for the placement of group-ruby described in [[[#placement-of-group-ruby]]], using the length of the ruby base text with inter-character spacing. When the shorter ruby annotation consists of Japanese characters, as described in [[[#placement-of-group-ruby]]], spacing is inserted between every character in the ruby annotation as well as at the start and the end of the ruby annotations (see [[[#double-group-3]]]).

Third example of double-sided ruby where both sides are group-ruby.

For other points, follow the same rules as for the placement of group-ruby described in [[[#placement-of-group-ruby]]].

Simplification of Ruby placement rules

Alignment between ruby annotation and base text

Mono-ruby

In mono-ruby, the following three methods are mainly used for the relative positions of the ruby annotation and its base text. This document uses the option 1. Characters of the ruby annotation are set solid.

  1. The ruby annotation's centre and base text is aligned in the inline direction.
  2. The beginning of the ruby annotation and its base text is aligned in the inline direction.
  3. In principle, the beginning of the ruby annotation and its base text are aligned in the inline direction. If the ruby annotation is wider than its base text, follow option 2 in [[[#overhang-surrounding-characters]]] with following direction as prioritized. The results may depend on the character class of characters preceding and following.

In some cases, for every ruby blocks at line edge, alignments follow option 2 in [[[#alignment-at-line-edge]]] regardless which option listed above is picked. Alignment between ruby annotation and base text may differ in this case.

Group-ruby

In Group-ruby, when lengths of ruby annotation and base text differ in solid setting, the following three methods are mainly used for inserting spacing to shorter one to make two as the same length. This document uses the option 1 for Japanese characters.

  1. Spacing is inserted between every character and both edges. The size of spacing inserted at both edges is half the size of the spacing inserted between every character.
  2. Spacing is inserted between every characters.
  3. Both ruby annotation and base text are set solid and aligned at the beginning, the end, or the center.

When the ruby annotation is longer than its base, some layout methods add adjustments depending on the context. This document does not adopt this method.

Jukugo-ruby

Following four methods are mainly used as rules for the placement of Jukugo-ruby. This document uses the option 1. Although options 2 and 3 are simpler than option 1, taking the fundamentals of Jukugo-ruby into account and modifying correspondence among blocks of ruby annotations and base texts enables these options, options 2 and 3 are not used in this document.

  1. Place each pair of ruby annotation and base text as Mono-ruby, or Jukugo-ruby block as one Group-ruby, depends on the lengths of ruby annotation assigned to each base text in the Jukugo-ruby block.
  2. Place each pair of ruby annotation and base text as Mono-ruby.
  3. Place whole Jukugo-ruby block as one Group-ruby.
  4. For ruby annotations in one Jukugo-ruby, which are wider than their base text, allow characters of ruby annotation to overhang surrounding kanji within the same Jukugo-ruby by 1/2 of the character size of the base text, following option 2 in [[[#overhang-surrounding-characters]]] with following direction as prioritized. Although characters of ruby annotations may overhang characters of surrounding base text by this rule, at least one character of each ruby annotation shall overhang its base text. For ruby block at line edge, option 2 in [[[#alignment-at-line-edge]]] is used in most cases. Alignment between ruby annotation and base text may differ depending on surrounding characters or line edges.

Overhanging surrounding characters

When the ruby annotation is wider than its base text, the following three methods are mainly used for overhanging surrounding characters. This document uses the option 1.

  1. Do not overhang surrounding characters, except for punctuation marks containing spacing.
  2. Do not overhang surrounding kanji, but allow for overhanging kana and some punctuation marks by 1/2 of the character size of the base text.
  3. Allow ruby annotation to overhang surrounding characters regardless of the character class, by 1/4 of the character size of the base text.

Although used option is commonly applied to all of mono-ruby, group-ruby and jukugo-ruby, for when option 2 is used, there is a method to apply option 1 only in case of all characters of ruby annotation in Katakana (cl-16).

Alignment at line edge

When the ruby annotation is wider than its base text, and the ruby block falls at the line edge, the following two methods are mainly used for alignment at the line edge. This document uses the option 1. When option 2 is used, alignment between ruby annotation and base text may differ from one described in [[[#alignment-between-ruby-annotation-and-base-text]]].

  1. Align the start of the ruby annotation with the line's start edge, and the end of the ruby annotation with the line's end edge.
  2. Align the start of the base text with the line's start edge, and the end of the base text with the line's end edge.