import * as em from "./Enums"; import * as ds from "./Types"; import { ObjectManager } from "./ObjectManager"; import { ObjectBase } from "./ObjectBase"; import { type SplitOptions } from "./SplitOptions"; import { Format } from "./Format"; import { Font } from "./Font"; import { type FontCollection } from "./FontCollection"; /** * Represents one or more paragraphs of multi-formatted text. Provides text analysis and layout functionality. **/ export declare class Layout extends ObjectBase { /** * Creates a new {@link Layout} with specified properties. * @param layoutProperties The layout settings, including one or more paragraphs of multi-formatted text. **/ constructor(layoutProperties?: ds.LayoutProperties); /** * Creates a new {@link Layout} based on properties of an existing Layout. * @param baseLayout The Layout object used as the base for the new {@link Layout}. * @param layoutProperties The settings overriding properties of the base Layout. **/ constructor(baseLayout: Layout, layoutProperties?: ds.LayoutProperties); /** * Creates a new {@link Layout} with specified properties. * @param om An object manager that controls the lifetime of the {@link Layout} object. * @param layoutProperties The layout settings, including one or more paragraphs of multi-formatted text. **/ constructor(om: ObjectManager, layoutProperties?: ds.LayoutProperties); /** * Gets the base direction for horizontal and sideways text. **/ get rightToLeft(): boolean; /** * Gets the flow direction (how lines of text are placed relative to one another). **/ get flowDirection(): em.FlowDirection; /** * Gets a value indicating whether sideways text should be rotated counterclockwise. **/ get rotateSidewaysCounterclockwise(): boolean; /** * Gets the alignment of paragraphs along the flow direction axis. **/ get paragraphAlignment(): em.ParagraphAlignment; /** * Gets the alignment of text along the reading direction axis. **/ get textAlignment(): em.TextAlignment; /** * Gets the {@link Format} object used as default text format for the current {@link Layout}. **/ get defaultFormat(): Format | null; /** * Gets the font collection used for searching fonts and font fallbacks. **/ get fontCollection(): FontCollection | null; /** * Gets a value indicating whether the fonts should be searched in the custom collection only, if any specified. **/ get restrictedFontLookup(): boolean; /** * Gets the scope for searching fallback fonts for the glyphs missing in the font defined in {@link Format}. **/ get fontFallbackScope(): em.FontFallbackScope; /** * Get a value indicating if the linked and fallback fonts have to be embeddable. **/ get useEmbeddableFonts(): boolean; /** * Gets a value indicating if shaping and positioning of graphemes should be skipped for the sake of speed. **/ get suppressShaping(): boolean; /** * Gets the uniform scale factor for all fonts used in the current {@link Layout}. Valid values are from 0.001 to 1000. **/ get fontScaleFactor(): number; /** * Gets the maximum fraction of the last line's height overflowing beyond the layout bounds for that line not to be truncated. **/ get maxLastLineOverflowFactor(): number; /** * Gets the width of the layout box, in graphic units. **/ get maxWidth(): number | null; /** * Gets the height of the layout box, in graphic units. **/ get maxHeight(): number | null; /** * Gets the left margin of the layout box, in graphic units. **/ get marginLeft(): number; /** * Gets the right margin of the layout box, in graphic units. **/ get marginRight(): number; /** * Gets the top margin of the layout box, in graphic units. **/ get marginTop(): number; /** * Gets the bottom margin of the layout box, in graphic units. **/ get marginBottom(): number; /** * Gets the width of the layout box measured from the left margin (for positive values) or from the right margin (for negative values), in graphic units. **/ get columnWidth(): number | null; /** * Gets the height of the layout box measured from the top margin (for positive values) or from the bottom margin (for negative values), in graphic units. **/ get rowHeight(): number | null; /** * Gets a value specifying how text lines are broken to avoid text overflowing the layout box. **/ get wrapMode(): em.WrapMode; /** * Gets a value indicating whether long words can overhang beyond the layout box bounds. **/ get allowOverhangingWords(): boolean; /** * Gets the text granularity used to trim text overflowing the layout box. **/ get trimmingGranularity(): em.TrimmingGranularity; /** * Gets a UTF-32 code of the omission sign (ellipsis character) for text trimming. A value of 0 prevents the ellipsis character from showing. **/ get ellipsisCharCode(): number; /** * Gets a UTF-32 character code used as a delimiter that signals the beginning of the portion of text to be preserved (for text trimming). **/ get delimiterCharCode(): number; /** * Gets the delimiter count, counting from the end of the text, to preserve text from (for text trimming). **/ get delimiterCharCount(): number; /** * Gets a UTF-32 character code used as replacement for soft hyphen characters (0x00AD) at ends of lines when breaking words across lines. **/ get softHyphenReplacementCharCode(): number; /** * Gets the minimum number of lines not using hyphens after breaking a word across lines and displaying a visible hyphen at the position of soft hyphen. **/ get linesBetweenConsecutiveHyphens(): number; /** * Gets a value indicating whether the typographic line gap should be added before the first line of text. **/ get lineGapBeforeFirstLine(): boolean; /** * Gets a value indicating whether the line spacing should be added after the last line of text. **/ get addSpacingAfterLastLine(): boolean; /** * Gets a value indicating whether the first line of text is the start of paragraph. **/ get firstLineIsStartOfParagraph(): boolean; /** * Gets a value indicating whether the last line of text is the end of paragraph. **/ get lastLineIsEndOfParagraph(): boolean; /** * Gets the additional spacing between paragraphs, in graphic units. **/ get paragraphSpacing(): number; /** * Gets spacing between the default tab stops, in graphic units. **/ get defaultTabSize(): number; /** * Gets the array of custom tab stops. **/ get tabStops(): ds.TabStop[] | null; /** * Gets the indent of the first line after paragraph separator, in graphic units. * Positive value applies indentation to the first line, negative value applies indentation to all lines except the first one. **/ get firstLineIndent(): number; /** * Gets a value indicating whether the whole first line of a paragraph with indentation can be skipped. **/ get canSkipFirstLineWithIndentation(): boolean; /** * Gets the rules used for justified text extension. **/ get textExtensionStrategy(): em.TextExtensionStrategy; /** * Gets the line breaking algorithm. **/ get lineBreakingRules(): em.LineBreakingRules; /** * Gets the word breaking algorithm. **/ get wordBoundaryRules(): em.WordBoundaryRules; /** * Gets a value indicating whether for paragraphs that have textAlignment set to "Distributed" the last line will be justified (typical in East Asian typography). **/ get justifyLastLine(): boolean; /** * Gets the white space shrinking factor when text is justified. Values are between 0.0 and 1.0. **/ get justifiedSpaceShrinking(): number; /** * Gets the maximum white space extension factor before applying extension to other characters when text is justified. Values are between 0 and 10000. **/ get justifiedSpaceExtension(): number; /** * Gets the maximum text extension factor when text is justified. Values are between 0 and 10000. **/ get justifiedTextExtension(): number; /** * Gets the scaling factor to be applied to the computed line height. Values are between 0 and 1000. **/ get lineSpacingScaleFactor(): number; /** * Gets the explicit distance between lines, in graphic units. **/ get uniformLineSpacing(): number | null; /** * Gets the explicit minimal distance between lines, in graphic units. **/ get minimalLineSpacing(): number | null; /** * Gets a value indicating whether line spacing for the last line is considered a part of the layout content. **/ get honorLastLineSpacing(): boolean; /** * Gets a value indicating whether the ideographic baseline should be used instead of the Roman baseline for hieroglyph characters. **/ get honorIdeographicBaseline(): boolean; /** * Gets a value indicating whether the trailing line break causes a blank line to be added to the output text layout. **/ get honorTrailingLineBreak(): boolean; /** * Clears the current text layout, removing all text and formatting associated with individual text runs. **/ clear(): void; /** * Adds text with default format to the current {@link Layout}. * @param text The text to append. **/ append(text: string): void; /** * Adds text with specified format to the current {@link Layout}. * @param text The text to append. * @param format The text format to use. **/ append(text: string, format: Format): void; /** * Adds text with specified format attributes to the current {@link Layout}. * @param text The text to append. * @param font The font to use. * @param fontSize The font size. * @param foreColor The text color. **/ append(text: string, font: Font, fontSize: number, foreColor: ds.Color): void; /** * Adds a text run with specified format to the current {@link Layout}. * @param runProperties A text section (run) with formatting. **/ append(runProperties: ds.RunProperties): void; /** * Adds text and line break characters (0x0D, 0x0A) with default format to the current {@link Layout}. * @param text The text to append. **/ appendLine(text: string): void; /** * Adds text and line break characters (0x0D, 0x0A) with specified format to the current {@link Layout}. * @param text The text to append. * @param format The text format to use. **/ appendLine(text: string, format: Format): void; /** * Adds text and line break characters (0x0D, 0x0A) with specified format attributes to the current {@link Layout}. * @param text The text to append. * @param font The font to use. * @param fontSize The font size. * @param foreColor The text color. **/ appendLine(text: string, font: Font, fontSize: number, foreColor: ds.Color): void; /** * Adds a text run and line break characters (0x0D, 0x0A) with specified format to the current {@link Layout}. * @param runProperties A text section (run) with formatting. **/ appendLine(runProperties: ds.RunProperties): void; /** * Adds line break characters (0x0D, 0x0A). * @param format Text format, if specified, the default format is used otherwise. **/ appendLineBreak(format?: Format | null): void; /** * Adds a line separator character (0x2028) that causes a line break without ending the paragraph. * @param format Text format, if specified, the default format is used otherwise. **/ appendSoftBreak(format?: Format | null): void; /** * Adds a special character (0x2029) that causes a paragraph break but prevents a page break between paragraphs. * @param format Text format, if specified, the default format is used otherwise. **/ appendParagraphBreak(format?: Format | null): void; /** * Appends a form feed character ('\f', character code 0x000C) to the text. This causes * any text added after it to "not fit" - if the text layout is drawn, that text will not be rendered. * If the {@link Layout#split} method is called, the text will be split at this point. * @param format Text format, if specified, the default format is used otherwise. **/ appendSectionBreak(format?: Format | null): void; /** * Determines the coordinates of all text lines and glyph runs. * @returns true if the whole text fits in the bounds of {@link Layout}, false if some text doesn't fit * in bounds and the {@link Layout#split} method must be executed to move the rest of the text into another {@link Layout} instance. **/ performLayout(): boolean; /** * Fits all or the first portion of the current text layout into the current layout bounds. * If the whole text did not fit into the bounds, the rest is moved into the Layout instance * specified by the 'rest' parameter. * @param splitOptions Options controlling how text is split. * @param rest Recipient for the text that did not fit in the current bounds. * @returns A value indicating the result of splitting the current text layout. **/ split(splitOptions: SplitOptions | null, rest: Layout): em.SplitResult; /** * If a portion of the text content does not fit into the current layout bounds, removes * that portion so that the remaining text fits. * Returns true if at least some text remains that fits into the current layout bounds. * Returns false if the current layout did not contain any text or all text had to be removed. * Note that if there is only one line, and it does not fit into the available height, * it is not removed, and this method returns true. * @param lastLineTrimming The text granularity used when trimming the last line of text. **/ truncate(lastLineTrimming?: em.TrimmingGranularity): boolean; /** * Gets the X coordinate of the rectangle containing the formatted text, in graphic units. **/ get contentX(): number; /** * Gets the Y coordinate of the rectangle containing the formatted text, in graphic units. **/ get contentY(): number; /** * Gets the width of the formatted text, in graphic units. **/ get contentWidth(): number; /** * Gets the height of the formatted text, in graphic units. **/ get contentHeight(): number; /** * Gets a rectangle containing the formatted text, in graphic units. **/ get contentRect(): ds.Rect; /** * Gets a value indicating whether the width of the formatted text fits in the specified MaxWidth. **/ get contentWidthFitsInBounds(): boolean; /** * Gets a value indicating whether the height of the formatted text fits in the specified MaxHeight. **/ get contentHeightFitsInBounds(): boolean; /** * Gets a value indicating if the {@link Layout#performLayout} method was executed at least once. **/ get layoutPerformed(): boolean; /** * Gets a value indicating whether text runs contain some characters that are not present in * the specified fonts and fallback fonts, so those characters cannot be displayed correctly. **/ get hasMissingFontCharacters(): boolean; /** * Gets a value indicating whether the {@link LayoutProperties#flowDirection} was vertical when the {@link Layout#performLayout} method was last called. **/ get vertical(): boolean; /** * Gets the array of UTF-32 characters (code points) in a {@link Layout}. **/ get codePoints(): Int32Array; /** * Gets the array of text lines after executing the {@link Layout#performLayout} method. **/ get lines(): ds.TextLine[]; /** * Adjusts the positions of content rectangle. * @param dx The offset along the horizontal direction. * @param dy The offset along the vertical direction. **/ applyOffset(dx: number, dy: number): void; }