Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GenderMarkupBox

A markup box that includes a "gender" attribute represented by an integer number. Tags that consist of two or more segments separated by slashes will be replaced with the text from the segment corresponding to the current gender value. For example, if the markup contains the tag <this/that>, then if "gender" is set to 0, the tag will produce this, while if the "gender" is 1, the tag will produce that. This is commonly used to allow users to write markup that adapts automatically to a character's gender. For example, they might write a sentence like <He/She/It/They> ate <his/her/its/their> apple. Note that since closing tags start with a slash, to avoid confusion a dash must be used to indicate an empty string, as in words of the prophet<-/ess>.

For backwards compatibility, tags can also be written in the form <capital option1/option2> which has the same effect as <option1/option2> except that the first letter will be capitalized.

Hierarchy

  • GenderMarkupBox

Implements

Index

Constructors

Methods

Constructors

constructor

  • Creates a default markup renderer for the specified resolution. Rather than constructing a MarkupBox directly, they are usually created with the markupBox(sheet) helper function.

    Parameters

    • ppi: number

      the target resolution, in pixels per inch

    Returns GenderMarkupBox

Methods

getGender

  • getGender(): number
  • Returns the "gender" value, that is, the index of which text segment will be selected.

    Returns number

setGender

  • setGender(gender: number): void
  • setGender(useRightSideText: boolean): void
  • Sets the "gender" value by specifying which text segment to use: 0 (before first slash), 1 (after first slash), 2 (after second slash), and so on.

    Parameters

    • gender: number

      the gender value to assign

    Returns void

  • An alternative way of setting the "gender" value if only two values are used. Passing false is equivalent to 0, while passing true is equivalent to 1.

    Parameters

    • useRightSideText: boolean

      if true, the text after the slash is used

    Returns void