diff --git a/src/core/CoreTextNode.ts b/src/core/CoreTextNode.ts index 403bc615..bc078937 100644 --- a/src/core/CoreTextNode.ts +++ b/src/core/CoreTextNode.ts @@ -39,6 +39,7 @@ import type { import type { RectWithValid } from './lib/utils.js'; import type { CoreRenderer } from './renderers/CoreRenderer.js'; import type { TextureLoadedEventHandler } from './textures/Texture.js'; +import { Matrix3d } from './lib/Matrix3d.js'; export interface CoreTextNodeProps extends CoreNodeProps, TrProps { /** * Force Text Node to use a specific Text Renderer @@ -100,8 +101,6 @@ export class CoreTextNode extends CoreNode implements CoreTextNodeProps { dimensions, } satisfies NodeTextureLoadedPayload); } - this.w = this._renderInfo.width; - this.h = this._renderInfo.height; this.setUpdateType(UpdateType.IsRenderable); }; @@ -116,6 +115,52 @@ export class CoreTextNode extends CoreNode implements CoreTextNodeProps { return false; } + override updateLocalTransform() { + const p = this.props; + let { x, y, w, h } = p; + const mountTranslateX = p.mountX * w; + const mountTranslateY = p.mountY * h; + + const tProps = this.textProps; + const { textAlign, verticalAlign, maxWidth, maxHeight } = tProps; + + if (textAlign !== 'left' && maxWidth > 0) { + if (textAlign === 'right') { + x += maxWidth - w; + } else if (textAlign === 'center') { + x += (maxWidth - w) * 0.5; + } + } + + if (verticalAlign !== 'top' && maxHeight > 0) { + if (verticalAlign === 'bottom') { + y += maxHeight - h; + } else if (verticalAlign === 'middle') { + y += (maxHeight - h) * 0.5; + } + } + + if (p.rotation !== 0 || p.scaleX !== 1 || p.scaleY !== 1) { + const scaleRotate = Matrix3d.rotate(p.rotation).scale(p.scaleX, p.scaleY); + const pivotTranslateX = p.pivotX * w; + const pivotTranslateY = p.pivotY * h; + + this.localTransform = Matrix3d.translate( + x - mountTranslateX + pivotTranslateX, + y - mountTranslateY + pivotTranslateY, + this.localTransform, + ) + .multiply(scaleRotate) + .translate(-pivotTranslateX, -pivotTranslateY); + } else { + this.localTransform = Matrix3d.translate( + x - mountTranslateX, + y - mountTranslateY, + this.localTransform, + ); + } + } + /** * Override CoreNode's update method to handle text-specific updates */ @@ -192,12 +237,13 @@ export class CoreTextNode extends CoreNode implements CoreTextNodeProps { } } + this._cachedLayout = result.layout || null; + this.props.w = width; + this.props.h = height; + // Handle SDF renderer (uses layout caching) if (textRendererType === 'sdf') { - this._cachedLayout = result.layout || null; this.setRenderable(true); - this.props.w = width; - this.props.h = height; this.setUpdateType(UpdateType.Local); } diff --git a/src/core/text-rendering/CanvasTextRenderer.ts b/src/core/text-rendering/CanvasTextRenderer.ts index 2f1d9d3d..2ca72ca3 100644 --- a/src/core/text-rendering/CanvasTextRenderer.ts +++ b/src/core/text-rendering/CanvasTextRenderer.ts @@ -146,8 +146,8 @@ const renderText = (props: CoreTextNodeProps): TextRenderInfo => { ); const lineAmount = lines.length; - const canvasW = Math.ceil(maxWidth || effectiveWidth); - const canvasH = Math.ceil(maxHeight || effectiveHeight); + const canvasW = Math.ceil(effectiveWidth); + const canvasH = Math.ceil(effectiveHeight); canvas.width = canvasW; canvas.height = canvasH; @@ -193,8 +193,8 @@ const renderText = (props: CoreTextNodeProps): TextRenderInfo => { } return { imageData, - width: canvasW, - height: canvasH, + width: effectiveWidth, + height: effectiveHeight, remainingLines, hasRemainingText, }; diff --git a/src/core/text-rendering/SdfTextRenderer.ts b/src/core/text-rendering/SdfTextRenderer.ts index fcb86805..e1b5aba7 100644 --- a/src/core/text-rendering/SdfTextRenderer.ts +++ b/src/core/text-rendering/SdfTextRenderer.ts @@ -389,8 +389,8 @@ const generateTextLayout = ( return { glyphs, distanceRange: fontScale * fontData.distanceField.distanceRange, - width: maxWidth || effectiveWidth * fontScale, - height: maxHeight || effectiveHeight, + width: effectiveWidth * fontScale, + height: effectiveHeight, fontScale: fontScale, lineHeight: lineHeightPx, fontFamily, diff --git a/src/core/text-rendering/TextLayoutEngine.ts b/src/core/text-rendering/TextLayoutEngine.ts index decb459c..905687ce 100644 --- a/src/core/text-rendering/TextLayoutEngine.ts +++ b/src/core/text-rendering/TextLayoutEngine.ts @@ -92,24 +92,19 @@ export const mapTextLayout = ( //update line x offsets if (textAlign !== 'left') { - const maxW = wrappedText === true ? maxWidth : effectiveMaxWidth; for (let i = 0; i < effectiveLineAmount; i++) { const line = lines[i]!; const w = line[1]; - line[2] = textAlign === 'right' ? maxW - w : (maxW - w) / 2; + line[2] = + textAlign === 'right' + ? effectiveMaxWidth - w + : (effectiveMaxWidth - w) / 2; } } const effectiveMaxHeight = effectiveLineAmount * lineHeightPx; let firstBaseLine = halfDelta; - if (maxHeight > 0 && verticalAlign !== 'top') { - if (verticalAlign === 'middle') { - firstBaseLine += (maxHeight - effectiveMaxHeight) / 2; - } else { - firstBaseLine += maxHeight - effectiveMaxHeight; - } - } const startY = firstBaseLine; for (let i = 0; i < effectiveLineAmount; i++) { @@ -350,8 +345,8 @@ export const wrapLine = ( hasRemainingText = rt; if (linebreak === false) { const [text, width] = lines[0]!; - currentLine += ' ' + text; - currentLineWidth = width; + currentLine += text; + currentLineWidth += width; wrappedLines.push([currentLine, currentLineWidth, 0, 0]); } @@ -361,6 +356,11 @@ export const wrapLine = ( wrappedLines.push([currentLine, currentLineWidth, 0, 0]); } } + + if (i < words.length - 1 && currentLine.endsWith(' ') === false) { + currentLine += ' '; + currentLineWidth += effectiveSpaceWidth; + } } } } diff --git a/visual-regression/certified-snapshots/chromium-ci/clipping-2.png b/visual-regression/certified-snapshots/chromium-ci/clipping-2.png index 6c3dcb2f..344cb1d9 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/clipping-2.png and b/visual-regression/certified-snapshots/chromium-ci/clipping-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/clipping-3.png b/visual-regression/certified-snapshots/chromium-ci/clipping-3.png index c20958a7..b7710f5d 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/clipping-3.png and b/visual-regression/certified-snapshots/chromium-ci/clipping-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/destroy-1.png b/visual-regression/certified-snapshots/chromium-ci/destroy-1.png index df416966..83629276 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/destroy-1.png and b/visual-regression/certified-snapshots/chromium-ci/destroy-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/quads-rendered-1.png b/visual-regression/certified-snapshots/chromium-ci/quads-rendered-1.png index f9fcccfe..8ac55bf6 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/quads-rendered-1.png and b/visual-regression/certified-snapshots/chromium-ci/quads-rendered-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/quads-rendered-2.png b/visual-regression/certified-snapshots/chromium-ci/quads-rendered-2.png index 09a97545..1b3ce2ca 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/quads-rendered-2.png and b/visual-regression/certified-snapshots/chromium-ci/quads-rendered-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/rtt-spritemap-1.png b/visual-regression/certified-snapshots/chromium-ci/rtt-spritemap-1.png index a94e07a1..d4f8fe90 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/rtt-spritemap-1.png and b/visual-regression/certified-snapshots/chromium-ci/rtt-spritemap-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/scaling-1.png b/visual-regression/certified-snapshots/chromium-ci/scaling-1.png index 6fc1fe98..2d682170 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/scaling-1.png and b/visual-regression/certified-snapshots/chromium-ci/scaling-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/scaling-2.png b/visual-regression/certified-snapshots/chromium-ci/scaling-2.png index 7967a63b..ab68f047 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/scaling-2.png and b/visual-regression/certified-snapshots/chromium-ci/scaling-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/scaling-3.png b/visual-regression/certified-snapshots/chromium-ci/scaling-3.png index 34b30534..f9bfa459 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/scaling-3.png and b/visual-regression/certified-snapshots/chromium-ci/scaling-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-align-1.png b/visual-regression/certified-snapshots/chromium-ci/text-align-1.png index 572aaca4..0ee7149d 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-align-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-align-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-align-2.png b/visual-regression/certified-snapshots/chromium-ci/text-align-2.png index 76a8b30f..945aefee 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-align-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-align-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-align-3.png b/visual-regression/certified-snapshots/chromium-ci/text-align-3.png index 4bd988d2..ded2025d 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-align-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-align-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-align-4.png b/visual-regression/certified-snapshots/chromium-ci/text-align-4.png index 07c76c00..cddac262 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-align-4.png and b/visual-regression/certified-snapshots/chromium-ci/text-align-4.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-align-5.png b/visual-regression/certified-snapshots/chromium-ci/text-align-5.png index 87ea281f..a0bf09f5 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-align-5.png and b/visual-regression/certified-snapshots/chromium-ci/text-align-5.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-align-6.png b/visual-regression/certified-snapshots/chromium-ci/text-align-6.png index 694dc050..13edaa95 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-align-6.png and b/visual-regression/certified-snapshots/chromium-ci/text-align-6.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-alpha-1.png b/visual-regression/certified-snapshots/chromium-ci/text-alpha-1.png index 975709c2..1acdc8da 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-alpha-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-alpha-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-alpha-2.png b/visual-regression/certified-snapshots/chromium-ci/text-alpha-2.png index 8f0a8a40..541ca3a1 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-alpha-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-alpha-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-1.png b/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-1.png index f0925955..c308b8b3 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-2.png b/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-2.png index 2bda4ca5..910ec929 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-canvas-font-no-metrics-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-10.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-10.png index da90f8e0..8ade225d 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-10.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-10.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-2.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-2.png index 981feff7..04526409 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-3.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-3.png index 869ccf5f..35be71e4 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-4.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-4.png index 6d65b8d1..9562944f 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-4.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-4.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-5.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-5.png index adcac9c1..5e761649 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-5.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-5.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-6.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-6.png index 24dc3999..a18a03ef 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-6.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-6.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-7.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-7.png index acafac27..c068e0ae 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-7.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-7.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-8.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-8.png index 64bec6c1..21775b06 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-8.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-8.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-contain-9.png b/visual-regression/certified-snapshots/chromium-ci/text-contain-9.png index e1931754..1276d88e 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-contain-9.png and b/visual-regression/certified-snapshots/chromium-ci/text-contain-9.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-1.png b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-1.png index 84313ccc..3ea1a544 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-2.png b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-2.png index 9b676e03..96ea884c 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-3.png b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-3.png index 5f08e154..dfac3018 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-1.png b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-1.png index 572aaca4..0ee7149d 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-2.png b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-2.png index 2a615f87..86cb58e9 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-3.png b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-3.png index 5669237e..51b553f7 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-layout-consistency-modified-metrics-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-line-height-1.png b/visual-regression/certified-snapshots/chromium-ci/text-line-height-1.png index 82e5acaa..6aa9ffac 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-line-height-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-line-height-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-max-lines-1.png b/visual-regression/certified-snapshots/chromium-ci/text-max-lines-1.png index ddb5d5a1..cc3ffea5 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-max-lines-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-max-lines-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-max-lines-2.png b/visual-regression/certified-snapshots/chromium-ci/text-max-lines-2.png index 340661c0..93c56f52 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-max-lines-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-max-lines-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-mixed-1.png b/visual-regression/certified-snapshots/chromium-ci/text-mixed-1.png index b167a0e4..7beac7c5 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-mixed-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-mixed-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-2.png b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-2.png index 1dc4568a..ea28540c 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-3.png b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-3.png index 9a5922a8..1eada3c7 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-4.png b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-4.png index 01f432d5..c5b5c289 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-4.png and b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-4.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-5.png b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-5.png index 23d6a56e..2e1788b5 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-5.png and b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-5.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-6.png b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-6.png index 86e8267a..70177a9c 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-6.png and b/visual-regression/certified-snapshots/chromium-ci/text-offscreen-move-6.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-overflow-suffix-1.png b/visual-regression/certified-snapshots/chromium-ci/text-overflow-suffix-1.png index 0e8a5238..1441e63f 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-overflow-suffix-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-overflow-suffix-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-rotation-1.png b/visual-regression/certified-snapshots/chromium-ci/text-rotation-1.png index d0054e1a..36da9c64 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-rotation-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-rotation-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-rotation-2.png b/visual-regression/certified-snapshots/chromium-ci/text-rotation-2.png index 727e6504..f370e53d 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-rotation-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-rotation-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-scaling-1.png b/visual-regression/certified-snapshots/chromium-ci/text-scaling-1.png index a436e6e1..cf304bb0 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-scaling-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-scaling-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-scaling-2.png b/visual-regression/certified-snapshots/chromium-ci/text-scaling-2.png index c03f047d..69addce9 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-scaling-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-scaling-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-scaling-3.png b/visual-regression/certified-snapshots/chromium-ci/text-scaling-3.png index 076740a1..63dcae33 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-scaling-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-scaling-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-scaling-4.png b/visual-regression/certified-snapshots/chromium-ci/text-scaling-4.png index 7359cd0c..27a5e50c 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-scaling-4.png and b/visual-regression/certified-snapshots/chromium-ci/text-scaling-4.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-scaling-5.png b/visual-regression/certified-snapshots/chromium-ci/text-scaling-5.png index ee44d73d..6e9b644d 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-scaling-5.png and b/visual-regression/certified-snapshots/chromium-ci/text-scaling-5.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-scaling-6.png b/visual-regression/certified-snapshots/chromium-ci/text-scaling-6.png index a6920fd5..a6553328 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-scaling-6.png and b/visual-regression/certified-snapshots/chromium-ci/text-scaling-6.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-1.png b/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-1.png index 62dc69a9..7f70d5d6 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-2.png b/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-2.png index b0035a0b..498c99e5 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-vertical-align-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-1.png b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-1.png index 4273a355..276ea6cc 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-2.png b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-2.png index b262580f..80aae731 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-3.png b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-3.png index d81c7530..12fffe88 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-4.png b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-4.png index 45cfd456..02c939df 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-4.png and b/visual-regression/certified-snapshots/chromium-ci/text-wordbreak-4.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-zwsp-1.png b/visual-regression/certified-snapshots/chromium-ci/text-zwsp-1.png index 2a42093a..c1bb0265 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-zwsp-1.png and b/visual-regression/certified-snapshots/chromium-ci/text-zwsp-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-zwsp-2.png b/visual-regression/certified-snapshots/chromium-ci/text-zwsp-2.png index 273276e1..223b4a5f 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-zwsp-2.png and b/visual-regression/certified-snapshots/chromium-ci/text-zwsp-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/text-zwsp-3.png b/visual-regression/certified-snapshots/chromium-ci/text-zwsp-3.png index ef898358..1d9614e7 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/text-zwsp-3.png and b/visual-regression/certified-snapshots/chromium-ci/text-zwsp-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/texture-factory-1.png b/visual-regression/certified-snapshots/chromium-ci/texture-factory-1.png index 2daf8b67..87cf767f 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/texture-factory-1.png and b/visual-regression/certified-snapshots/chromium-ci/texture-factory-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/texture-spritemap-1.png b/visual-regression/certified-snapshots/chromium-ci/texture-spritemap-1.png index 5c2837b6..f25c2507 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/texture-spritemap-1.png and b/visual-regression/certified-snapshots/chromium-ci/texture-spritemap-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-1.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-1.png index b2cfc6ba..7e233ebc 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-1.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-10.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-10.png index 99711796..c92ca4f7 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-10.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-10.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-11.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-11.png index 80598551..90532f6f 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-11.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-11.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-12.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-12.png index 80598551..90532f6f 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-12.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-12.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-13.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-13.png index a8b9c53b..beb2fa58 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-13.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-13.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-14.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-14.png index 15dd35a2..47236419 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-14.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-14.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-15.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-15.png index aac9b7a2..d02beaf4 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-15.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-15.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-16.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-16.png index 326e14b8..365f2552 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-16.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-16.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-17.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-17.png index 2444ba6a..79093104 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-17.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-17.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-18.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-18.png index f39d26e4..efa8b8f1 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-18.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-18.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-2.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-2.png index 93a25eb0..b22fb1ba 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-2.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-3.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-3.png index 4c27f152..da878e02 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-3.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-3.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-4.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-4.png index 7bfd9427..9ef237ba 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-4.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-4.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-5.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-5.png index c80e030f..fc82a9dd 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-5.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-5.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-6.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-6.png index 965f6041..c345c3f5 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-6.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-6.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-7.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-7.png index ed5df182..960d5799 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-7.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-7.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-8.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-8.png index c700932f..ec905751 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-8.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-8.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-events-9.png b/visual-regression/certified-snapshots/chromium-ci/viewport-events-9.png index 15dd35a2..47236419 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-events-9.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-events-9.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-1.png b/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-1.png index ad18c83d..ce1fb7a3 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-1.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-1.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-2.png b/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-2.png index 3899df71..c870ff1b 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-2.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-2.png differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-3.png b/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-3.png index f10d8e91..ef4bf6e9 100644 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-3.png and b/visual-regression/certified-snapshots/chromium-ci/viewport-largebound-3.png differ diff --git a/visual-regression/src/index.ts b/visual-regression/src/index.ts index 2b63a203..94e364c7 100644 --- a/visual-regression/src/index.ts +++ b/visual-regression/src/index.ts @@ -272,7 +272,14 @@ async function runTest(browserType: 'chromium') { } // Launch browser and create page - const browser = await browsers[browserType].launch(); + const browser = await browsers[browserType].launch({ + args: [ + '--disable-font-subpixel-positioning', + '--disable-lcd-text', + '--font-render-hinting=none', + '--force-device-scale-factor=1', + ], + }); const page = await browser.newPage();