Type Alias DucTextStyle

DucTextStyle: {
    bigFontFamily: string;
    fontFamily: FontString;
    fontSize: PrecisionValue;
    isBackwards: boolean;
    isLtr: boolean;
    isUpsideDown: boolean;
    lineHeight: number & { _brand: "unitlessLineHeight" };
    lineSpacing: { type: LineSpacingType; value: PrecisionValue | ScaleFactor };
    obliqueAngle: Radian;
    textAlign: TextAlign;
    verticalAlign: VerticalAlign;
    widthFactor: ScaleFactor;
}

Type declaration

  • bigFontFamily: string

    Fallback font family for broader compatibility across all systems and languages Useful for emojis, non-latin characters, etc.

  • fontFamily: FontString

    The primary font family to use for the text

  • fontSize: PrecisionValue

    Text height in drawing units (primary size parameter) This determines the height of capital letters

  • isBackwards: boolean

    Render backwards/mirrored

  • isLtr: boolean

    Whether the text is left-to-right or right-to-left

    true
    
  • isUpsideDown: boolean

    Render upside down

  • lineHeight: number & { _brand: "unitlessLineHeight" }

    Unitless line height multiplier (follows W3C standard). Actual line height in drawing units = fontSize × lineHeight Use getLineHeightInPx helper for pixel calculations.

    1.2 means 20% extra space between lines
    
  • lineSpacing: { type: LineSpacingType; value: PrecisionValue | ScaleFactor }

    Defines the line spacing properties for text.

    • type: LineSpacingType

      Determines how the line spacing factor is applied.

      • at_least: The line spacing is the larger of the value or the tallest character's natural height. This ensures text doesn't overlap but respects a minimum spacing.
      • exactly: Forces the line spacing to the specified value, even if characters (especially tall ones like ascenders/descenders or special symbols) overlap. Useful for precise layout control where overlapping might be acceptable or handled externally.
      • multiple: The base line height (often derived from the font's intrinsic metrics and font size) is multiplied by the value (e.g., a value of 1.5 would mean 150% of the base line height). This is very common for relative spacing.
    • value: PrecisionValue | ScaleFactor

      The numerical value for the line spacing. Its interpretation depends on the type property.

  • obliqueAngle: Radian

    Italic angle in radians for oblique text rendering Positive values slant right, negative values slant left

  • textAlign: TextAlign

    Horizontal alignment of the text within its bounding box

  • verticalAlign: VerticalAlign

    Vertical alignment of the text within its bounding box

  • widthFactor: ScaleFactor

    Character width as a ratio of text height Controls horizontal spacing and character proportions

    0.7 means each character is 70% as wide as the text is tall