1 line
26 KiB
Plaintext
1 line
26 KiB
Plaintext
{"version":3,"file":"CanvasTextSystem.mjs","sources":["../../../../src/scene/text/canvas/CanvasTextSystem.ts"],"sourcesContent":["import { Color } from '../../../color/Color';\nimport { ExtensionType } from '../../../extensions/Extensions';\nimport { nextPow2 } from '../../../maths/misc/pow2';\nimport { CanvasPool } from '../../../rendering/renderers/shared/texture/CanvasPool';\nimport { TexturePool } from '../../../rendering/renderers/shared/texture/TexturePool';\nimport { getCanvasBoundingBox } from '../../../utils/canvas/getCanvasBoundingBox';\nimport { deprecation } from '../../../utils/logging/deprecation';\nimport { TextStyle } from '../TextStyle';\nimport { getPo2TextureFromSource } from '../utils/getPo2TextureFromSource';\nimport { CanvasTextMetrics } from './CanvasTextMetrics';\nimport { fontStringFromTextStyle } from './utils/fontStringFromTextStyle';\nimport { getCanvasFillStyle } from './utils/getCanvasFillStyle';\n\nimport type { ICanvas } from '../../../environment/canvas/ICanvas';\nimport type { ICanvasRenderingContext2D } from '../../../environment/canvas/ICanvasRenderingContext2D';\nimport type { System } from '../../../rendering/renderers/shared/system/System';\nimport type { Texture } from '../../../rendering/renderers/shared/texture/Texture';\nimport type { Renderer } from '../../../rendering/renderers/types';\nimport type { TextOptions } from '../AbstractText';\nimport type { Text } from '../Text';\n\ninterface CanvasAndContext\n{\n canvas: ICanvas;\n context: ICanvasRenderingContext2D;\n}\n\n/**\n * System plugin to the renderer to manage canvas text.\n * @memberof rendering\n */\nexport class CanvasTextSystem implements System\n{\n /** @ignore */\n public static extension = {\n type: [\n ExtensionType.WebGLSystem,\n ExtensionType.WebGPUSystem,\n ExtensionType.CanvasSystem,\n ],\n name: 'canvasText',\n } as const;\n\n private _activeTextures: Record<string, {\n canvasAndContext: CanvasAndContext,\n texture: Texture,\n usageCount: number,\n }> = {};\n\n private readonly _renderer: Renderer;\n\n constructor(_renderer: Renderer)\n {\n this._renderer = _renderer;\n }\n\n public getTextureSize(text: string, resolution: number, style: TextStyle): { width: number, height: number }\n {\n const measured = CanvasTextMetrics.measureText(text || ' ', style);\n\n let width = Math.ceil(Math.ceil((Math.max(1, measured.width) + (style.padding * 2))) * resolution);\n let height = Math.ceil(Math.ceil((Math.max(1, measured.height) + (style.padding * 2))) * resolution);\n\n width = Math.ceil((width) - 1e-6);\n height = Math.ceil((height) - 1e-6);\n width = nextPow2(width);\n height = nextPow2(height);\n\n return { width, height };\n }\n\n /**\n * This is a function that will create a texture from a text string, style and resolution.\n * Useful if you want to make a texture of your text and use if for various other pixi things!\n * @param options - The options of the text that will be used to generate the texture.\n * @param options.text - the text to render\n * @param options.style - the style of the text\n * @param options.resolution - the resolution of the texture\n * @returns the newly created texture\n */\n /** @deprecated since 8.0.0 */\n public getTexture(text: string, resolution: number, style: TextStyle, textKey: string): Texture;\n public getTexture(options: TextOptions): Texture;\n public getTexture(options: TextOptions | string, resolution?: number, style?: TextStyle, _textKey?: string): Texture\n {\n if (typeof options === 'string')\n {\n deprecation('8.0.0', 'CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments');\n\n options = {\n text: options,\n style,\n resolution,\n };\n }\n\n if (!(options.style instanceof TextStyle))\n {\n options.style = new TextStyle(options.style);\n }\n\n const { texture, canvasAndContext } = this.createTextureAndCanvas(\n options as {text: string, style: TextStyle, resolution?: number}\n );\n\n this._renderer.texture.initSource(texture._source);\n\n CanvasPool.returnCanvasAndContext(canvasAndContext);\n\n return texture;\n }\n\n public createTextureAndCanvas(options: {text: string, style: TextStyle, resolution?: number})\n {\n const { text, style } = options;\n\n const resolution = options.resolution ?? this._renderer.resolution;\n\n // create a canvas with the word hello on it\n const measured = CanvasTextMetrics.measureText(text || ' ', style);\n\n const width = Math.ceil(Math.ceil((Math.max(1, measured.width) + (style.padding * 2))) * resolution);\n const height = Math.ceil(Math.ceil((Math.max(1, measured.height) + (style.padding * 2))) * resolution);\n\n const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(width, height);\n\n // create a texture from the canvas\n const { canvas } = canvasAndContext;\n\n this.renderTextToCanvas(text, style, resolution, canvasAndContext);\n\n const texture = getPo2TextureFromSource(canvas, width, height, resolution);\n\n if (style.trim)\n {\n const trimmed = getCanvasBoundingBox(canvas, resolution);\n\n texture.frame.copyFrom(trimmed);\n\n texture.updateUvs();\n }\n\n return { texture, canvasAndContext };\n }\n\n public getManagedTexture(text: Text)\n {\n text._resolution = text._autoResolution ? this._renderer.resolution : text.resolution;\n const textKey = text._getKey();\n\n if (this._activeTextures[textKey])\n {\n this._increaseReferenceCount(textKey);\n\n return this._activeTextures[textKey].texture;\n }\n\n const { texture, canvasAndContext } = this.createTextureAndCanvas(text);\n\n this._activeTextures[textKey] = {\n canvasAndContext,\n texture,\n usageCount: 1,\n };\n\n return texture;\n }\n\n private _increaseReferenceCount(textKey: string)\n {\n this._activeTextures[textKey].usageCount++;\n }\n\n public decreaseReferenceCount(textKey: string)\n {\n const activeTexture = this._activeTextures[textKey];\n\n activeTexture.usageCount--;\n\n if (activeTexture.usageCount === 0)\n {\n CanvasPool.returnCanvasAndContext(activeTexture.canvasAndContext);\n TexturePool.returnTexture(activeTexture.texture);\n\n const source = activeTexture.texture.source;\n\n source.resource = null;\n source.uploadMethodId = 'unknown';\n source.alphaMode = 'no-premultiply-alpha';\n\n this._activeTextures[textKey] = null;\n }\n }\n\n public getReferenceCount(textKey: string)\n {\n return this._activeTextures[textKey].usageCount;\n }\n\n /**\n * Renders text to its canvas, and updates its texture.\n *\n * By default this is used internally to ensure the texture is correct before rendering,\n * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,\n * and then shared across multiple Sprites.\n * @param text\n * @param style\n * @param resolution\n * @param canvasAndContext\n */\n public renderTextToCanvas(text: string, style: TextStyle, resolution: number, canvasAndContext: CanvasAndContext): void\n {\n const { canvas, context } = canvasAndContext;\n\n const font = fontStringFromTextStyle(style);\n\n const measured = CanvasTextMetrics.measureText(text || ' ', style);// , canvas);\n const lines = measured.lines;\n const lineHeight = measured.lineHeight;\n const lineWidths = measured.lineWidths;\n const maxLineWidth = measured.maxLineWidth;\n const fontProperties = measured.fontProperties;\n\n const height = canvas.height;\n\n context.resetTransform();\n\n context.scale(resolution, resolution);\n\n const padding = style.padding * 2;\n\n context.clearRect(0, 0, measured.width + 4 + padding, measured.height + 4 + padding);\n\n // set stroke styles..\n\n if (style._stroke?.width)\n {\n const strokeStyle = style._stroke;\n\n context.lineWidth = strokeStyle.width;\n\n context.miterLimit = strokeStyle.miterLimit;\n context.lineJoin = strokeStyle.join;\n context.lineCap = strokeStyle.cap;\n }\n\n // return;\n context.font = font;\n\n let linePositionX: number;\n let linePositionY: number;\n\n // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text\n const passesCount = style.dropShadow ? 2 : 1;\n\n // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex,\n // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow.\n //\n // For v5.0.0, we moved over to just use the canvas API for drop shadows, which made them look much nicer and more\n // visually please, but now because the stroke is drawn and then the fill, drop shadows would appear on both the fill\n // and the stroke; and fill drop shadows would appear over the top of the stroke.\n //\n // For v5.1.1, the new route is to revert to v4 style of drawing text first to get the drop shadows underneath normal\n // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the\n // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow\n // beneath the text, whilst also having the proper text shadow styling.\n for (let i = 0; i < passesCount; ++i)\n {\n const isShadowPass = style.dropShadow && i === 0;\n // we only want the drop shadow, so put text way off-screen\n const dsOffsetText = isShadowPass ? Math.ceil(Math.max(1, height) + (style.padding * 2)) : 0;\n const dsOffsetShadow = dsOffsetText * resolution;\n\n if (isShadowPass)\n {\n // On Safari, text with gradient and drop shadows together do not position correctly\n // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689\n // Therefore we'll set the styles to be a plain black whilst generating this drop shadow\n context.fillStyle = 'black';\n context.strokeStyle = 'black';\n\n const shadowOptions = style.dropShadow;\n\n const dropShadowColor = shadowOptions.color;\n const dropShadowAlpha = shadowOptions.alpha;\n\n context.shadowColor = Color.shared\n .setValue(dropShadowColor)\n .setAlpha(dropShadowAlpha)\n .toRgbaString();\n\n const dropShadowBlur = shadowOptions.blur * resolution;\n const dropShadowDistance = shadowOptions.distance * resolution;\n\n context.shadowBlur = dropShadowBlur;\n context.shadowOffsetX = Math.cos(shadowOptions.angle) * dropShadowDistance;\n context.shadowOffsetY = (Math.sin(shadowOptions.angle) * dropShadowDistance) + dsOffsetShadow;\n }\n else\n {\n context.globalAlpha = style._fill?.alpha ?? 1;\n context.fillStyle = style._fill ? getCanvasFillStyle(style._fill, context) : null;\n\n if (style._stroke?.width)\n {\n context.strokeStyle = getCanvasFillStyle(style._stroke, context);\n }\n\n context.shadowColor = 'black';\n }\n\n let linePositionYShift = (lineHeight - fontProperties.fontSize) / 2;\n\n if (lineHeight - fontProperties.fontSize < 0)\n {\n linePositionYShift = 0;\n }\n\n const strokeWidth = style._stroke?.width ?? 0;\n\n // draw lines line by line\n for (let i = 0; i < lines.length; i++)\n {\n linePositionX = strokeWidth / 2;\n linePositionY = ((strokeWidth / 2) + (i * lineHeight)) + fontProperties.ascent + linePositionYShift;\n\n if (style.align === 'right')\n {\n linePositionX += maxLineWidth - lineWidths[i];\n }\n else if (style.align === 'center')\n {\n linePositionX += (maxLineWidth - lineWidths[i]) / 2;\n }\n\n if (style._stroke?.width)\n {\n this._drawLetterSpacing(\n lines[i],\n style,\n canvasAndContext,\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText,\n true\n );\n }\n\n if (style._fill !== undefined)\n {\n this._drawLetterSpacing(\n lines[i],\n style,\n canvasAndContext,\n linePositionX + style.padding,\n linePositionY + style.padding - dsOffsetText\n );\n }\n }\n }\n }\n\n /**\n * Render the text with letter-spacing.\n * @param text - The text to draw\n * @param style\n * @param canvasAndContext\n * @param x - Horizontal position to draw the text\n * @param y - Vertical position to draw the text\n * @param isStroke - Is this drawing for the outside stroke of the\n * text? If not, it's for the inside fill\n */\n private _drawLetterSpacing(\n text: string,\n style: TextStyle,\n canvasAndContext: CanvasAndContext,\n x: number, y: number,\n isStroke = false\n ): void\n {\n const { context } = canvasAndContext;\n\n // letterSpacing of 0 means normal\n const letterSpacing = style.letterSpacing;\n\n let useExperimentalLetterSpacing = false;\n\n if (CanvasTextMetrics.experimentalLetterSpacingSupported)\n {\n if (CanvasTextMetrics.experimentalLetterSpacing)\n {\n context.letterSpacing = `${letterSpacing}px`;\n context.textLetterSpacing = `${letterSpacing}px`;\n useExperimentalLetterSpacing = true;\n }\n else\n {\n context.letterSpacing = '0px';\n context.textLetterSpacing = '0px';\n }\n }\n\n if (letterSpacing === 0 || useExperimentalLetterSpacing)\n {\n if (isStroke)\n {\n context.strokeText(text, x, y);\n }\n else\n {\n context.fillText(text, x, y);\n }\n\n return;\n }\n\n let currentPosition = x;\n\n const stringArray = CanvasTextMetrics.graphemeSegmenter(text);\n let previousWidth = context.measureText(text).width;\n let currentWidth = 0;\n\n for (let i = 0; i < stringArray.length; ++i)\n {\n const currentChar = stringArray[i];\n\n if (isStroke)\n {\n context.strokeText(currentChar, currentPosition, y);\n }\n else\n {\n context.fillText(currentChar, currentPosition, y);\n }\n let textStr = '';\n\n for (let j = i + 1; j < stringArray.length; ++j)\n {\n textStr += stringArray[j];\n }\n currentWidth = context.measureText(textStr).width;\n currentPosition += previousWidth - currentWidth + letterSpacing;\n previousWidth = currentWidth;\n }\n }\n\n public destroy(): void\n {\n this._activeTextures = null;\n }\n}\n"],"names":["i"],"mappings":";;;;;;;;;;;;;;AA+BO,MAAM,gBACb,CAAA;AAAA,EAmBI,YAAY,SACZ,EAAA;AATA,IAAA,IAAA,CAAQ,kBAIH,EAAC,CAAA;AAMF,IAAA,IAAA,CAAK,SAAY,GAAA,SAAA,CAAA;AAAA,GACrB;AAAA,EAEO,cAAA,CAAe,IAAc,EAAA,UAAA,EAAoB,KACxD,EAAA;AACI,IAAA,MAAM,QAAW,GAAA,iBAAA,CAAkB,WAA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