UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

1 lines 52.5 kB
{"version":3,"file":"TextStyle.mjs","sources":["../../../src/scene/text/TextStyle.ts"],"sourcesContent":["import EventEmitter from 'eventemitter3';\nimport { Color, type ColorSource } from '../../color/Color';\nimport { type Filter } from '../../filters/Filter';\nimport { deprecation, v8_0_0 } from '../../utils/logging/deprecation';\nimport { FillGradient } from '../graphics/shared/fill/FillGradient';\nimport { FillPattern } from '../graphics/shared/fill/FillPattern';\nimport { GraphicsContext } from '../graphics/shared/GraphicsContext';\nimport {\n toFillStyle,\n toStrokeStyle\n} from '../graphics/shared/utils/convertFillInputToFillStyle';\nimport { generateTextStyleKey } from './utils/generateTextStyleKey';\n\nimport type { TextureDestroyOptions, TypeOrBool } from '../container/destroyTypes';\nimport type {\n ConvertedFillStyle,\n ConvertedStrokeStyle,\n FillInput,\n FillStyle,\n StrokeInput,\n StrokeStyle\n} from '../graphics/shared/FillTypes';\n\n/**\n * The alignment of the text.\n *\n * - 'left': Aligns text to the left edge.\n * - 'center': Centers text horizontally.\n * - 'right': Aligns text to the right edge.\n * - 'justify': Justifies text, aligning both left and right edges.\n * @example\n * ```ts\n * import { TextStyle } from 'pixi.js';\n * const style = new TextStyle({\n * align: 'center', // or 'left', 'right', 'justify'\n * });\n * ```\n * @category text\n * @standard\n */\nexport type TextStyleAlign = 'left' | 'center' | 'right' | 'justify';\n/**\n * The fill style input for text styles.\n *\n * This can be:\n * - A color string like 'red', '#00FF00', or 'rgba(255,0,0,0.5)'\n * - A hex number like 0xff0000 for red\n * - A FillStyle object with properties like { color: 0xff0000, alpha: 0.5 }\n * - A FillGradient for gradient fills\n * - A FillPattern for pattern/texture fills\n * @example\n * ```ts\n * // Simple Fills\n * new TextStyle({ fill: 'red' }); // Color string\n * new TextStyle({ fill: 0x00ff00 }); // Hex color\n * new TextStyle({ fill: 'rgb(255,0,0)' }); // RGB string\n * // Gradients\n * new TextStyle({\n * fill: new FillGradient({\n * end: { x: 1, y: 1 },\n * stops: [\n * { color: 0xff0000, offset: 0 }, // Red at start\n * { color: 0x0000ff, offset: 1 }, // Blue at end\n * ]\n * }),\n * });\n * // Patterns\n * new TextStyle({\n * fill: new FillPattern(Assets.get('pattern.png'))\n * });\n * ```\n * @category text\n * @standard\n */\nexport type TextStyleFill = string | string[] | number | number[] | CanvasGradient | CanvasPattern;\n/**\n * The font style input for text styles. Controls the slant or italicization of the text.\n * @example\n * ```ts\n * // Create text with normal font style\n * const normalText = new Text({\n * text: 'Normal Style Text',\n * style: {\n * fontStyle: 'normal',\n * fontSize: 24\n * }\n * });\n *\n * // Create italic text\n * const italicText = new Text({\n * text: 'Italic Style Text',\n * style: {\n * fontStyle: 'italic',\n * fontSize: 24,\n * fontFamily: 'Arial'\n * }\n * });\n *\n * // Create oblique text\n * const obliqueText = new Text({\n * text: 'Oblique Style Text',\n * style: {\n * fontStyle: 'oblique',\n * fontSize: 24,\n * fontFamily: 'Times New Roman'\n * }\n * });\n *\n * // Dynamic style changes\n * let isItalic = false;\n * text.style = {\n * ...text.style,\n * fontStyle: isItalic ? 'italic' : 'normal'\n * };\n * ```\n *\n * Supported values:\n * - 'normal': Regular upright text with no slant\n * - 'italic': True italics using specifically designed italic glyphs\n * - 'oblique': Slanted version of the regular glyphs\n * @remarks\n * - 'italic' uses specially designed glyphs with cursive characteristics\n * - 'oblique' is a mechanical slant of the normal glyphs\n * - Not all fonts include true italic designs; some may fall back to oblique\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-style | MDN font-style}\n * @category text\n * @standard\n */\nexport type TextStyleFontStyle = 'normal' | 'italic' | 'oblique';\n/**\n * The font variant input for text styles. Controls the capitalization and presentation of letters.\n * Used to enable special rendering like small caps.\n * @example\n * ```ts\n * // Create text with normal font variant\n * const normalText = new Text({\n * text: 'Normal Text',\n * style: {\n * fontVariant: 'normal',\n * fontSize: 24\n * }\n * });\n *\n * // Create text with small-caps variant\n * const smallCapsText = new Text({\n * text: 'Small Caps Text',\n * style: {\n * fontVariant: 'small-caps',\n * fontSize: 24,\n * fontFamily: 'Arial'\n * }\n * });\n *\n * // Use in a TextStyle instance\n * const style = new TextStyle({\n * fontVariant: 'small-caps',\n * fontSize: 32,\n * fill: 0x4a4a4a\n * });\n *\n * // Update variant dynamically\n * text.style = {\n * ...text.style,\n * fontVariant: text.style.fontVariant === 'normal' ? 'small-caps' : 'normal'\n * };\n * ```\n *\n * Supported values:\n * - 'normal': Regular text rendering with standard capitalization\n * - 'small-caps': Renders lowercase letters as smaller versions of capital letters\n * @remarks\n * Small caps are only available if the font supports them.\n * Not all fonts include true small caps glyphs.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant | MDN font-variant}\n * @category text\n * @standard\n */\nexport type TextStyleFontVariant = 'normal' | 'small-caps';\n/**\n * The font weight input for text styles. Controls the thickness or boldness of the text.\n * @example\n * ```ts\n * // Create text with different font weights\n * const normalText = new Text({\n * text: 'Normal Weight',\n * style: { fontWeight: 'normal' }\n * });\n *\n * const boldText = new Text({\n * text: 'Bold Weight',\n * style: { fontWeight: 'bold' }\n * });\n *\n * // Using numeric weights\n * const lightText = new Text({\n * text: 'Light Weight',\n * style: { fontWeight: '300' }\n * });\n *\n * const mediumText = new Text({\n * text: 'Medium Weight',\n * style: { fontWeight: '500' }\n * });\n *\n * const heavyText = new Text({\n * text: 'Heavy Weight',\n * style: { fontWeight: '900' }\n * });\n *\n * // Responsive weight changes\n * const adaptiveText = new Text({\n * text: 'Adaptive Weight',\n * style: { fontWeight: window.innerWidth > 600 ? 'bold' : 'normal' }\n * });\n * ```\n *\n * Supported values:\n * - 'normal': Standard weight (equivalent to 400)\n * - 'bold': Bold weight (equivalent to 700)\n * - 'bolder': One weight darker than the parent element\n * - 'lighter': One weight lighter than the parent element\n * - '100': Thin (Hairline)\n * - '200': Extra Light (Ultra Light)\n * - '300': Light\n * - '400': Normal\n * - '500': Medium\n * - '600': Semi Bold (Demi Bold)\n * - '700': Bold\n * - '800': Extra Bold (Ultra Bold)\n * - '900': Heavy (Black)\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight | MDN font-weight}\n * @category text\n * @standard\n */\nexport type TextStyleFontWeight =\n | 'normal' // Standard weight (400)\n | 'bold' // Bold weight (700)\n | 'bolder' // Relative weight increase\n | 'lighter' // Relative weight decrease\n | '100' // Thin\n | '200' // Extra Light\n | '300' // Light\n | '400' // Normal\n | '500' // Medium\n | '600' // Semi Bold\n | '700' // Bold\n | '800' // Extra Bold\n | '900'; // Heavy\n/**\n * The line join style for text strokes. Determines how lines connect at corners.\n * @example\n * ```ts\n * // Create text with miter joins (sharp corners)\n * const sharpText = new Text({\n * text: 'Sharp Corners',\n * style: {\n * fontSize: 36,\n * stroke: {\n * color: '#4a1850',\n * width: 4,\n * lineJoin: 'miter' // Sharp corners\n * }\n * }\n * });\n *\n * // Create text with round joins\n * const roundText = new Text({\n * text: 'Rounded Corners',\n * style: {\n * fontSize: 36,\n * stroke: {\n * color: '#4a1850',\n * width: 4,\n * lineJoin: 'round' // Smooth rounded corners\n * }\n * }\n * });\n *\n * // Create text with beveled joins\n * const bevelText = new Text({\n * text: 'Beveled Corners',\n * style: {\n * fontSize: 36,\n * stroke: {\n * color: '#4a1850',\n * width: 4,\n * lineJoin: 'bevel' // Flattened corners\n * }\n * }\n * });\n * ```\n * Available values:\n * - 'miter': Creates sharp corners by extending the outer edges until they meet\n * - 'round': Creates smooth, rounded corners using a circular arc\n * - 'bevel': Creates flattened corners by filling an additional triangle between the outer edges\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineJoin | MDN lineJoin}\n * @category text\n * @standard\n */\nexport type TextStyleLineJoin = 'miter' | 'round' | 'bevel';\n/**\n * The text baseline for text styles.\n *\n * This can be:\n * - 'alphabetic': The alphabetic baseline\n * - 'top': The top of the text\n * - 'hanging': The hanging baseline\n * - 'middle': The middle of the text\n * - 'ideographic': The ideographic baseline\n * - 'bottom': The bottom of the text\n * @category text\n * @standard\n */\nexport type TextStyleTextBaseline = 'alphabetic' | 'top' | 'hanging' | 'middle' | 'ideographic' | 'bottom';\n/**\n * Controls how whitespace (spaces, tabs, and line breaks) is handled within the text.\n * This affects text wrapping and spacing behavior.\n * @example\n * ```ts\n * // Normal mode (collapse spaces and newlines)\n * const normalText = new Text({\n * text: 'Hello World\\n\\nNew Line',\n * style: {\n * whiteSpace: 'normal',\n * fontSize: 24\n * }\n * }); // Renders as: \"Hello World New Line\"\n *\n * // Pre mode (preserve all whitespace)\n * const preText = new Text({\n * text: 'Hello World\\n\\nNew Line',\n * style: {\n * whiteSpace: 'pre',\n * fontSize: 24\n * }\n * }); // Preserves spaces and line breaks exactly\n *\n * // Pre-line mode (preserve newlines, collapse spaces)\n * const preLineText = new Text({\n * text: 'Hello World\\n\\nNew Line',\n * style: {\n * whiteSpace: 'pre-line',\n * fontSize: 24\n * }\n * }); // Preserves line breaks, collapses multiple spaces\n *\n * // With word wrap enabled\n * const wrappedText = new Text({\n * text: 'A long text with multiple spaces\\nand line breaks',\n * style: {\n * whiteSpace: 'pre-line',\n * wordWrap: true,\n * wordWrapWidth: 200,\n * fontSize: 24\n * }\n * });\n * ```\n *\n * Supported values:\n * - 'normal': Collapses all whitespace (spaces, tabs, line breaks) into a single space\n * - 'pre': Preserves all whitespace characters exactly as written\n * - 'pre-line': Preserves line breaks but collapses multiple spaces into a single space\n * @remarks\n * - 'normal' is best for single-line text or when you want to ignore formatting\n * - 'pre' is useful for code blocks or when exact spacing is important\n * - 'pre-line' is good for formatted text where you want to keep line breaks but clean up spaces\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/white-space | MDN white-space}\n * @see {@link TextStyle#wordWrap} For controlling text wrapping\n * @category text\n * @standard\n */\nexport type TextStyleWhiteSpace = 'normal' | 'pre' | 'pre-line';\n\n/**\n * Defines a drop shadow effect for text rendering.\n * Drop shadows add depth and emphasis to text by creating a shadow offset from the text.\n * @example\n * ```ts\n * // Create text with basic drop shadow\n * const text = new Text({\n * text: 'Shadow Text',\n * style: {\n * fontSize: 48,\n * dropShadow: {\n * alpha: 0.5, // 50% opacity shadow\n * angle: Math.PI / 6, // 30 degrees\n * blur: 4, // Soft shadow edge\n * color: '#000000', // Black shadow\n * distance: 6 // Shadow offset\n * }\n * }\n * });\n *\n * // Dynamic shadow updates\n * text.style.dropShadow = {\n * alpha: Math.sin(Date.now() / 1000) * 0.5 + 0.5, // Pulsing opacity\n * angle: Date.now() / 1000, // Rotating angle\n * blur: 4,\n * color: '#000000',\n * distance: 6\n * };\n * ```\n * @category text\n * @standard\n */\nexport type TextDropShadow = {\n /**\n * The opacity of the drop shadow.\n * - Range: 0 to 1\n * - 0 = fully transparent\n * - 1 = fully opaque\n * @example\n * ```ts\n * // Set drop shadow opacity to 50%\n * dropShadow: {\n * alpha: 0.5\n * }\n * ```\n * @default 1\n */\n alpha: number;\n\n /**\n * The angle of the drop shadow in radians.\n * - 0 = right\n * - Math.PI/2 = down\n * - Math.PI = left\n * - Math.PI*1.5 = up\n * @example\n * ```ts\n * // Set drop shadow angle to 30 degrees\n * dropShadow: {\n * angle: Math.PI / 6 // 30 degrees\n * }\n * ```\n * @default Math.PI/6 (30 degrees)\n */\n angle: number;\n\n /**\n * The blur radius of the shadow.\n * - 0 = sharp shadow\n * - Higher values = softer shadow\n * @example\n * ```ts\n * // Set drop shadow blur radius to 10 pixels\n * dropShadow: {\n * blur: 10\n * }\n * ```\n * @default 0\n */\n blur: number;\n\n /**\n * The color of the drop shadow.\n * Accepts any valid CSS color string, hex number, or RGB/RGBA values.\n * @example '#000000', 'rgba(0,0,0,0.5)', 0x000000\n * @default 'black'\n */\n color: ColorSource;\n\n /**\n * The distance of the drop shadow from the text.\n * Measured in pixels.\n * @example\n * ```ts\n * // Set drop shadow distance to 5 pixels\n * dropShadow: {\n * distance: 5\n * }\n * ```\n * @default 5\n */\n distance: number;\n};\n\n/**\n * Constructor options used for `TextStyle` instances. Defines the visual appearance and layout of text.\n * @example\n * ```ts\n * // Basic text style\n * const basicStyle = new TextStyle({\n * fontSize: 24,\n * fill: 'black',\n * fontFamily: 'Arial'\n * });\n *\n * // Rich text style with multiple features\n * const richStyle = new TextStyle({\n * fontFamily: ['Arial', 'Helvetica', 'sans-serif'],\n * fontSize: 36,\n * fontWeight: 'bold',\n * fill: 'red',\n * stroke: { color: '#4a1850', width: 5 },\n * align: 'center',\n * dropShadow: {\n * color: '#000000',\n * blur: 4,\n * distance: 6,\n * angle: Math.PI / 6\n * },\n * wordWrap: true,\n * wordWrapWidth: 440,\n * lineHeight: 40,\n * textBaseline: 'middle'\n * });\n * ```\n * @see {@link TextStyle} For the main style class\n * @category text\n * @standard\n */\nexport interface TextStyleOptions\n{\n /**\n * Alignment for multiline text, does not affect single line text\n * @default 'left'\n */\n align?: TextStyleAlign;\n /**\n * Whether to allow line breaks within words.\n * Requires wordWrap to be true.\n * @example\n * ```ts\n * // Enable word breaking\n * const style = new TextStyle({\n * breakWords: true,\n * wordWrap: true,\n * wordWrapWidth: 200\n * });\n * ```\n * @default false\n */\n breakWords?: boolean;\n /**\n * Drop shadow configuration for the text.\n * Can be boolean or a TextDropShadow object.\n * @default null\n */\n dropShadow?: boolean | Partial<TextDropShadow>;\n /**\n * Fill style for the text.\n * Can be a color, gradient, or pattern.\n * @default 'black'\n */\n fill?: FillInput;\n /**\n * Font family or families to use.\n * Can be single name or array of fallbacks.\n * @example\n * ```ts\n * // Single font family\n * fontFamily: 'Arial'\n * // Multiple font families\n * fontFamily: ['Helvetica', 'Arial', 'sans-serif']\n * ```\n * @default 'Arial'\n */\n fontFamily?: string | string[];\n /**\n * Font size in pixels or as string.\n *\n * Equivalents are '26px','20pt','160%' or '1.6em')\n * @example\n * ```ts\n * // Numeric size\n * fontSize: 26\n * // String size\n * fontSize: '26px'\n * // Percentage size\n * fontSize: '160%' // 1.6 times the parent element's font size\n * // Em size\n * fontSize: '1.6em' // 1.6 times the parent element's font size\n * @default 26\n */\n fontSize?: number | string;\n /**\n * Font style (normal, italic, oblique).\n * @default 'normal'\n */\n fontStyle?: TextStyleFontStyle;\n /**\n * Font variant (normal, small-caps).\n * @default 'normal'\n */\n fontVariant?: TextStyleFontVariant;\n /**\n * Font weight (normal, bold, bolder, lighter, 100-900).\n * @default 'normal'\n */\n fontWeight?: TextStyleFontWeight;\n /** The height of the line, a number that represents the vertical space that a letter uses. */\n leading?: number;\n /** The amount of spacing between letters, default is 0 */\n letterSpacing?: number;\n /** The line height, a number that represents the vertical space that a letter uses */\n lineHeight?: number;\n /**\n * Padding around the text.\n *\n * Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n */\n padding?: number;\n /**\n * Stroke style for text outline.\n * @default null\n */\n stroke?: StrokeInput;\n /**\n * Vertical alignment baseline.\n * @default 'alphabetic'\n */\n textBaseline?: TextStyleTextBaseline;\n /**\n * Whether to trim transparent edges.\n * > [!NOTE] This is an expensive operation and should only be used when necessary.\n * @default false\n */\n trim?: boolean;\n /**\n * How to handle whitespace.\n *\n * It needs wordWrap to be set to true for this to have an effect.\n * @default 'pre'\n */\n whiteSpace?: TextStyleWhiteSpace;\n /** Indicates if word wrap should be used */\n wordWrap?: boolean;\n /** The width at which text will wrap, it needs wordWrap to be set to true */\n wordWrapWidth?: number;\n /**\n * Array of filters to apply to the text.\n *\n * These filters will be applied to the text as it is created, resulting in faster rendering for static text\n * compared to applying the filter directly to the text object (which would be applied at run time).\n * @default undefined\n */\n filters?: Filter[];\n}\n\n/**\n * A TextStyle Object contains information to decorate Text objects.\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n * @example\n * ```ts\n * // Create a basic text style\n * const style = new TextStyle({\n * fontFamily: ['Helvetica', 'Arial', 'sans-serif'],\n * fontSize: 36,\n * fill: 0xff1010,\n * align: 'center'\n * });\n *\n * // Create a rich text style with multiple features\n * const richStyle = new TextStyle({\n * fontFamily: 'Arial',\n * fontSize: 32,\n * fill: ['#FF0000', '#00FF00'], // Gradient fill\n * stroke: {\n * color: '#4a1850',\n * width: 5\n * },\n * dropShadow: {\n * color: '#000000',\n * blur: 4,\n * distance: 6,\n * angle: Math.PI / 6\n * },\n * wordWrap: true,\n * wordWrapWidth: 440,\n * lineHeight: 40,\n * align: 'center'\n * });\n *\n * // Share style between multiple text objects\n * const text1 = new Text({\n * text: 'Hello',\n * style: richStyle\n * });\n *\n * const text2 = new Text({\n * text: 'World',\n * style: richStyle\n * });\n *\n * // Update style dynamically - affects all text objects\n * richStyle.fontSize = 48;\n * richStyle.fill = 0x00ff00;\n * ```\n *\n * Key Features:\n * - Shared styling between multiple text objects\n * - Rich text formatting options\n * - Gradient and pattern fills\n * - Drop shadows and strokes\n * - Word wrapping and alignment\n * - Dynamic updates\n * @category text\n * @standard\n */\nexport class TextStyle extends EventEmitter<{\n update: TextDropShadow\n}>\n{\n /**\n * Default drop shadow settings used when enabling drop shadows on text.\n * These values are used as the base configuration when drop shadows are enabled without specific settings.\n * @example\n * ```ts\n * // Customize default settings globally\n * TextStyle.defaultDropShadow.alpha = 0.5; // 50% opacity for all shadows\n * TextStyle.defaultDropShadow.blur = 2; // 2px blur for all shadows\n * TextStyle.defaultDropShadow.color = 'blue'; // Blue shadows by default\n * ```\n */\n public static defaultDropShadow: TextDropShadow = {\n alpha: 1,\n angle: Math.PI / 6,\n blur: 0,\n color: 'black',\n distance: 5,\n };\n\n /**\n * Default text style settings used when creating new text objects.\n * These values serve as the base configuration and can be customized globally.\n * @example\n * ```ts\n * // Customize default text style globally\n * TextStyle.defaultTextStyle.fontSize = 16;\n * TextStyle.defaultTextStyle.fill = 0x333333;\n * TextStyle.defaultTextStyle.fontFamily = ['Arial', 'Helvetica', 'sans-serif'];\n * ```\n */\n public static defaultTextStyle: TextStyleOptions = {\n align: 'left',\n breakWords: false,\n dropShadow: null,\n fill: 'black',\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n leading: 0,\n letterSpacing: 0,\n lineHeight: 0,\n padding: 0,\n stroke: null,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n };\n\n // colors!!\n /** @internal */\n public _fill: ConvertedFillStyle;\n private _originalFill: FillInput;\n\n /** @internal */\n public _stroke: ConvertedStrokeStyle;\n private _originalStroke: StrokeInput;\n\n private _dropShadow: TextDropShadow;\n\n private _fontFamily: string | string[];\n private _fontSize: number;\n private _fontStyle: TextStyleFontStyle;\n private _fontVariant: TextStyleFontVariant;\n private _fontWeight: TextStyleFontWeight;\n\n private _breakWords: boolean;\n private _align: TextStyleAlign;\n private _leading: number;\n private _letterSpacing: number;\n private _lineHeight: number;\n\n private _textBaseline: TextStyleTextBaseline;\n private _whiteSpace: TextStyleWhiteSpace;\n private _wordWrap: boolean;\n private _wordWrapWidth: number;\n private _filters: Filter[];\n\n private _padding: number;\n\n protected _styleKey: string;\n private _trim: boolean;\n\n constructor(style: Partial<TextStyleOptions> = {})\n {\n super();\n\n convertV7Tov8Style(style);\n\n const fullStyle = { ...TextStyle.defaultTextStyle, ...style };\n\n for (const key in fullStyle)\n {\n const thisKey = key as keyof typeof this;\n\n this[thisKey] = fullStyle[key as keyof TextStyleOptions] as any;\n }\n\n this.update();\n }\n\n /**\n * Alignment for multiline text, does not affect single line text.\n * @type {'left'|'center'|'right'|'justify'}\n */\n get align(): TextStyleAlign { return this._align; }\n set align(value: TextStyleAlign) { this._align = value; this.update(); }\n /** Indicates if lines can be wrapped within words, it needs wordWrap to be set to true. */\n get breakWords(): boolean { return this._breakWords; }\n set breakWords(value: boolean) { this._breakWords = value; this.update(); }\n /** Set a drop shadow for the text. */\n get dropShadow(): TextDropShadow { return this._dropShadow; }\n set dropShadow(value: boolean | TextDropShadow)\n {\n if (value !== null && typeof value === 'object')\n {\n this._dropShadow = this._createProxy({ ...TextStyle.defaultDropShadow, ...value });\n }\n else\n {\n this._dropShadow = value ? this._createProxy({ ...TextStyle.defaultDropShadow }) : null;\n }\n\n this.update();\n }\n /** The font family, can be a single font name, or a list of names where the first is the preferred font. */\n get fontFamily(): string | string[] { return this._fontFamily; }\n set fontFamily(value: string | string[]) { this._fontFamily = value; this.update(); }\n /** The font size (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') */\n get fontSize(): number { return this._fontSize; }\n set fontSize(value: string | number)\n {\n if (typeof value === 'string')\n {\n // eg '34px' to number\n this._fontSize = parseInt(value as string, 10);\n }\n else\n {\n this._fontSize = value as number;\n }\n this.update();\n }\n /**\n * The font style.\n * @type {'normal'|'italic'|'oblique'}\n */\n get fontStyle(): TextStyleFontStyle { return this._fontStyle; }\n set fontStyle(value: TextStyleFontStyle)\n {\n this._fontStyle = value.toLowerCase() as TextStyleFontStyle;\n this.update();\n }\n /**\n * The font variant.\n * @type {'normal'|'small-caps'}\n */\n get fontVariant(): TextStyleFontVariant { return this._fontVariant; }\n set fontVariant(value: TextStyleFontVariant) { this._fontVariant = value; this.update(); }\n /**\n * The font weight.\n * @type {'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900'}\n */\n get fontWeight(): TextStyleFontWeight { return this._fontWeight; }\n set fontWeight(value: TextStyleFontWeight) { this._fontWeight = value; this.update(); }\n /** The space between lines. */\n get leading(): number { return this._leading; }\n set leading(value: number) { this._leading = value; this.update(); }\n /** The amount of spacing between letters, default is 0. */\n get letterSpacing(): number { return this._letterSpacing; }\n set letterSpacing(value: number) { this._letterSpacing = value; this.update(); }\n /** The line height, a number that represents the vertical space that a letter uses. */\n get lineHeight(): number { return this._lineHeight; }\n set lineHeight(value: number) { this._lineHeight = value; this.update(); }\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n * > [!NOTE] This will NOT affect the positioning or bounds of the text.\n */\n get padding(): number { return this._padding; }\n set padding(value: number) { this._padding = value; this.update(); }\n /**\n * An optional filter or array of filters to apply to the text, allowing for advanced visual effects.\n * These filters will be applied to the text as it is created, resulting in faster rendering for static text\n * compared to applying the filter directly to the text object (which would be applied at run time).\n * @default null\n */\n get filters(): Filter[] { return this._filters; }\n set filters(value: Filter[]) { this._filters = value; this.update(); }\n\n /**\n * Trim transparent borders from the text texture.\n * > [!IMPORTANT] PERFORMANCE WARNING:\n * > This is a costly operation as it requires scanning pixel alpha values.\n * > Avoid using `trim: true` for dynamic text, as it could significantly impact performance.\n */\n get trim(): boolean { return this._trim; }\n set trim(value: boolean) { this._trim = value; this.update(); }\n /**\n * The baseline of the text that is rendered.\n * @type {'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom'}\n */\n get textBaseline(): TextStyleTextBaseline { return this._textBaseline; }\n set textBaseline(value: TextStyleTextBaseline) { this._textBaseline = value; this.update(); }\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n * @type {'normal'|'pre'|'pre-line'}\n */\n get whiteSpace(): TextStyleWhiteSpace { return this._whiteSpace; }\n set whiteSpace(value: TextStyleWhiteSpace) { this._whiteSpace = value; this.update(); }\n /** Indicates if word wrap should be used. */\n get wordWrap(): boolean { return this._wordWrap; }\n set wordWrap(value: boolean) { this._wordWrap = value; this.update(); }\n /** The width at which text will wrap, it needs wordWrap to be set to true. */\n get wordWrapWidth(): number { return this._wordWrapWidth; }\n set wordWrapWidth(value: number) { this._wordWrapWidth = value; this.update(); }\n\n /**\n * The fill style that will be used to color the text.\n * This can be:\n * - A color string like 'red', '#00FF00', or 'rgba(255,0,0,0.5)'\n * - A hex number like 0xff0000 for red\n * - A FillStyle object with properties like { color: 0xff0000, alpha: 0.5 }\n * - A FillGradient for gradient fills\n * - A FillPattern for pattern/texture fills\n *\n * When using a FillGradient, vertical gradients (angle of 90 degrees) are applied per line of text,\n * while gradients at any other angle are spread across the entire text body as a whole.\n * @example\n * // Vertical gradient applied per line\n * const verticalGradient = new FillGradient(0, 0, 0, 1)\n * .addColorStop(0, 0xff0000)\n * .addColorStop(1, 0x0000ff);\n *\n * const text = new Text({\n * text: 'Line 1\\nLine 2',\n * style: { fill: verticalGradient }\n * });\n *\n * To manage the gradient in a global scope, set the textureSpace property of the FillGradient to 'global'.\n * @type {string|number|FillStyle|FillGradient|FillPattern}\n */\n get fill(): FillInput\n {\n return this._originalFill;\n }\n\n set fill(value: FillInput)\n {\n if (value === this._originalFill) return;\n\n this._originalFill = value;\n\n if (this._isFillStyle(value))\n {\n this._originalFill = this._createProxy({ ...GraphicsContext.defaultFillStyle, ...value }, () =>\n {\n this._fill = toFillStyle(\n { ...this._originalFill as FillStyle },\n GraphicsContext.defaultFillStyle\n );\n });\n }\n\n this._fill = toFillStyle(\n value === 0x0 ? 'black' : value,\n GraphicsContext.defaultFillStyle\n );\n this.update();\n }\n\n /** A fillstyle that will be used on the text stroke, e.g., 'blue', '#FCFF00'. */\n get stroke(): StrokeInput\n {\n return this._originalStroke;\n }\n\n set stroke(value: StrokeInput)\n {\n if (value === this._originalStroke) return;\n\n this._originalStroke = value;\n\n if (this._isFillStyle(value))\n {\n this._originalStroke = this._createProxy({ ...GraphicsContext.defaultStrokeStyle, ...value }, () =>\n {\n this._stroke = toStrokeStyle(\n { ...this._originalStroke as StrokeStyle },\n GraphicsContext.defaultStrokeStyle\n );\n });\n }\n\n this._stroke = toStrokeStyle(value, GraphicsContext.defaultStrokeStyle);\n this.update();\n }\n\n protected _generateKey(): string\n {\n this._styleKey = generateTextStyleKey(this);\n\n return this._styleKey;\n }\n\n public update()\n {\n this._styleKey = null;\n this.emit('update', this);\n }\n\n /** Resets all properties to the default values */\n public reset()\n {\n const defaultStyle = TextStyle.defaultTextStyle;\n\n for (const key in defaultStyle)\n {\n this[key as keyof typeof this] = defaultStyle[key as keyof TextStyleOptions] as any;\n }\n }\n\n /** @internal */\n get styleKey()\n {\n return this._styleKey || this._generateKey();\n }\n\n /**\n * Creates a new TextStyle object with the same values as this one.\n * @returns New cloned TextStyle object\n */\n public clone(): TextStyle\n {\n return new TextStyle({\n align: this.align,\n breakWords: this.breakWords,\n dropShadow: this._dropShadow ? { ...this._dropShadow } : null,\n fill: this._fill,\n fontFamily: this.fontFamily,\n fontSize: this.fontSize,\n fontStyle: this.fontStyle,\n fontVariant: this.fontVariant,\n fontWeight: this.fontWeight,\n leading: this.leading,\n letterSpacing: this.letterSpacing,\n lineHeight: this.lineHeight,\n padding: this.padding,\n stroke: this._stroke,\n textBaseline: this.textBaseline,\n whiteSpace: this.whiteSpace,\n wordWrap: this.wordWrap,\n wordWrapWidth: this.wordWrapWidth,\n filters: this._filters ? [...this._filters] : undefined,\n });\n }\n\n /**\n * Returns the final padding for the text style, taking into account any filters applied.\n * Used internally for correct measurements\n * @internal\n * @returns {number} The final padding for the text style.\n */\n public _getFinalPadding(): number\n {\n let filterPadding = 0;\n\n if (this._filters)\n {\n for (let i = 0; i < this._filters.length; i++)\n {\n filterPadding += this._filters[i].padding;\n }\n }\n\n return Math.max(this._padding, filterPadding);\n }\n\n /**\n * Destroys this text style.\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @example\n * // Destroy the text style and its textures\n * textStyle.destroy({ texture: true, textureSource: true });\n * textStyle.destroy(true);\n */\n public destroy(options: TypeOrBool<TextureDestroyOptions> = false)\n {\n this.removeAllListeners();\n\n const destroyTexture = typeof options === 'boolean' ? options : options?.texture;\n\n if (destroyTexture)\n {\n const destroyTextureSource = typeof options === 'boolean' ? options : options?.textureSource;\n\n if (this._fill?.texture)\n {\n this._fill.texture.destroy(destroyTextureSource);\n }\n\n if ((this._originalFill as FillStyle)?.texture)\n {\n (this._originalFill as FillStyle).texture.destroy(destroyTextureSource);\n }\n\n if (this._stroke?.texture)\n {\n this._stroke.texture.destroy(destroyTextureSource);\n }\n\n if ((this._originalStroke as FillStyle)?.texture)\n {\n (this._originalStroke as FillStyle).texture.destroy(destroyTextureSource);\n }\n }\n\n this._fill = null;\n this._stroke = null;\n this.dropShadow = null;\n this._originalStroke = null;\n this._originalFill = null;\n }\n\n private _createProxy<T extends object>(value: T, cb?: (property: string, newValue: any) => void): T\n {\n return new Proxy<T>(value, {\n set: (target, property, newValue) =>\n {\n target[property as keyof T] = newValue;\n cb?.(property as string, newValue);\n this.update();\n\n return true;\n }\n });\n }\n\n private _isFillStyle(value: FillInput): value is FillStyle\n {\n return ((value ?? null) !== null\n && !(Color.isColorLike(value) || value instanceof FillGradient || value instanceof FillPattern));\n }\n}\n\nfunction convertV7Tov8Style(style: TextStyleOptions)\n{\n const oldStyle = style as TextStyleOptions & {\n dropShadowAlpha?: number;\n dropShadowAngle?: number;\n dropShadowBlur?: number;\n dropShadowColor?: number;\n dropShadowDistance?: number;\n fillGradientStops?: number[];\n strokeThickness?: number;\n };\n\n if (typeof oldStyle.dropShadow === 'boolean' && oldStyle.dropShadow)\n {\n const defaults = TextStyle.defaultDropShadow;\n\n style.dropShadow = {\n alpha: oldStyle.dropShadowAlpha ?? defaults.alpha,\n angle: oldStyle.dropShadowAngle ?? defaults.angle,\n blur: oldStyle.dropShadowBlur ?? defaults.blur,\n color: oldStyle.dropShadowColor ?? defaults.color,\n distance: oldStyle.dropShadowDistance ?? defaults.distance,\n };\n }\n\n if (oldStyle.strokeThickness !== undefined)\n {\n // #if _DEBUG\n deprecation(v8_0_0, 'strokeThickness is now a part of stroke');\n // #endif\n\n const color = oldStyle.stroke;\n let obj: FillStyle = {};\n\n // handles stroke: 0x0, stroke: { r: 0, g: 0, b: 0, a: 0 } stroke: new Color(0x0)\n if (Color.isColorLike(color as ColorSource))\n {\n obj.color = color as ColorSource;\n }\n // handles stroke: new FillGradient()\n else if (color instanceof FillGradient || color instanceof FillPattern)\n {\n obj.fill = color as FillGradient | FillPattern;\n }\n // handles stroke: { color: 0x0 } or stroke: { fill: new FillGradient() }\n else if (Object.hasOwnProperty.call(color, 'color') || Object.hasOwnProperty.call(color, 'fill'))\n {\n obj = color as FillStyle;\n }\n else\n {\n throw new Error('Invalid stroke value.');\n }\n\n style.stroke = {\n ...obj,\n width: oldStyle.strokeThickness\n };\n }\n\n if (Array.isArray(oldStyle.fillGradientStops))\n {\n // #if _DEBUG\n deprecation(v8_0_0, 'gradient fill is now a fill pattern: `new FillGradient(...)`');\n // #endif\n\n let fontSize: number;\n\n // eslint-disable-next-line no-eq-null, eqeqeq\n if (style.fontSize == null)\n {\n style.fontSize = TextStyle.defaultTextStyle.fontSize;\n }\n else if (typeof style.fontSize === 'string')\n {\n // eg '34px' to number\n fontSize = parseInt(style.fontSize as string, 10);\n }\n else\n {\n fontSize = style.fontSize as number;\n }\n\n const gradientFill = new FillGradient({\n start: { x: 0, y: 0 },\n end: { x: 0, y: (fontSize || 0) * 1.7 },\n });\n\n const fills: number[] = oldStyle.fillGradientStops\n .map((color: ColorSource) => Color.shared.setValue(color).toNumber());\n\n fills.forEach((number, index) =>\n {\n const ratio = index / (fills.length - 1);\n\n gradientFill.addColorStop(ratio, number);\n });\n\n style.fill = {\n fill: gradientFill\n };\n }\n}\n\n"],"names":[],"mappings":";;;;;;;;;;AA6rBO,MAAM,UAAA,GAAN,MAAM,UAAA,SAAkB,YAG/B,CAAA;AAAA,EAuFI,WAAA,CAAY,KAAmC,GAAA,EAC/C,EAAA;AACI,IAAM,KAAA,EAAA,CAAA;AAEN,IAAA,kBAAA,CAAmB,KAAK,CAAA,CAAA;AAExB,IAAA,MAAM,YAAY,EAAE,GAAG,UAAU,CAAA,gBAAA,EAAkB,GAAG,KAAM,EAAA,CAAA;AAE5D,IAAA,KAAA,MAAW,OAAO,SAClB,EAAA;AACI,MAAA,MAAM,OAAU,GAAA,GAAA,CAAA;AAEhB,MAAK,IAAA,CAAA,OAAO,CAAI,GAAA,SAAA,CAAU,GAA6B,CAAA,CAAA;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