import '../../../assert/js/assert.js';
import '../../../tandem/js/PhetioIDUtils.js';
import '../../../globals.js';
/**
 * Displays text that can be filled/stroked.
 *
 * For many font/text-related properties, it's helpful to understand the CSS equivalents (http://www.w3.org/TR/css3-fonts/).
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { PropertyOptions } from '../../../axon/js/Property.js';
import TProperty from '../../../axon/js/TProperty.js';
import TReadOnlyProperty from '../../../axon/js/TReadOnlyProperty.js';
import Bounds2 from '../../../dot/js/Bounds2.js';
import Matrix3 from '../../../dot/js/Matrix3.js';
import PhetioObject, { PhetioObjectOptions } from '../../../tandem/js/PhetioObject.js';
import IOType from '../../../tandem/js/types/IOType.js';
import { CanvasContextWrapper, CanvasSelfDrawable, DOMSelfDrawable, Font, FontStretch, FontStyle, FontWeight, Instance, Node, NodeOptions, PaintableOptions, SVGSelfDrawable } from '../imports.js';
export type TextBoundsMethod = 'fast' | 'fastCanvas' | 'accurate' | 'hybrid';
type SelfOptions = {
    boundsMethod?: TextBoundsMethod;
    stringProperty?: TReadOnlyProperty<string> | null;
    string?: string | number;
    font?: Font | string;
    fontWeight?: string | number;
    fontFamily?: string;
    fontStretch?: string;
    fontStyle?: string;
    fontSize?: string | number;
    stringPropertyOptions?: PropertyOptions<string>;
};
type ParentOptions = PaintableOptions & NodeOptions;
export type TextOptions = SelfOptions & ParentOptions;
declare const Text_base: typeof Node & import("../../../phet-core/js/types/Constructor.js").default<import("./Paintable.js").TPaintable>;
export default class Text extends Text_base {
    private readonly _stringProperty;
    _font: Font;
    _boundsMethod: TextBoundsMethod;
    private _isHTML;
    private _cachedRenderedText;
    static readonly STRING_PROPERTY_NAME = "stringProperty";
    static readonly STRING_PROPERTY_TANDEM_NAME = "stringProperty";
    /**
     * @param string - See setString() for more documentation
     * @param [options] - Text-specific options are documented in TEXT_OPTION_KEYS above, and can be provided
     *                             along-side options for Node
     */
    constructor(string: string | number | TReadOnlyProperty<string>, options?: TextOptions);
    mutate(options?: TextOptions): this;
    /**
     * Sets the string displayed by our node.
     *
     * @param string - The string to display. If it's a number, it will be cast to a string
     */
    setString(string: string | number): this;
    set string(value: string | number);
    get string(): string;
    /**
     * Returns the string displayed by our text Node.
     *
     * NOTE: If a number was provided to setString(), it will not be returned as a number here.
     */
    getString(): string;
    /**
     * Returns a potentially modified version of this.string, where spaces are replaced with non-breaking spaces,
     * and embedding marks are potentially simplified.
     */
    getRenderedText(): string;
    get renderedText(): string;
    /**
     * Called when our string Property changes values.
     */
    private onStringPropertyChange;
    /**
     * See documentation for Node.setVisibleProperty, except this is for the text string.
     */
    setStringProperty(newTarget: TReadOnlyProperty<string> | null): this;
    set stringProperty(property: TReadOnlyProperty<string> | null);
    get stringProperty(): TProperty<string>;
    /**
     * Like Node.getVisibleProperty(), but for the text string. Note this is not the same as the Property provided in
     * setStringProperty. Thus is the nature of TinyForwardingProperty.
     */
    getStringProperty(): TProperty<string>;
    /**
     * See documentation and comments in Node.initializePhetioObject
     */
    protected initializePhetioObject(baseOptions: Partial<PhetioObjectOptions>, config: TextOptions): void;
    /**
     * Text supports a "string" selection mode, in which it will map to its stringProperty (if applicable), otherwise is
     * uses the default mouse-hit target from the supertype.
     */
    getPhetioMouseHitTarget(fromLinking?: boolean): PhetioObject | 'phetioNotSelectable';
    private getStringPropertyPhetioMouseHitTarget;
    /**
     * Sets the method that is used to determine bounds from the text.
     *
     * Possible values:
     * - 'fast' - Measures using SVG, can be inaccurate. Can't be rendered in Canvas.
     * - 'fastCanvas' - Like 'fast', but allows rendering in Canvas.
     * - 'accurate' - Recursively renders to a Canvas to accurately determine bounds. Slow, but works with all renderers.
     * - 'hybrid' - [default] Cache SVG height, and uses Canvas measureText for the width.
     *
     * TODO: deprecate fast/fastCanvas options? https://github.com/phetsims/scenery/issues/1581
     *
     * NOTE: Most of these are unfortunately not hard guarantees that content is all inside of the returned bounds.
     *       'accurate' should probably be the only one where that guarantee can be assumed. Things like cyrillic in
     *       italic, combining marks and other unicode features can fail to be detected. This is particularly relevant
     *       for the height, as certain stacked accent marks or descenders can go outside of the prescribed range,
     *       and fast/canvasCanvas/hybrid will always return the same vertical bounds (top and bottom) for a given font
     *       when the text isn't the empty string.
     */
    setBoundsMethod(method: TextBoundsMethod): this;
    set boundsMethod(value: TextBoundsMethod);
    get boundsMethod(): TextBoundsMethod;
    /**
     * Returns the current method to estimate the bounds of the text. See setBoundsMethod() for more information.
     */
    getBoundsMethod(): TextBoundsMethod;
    /**
     * Returns a bitmask representing the supported renderers for the current configuration of the Text node.
     *
     * @returns - A bitmask that includes supported renderers, see Renderer for details.
     */
    protected getTextRendererBitmask(): number;
    /**
     * Triggers a check and update for what renderers the current configuration supports.
     * This should be called whenever something that could potentially change supported renderers happen (which can
     * be isHTML, boundsMethod, etc.)
     */
    invalidateSupportedRenderers(): void;
    /**
     * Notifies that something about the text's potential bounds have changed (different string, different stroke or font,
     * etc.)
     */
    private invalidateText;
    /**
     * Computes a more efficient selfBounds for our Text.
     *
     * @returns - Whether the self bounds changed.
     */
    protected updateSelfBounds(): boolean;
    /**
     * Called from (and overridden in) the Paintable trait, invalidates our current stroke, triggering recomputation of
     * anything that depended on the old stroke's value. (scenery-internal)
     */
    invalidateStroke(): void;
    /**
     * Called from (and overridden in) the Paintable trait, invalidates our current fill, triggering recomputation of
     * anything that depended on the old fill's value. (scenery-internal)
     */
    invalidateFill(): void;
    /**
     * Draws the current Node's self representation, assuming the wrapper's Canvas context is already in the local
     * coordinate frame of this node.
     *
     * @param wrapper
     * @param matrix - The transformation matrix already applied to the context.
     */
    protected canvasPaintSelf(wrapper: CanvasContextWrapper, matrix: Matrix3): void;
    /**
     * Creates a DOM drawable for this Text. (scenery-internal)
     *
     * @param renderer - In the bitmask format specified by Renderer, which may contain additional bit flags.
     * @param instance - Instance object that will be associated with the drawable
     */
    createDOMDrawable(renderer: number, instance: Instance): DOMSelfDrawable;
    /**
     * Creates a SVG drawable for this Text. (scenery-internal)
     *
     * @param renderer - In the bitmask format specified by Renderer, which may contain additional bit flags.
     * @param instance - Instance object that will be associated with the drawable
     */
    createSVGDrawable(renderer: number, instance: Instance): SVGSelfDrawable;
    /**
     * Creates a Canvas drawable for this Text. (scenery-internal)
     *
     * @param renderer - In the bitmask format specified by Renderer, which may contain additional bit flags.
     * @param instance - Instance object that will be associated with the drawable
     */
    createCanvasDrawable(renderer: number, instance: Instance): CanvasSelfDrawable;
    /**
     * Returns a DOM element that contains the specified string. (scenery-internal)
     *
     * This is needed since we have to handle HTML text differently.
     */
    getDOMTextNode(): Element;
    /**
     * Returns a bounding box that should contain all self content in the local coordinate frame (our normal self bounds
     * aren't guaranteed this for Text)
     *
     * We need to add additional padding around the text when the text is in a container that could clip things badly
     * if the text is larger than the normal bounds computation.
     */
    getSafeSelfBounds(): Bounds2;
    /**
     * Sets the font of the Text node.
     *
     * This can either be a Scenery Font object, or a string. The string format is described by Font's constructor, and
     * is basically the CSS3 font shortcut format. If a string is provided, it will be wrapped with a new (immutable)
     * Scenery Font object.
     */
    setFont(font: Font | string): this;
    set font(value: Font | string);
    get font(): string;
    /**
     * Returns a string representation of the current Font.
     *
     * This returns the CSS3 font shortcut that is a possible input to setFont(). See Font's constructor for detailed
     * information on the ordering of information.
     *
     * NOTE: If a Font object was provided to setFont(), this will not currently return it.
     * TODO: Can we refactor so we can have access to (a) the Font object, and possibly (b) the initially provided value. https://github.com/phetsims/scenery/issues/1581
     */
    getFont(): string;
    /**
     * Sets the weight of this node's font.
     *
     * The font weight supports the following options:
     *   'normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900',
     *   or a number that when cast to a string will be one of the strings above.
     */
    setFontWeight(weight: FontWeight | number): this;
    set fontWeight(value: FontWeight | number);
    get fontWeight(): FontWeight;
    /**
     * Returns the weight of this node's font, see setFontWeight() for details.
     *
     * NOTE: If a numeric weight was passed in, it has been cast to a string, and a string will be returned here.
     */
    getFontWeight(): FontWeight;
    /**
     * Sets the family of this node's font.
     *
     * @param family - A comma-separated list of families, which can include generic families (preferably at
     *                 the end) such as 'serif', 'sans-serif', 'cursive', 'fantasy' and 'monospace'. If there
     *                 is any question about escaping (such as spaces in a font name), the family should be
     *                 surrounded by double quotes.
     */
    setFontFamily(family: string): this;
    set fontFamily(value: string);
    get fontFamily(): string;
    /**
     * Returns the family of this node's font, see setFontFamily() for details.
     */
    getFontFamily(): string;
    /**
     * Sets the stretch of this node's font.
     *
     * The font stretch supports the following options:
     *   'normal', 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed',
     *   'semi-expanded', 'expanded', 'extra-expanded' or 'ultra-expanded'
     */
    setFontStretch(stretch: FontStretch): this;
    set fontStretch(value: FontStretch);
    get fontStretch(): FontStretch;
    /**
     * Returns the stretch of this node's font, see setFontStretch() for details.
     */
    getFontStretch(): FontStretch;
    /**
     * Sets the style of this node's font.
     *
     * The font style supports the following options: 'normal', 'italic' or 'oblique'
     */
    setFontStyle(style: FontStyle): this;
    set fontStyle(value: FontStyle);
    get fontStyle(): FontStyle;
    /**
     * Returns the style of this node's font, see setFontStyle() for details.
     */
    getFontStyle(): FontStyle;
    /**
     * Sets the size of this node's font.
     *
     * The size can either be a number (created as a quantity of 'px'), or any general CSS font-size string (for
     * example, '30pt', '5em', etc.)
     */
    setFontSize(size: string | number): this;
    set fontSize(value: string | number);
    get fontSize(): string;
    /**
     * Returns the size of this node's font, see setFontSize() for details.
     *
     * NOTE: If a numeric size was passed in, it has been converted to a string with 'px', and a string will be
     * returned here.
     */
    getFontSize(): string;
    /**
     * Whether this Node itself is painted (displays something itself).
     */
    isPainted(): boolean;
    /**
     * Whether this Node's selfBounds are considered to be valid (always containing the displayed self content
     * of this node). Meant to be overridden in subtypes when this can change (e.g. Text).
     *
     * If this value would potentially change, please trigger the event 'selfBoundsValid'.
     */
    areSelfBoundsValid(): boolean;
    /**
     * Override for extra information in the debugging output (from Display.getDebugHTML()). (scenery-internal)
     */
    getDebugHTMLExtras(): string;
    dispose(): void;
    /**
     * Replaces embedding mark characters with visible strings. Useful for debugging for strings with embedding marks.
     *
     * @returns - With embedding marks replaced.
     */
    static embeddedDebugString(string: string): string;
    /**
     * Returns a (potentially) modified string where embedding marks have been simplified.
     *
     * This simplification wouldn't usually be necessary, but we need to prevent cases like
     * https://github.com/phetsims/scenery/issues/520 where Edge decides to turn [POP][LTR] (after another [LTR]) into
     * a 'box' character, when nothing should be rendered.
     *
     * This will remove redundant nesting:
     *   e.g. [LTR][LTR]boo[POP][POP] => [LTR]boo[POP])
     * and will also combine adjacent directions:
     *   e.g. [LTR]Mail[POP][LTR]Man[POP] => [LTR]MailMan[Pop]
     *
     * Note that it will NOT combine in this way if there was a space between the two LTRs:
     *   e.g. [LTR]Mail[POP] [LTR]Man[Pop])
     * as in the general case, we'll want to preserve the break there between embeddings.
     *
     * TODO: A stack-based implementation that doesn't create a bunch of objects/closures would be nice for performance.
     */
    static simplifyEmbeddingMarks(string: string): string;
    static TextIO: IOType;
}
export {};
//# sourceMappingURL=Text.d.ts.map