mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Avoid to have the text layer mismatching the rendered text with mismatching locales (bug 1869001)
The system locale (used in OffscreenCanvas) can be different from the one guessed by Fluent, consequently, in order to avoid any mismatch, we just use an attached canvas element. The original issue can easily be reproduced locally in adding a lang="ja" in viewer.html (or with an other language for Japanese users).
This commit is contained in:
parent
7873ad98bb
commit
f84f48b5d0
7 changed files with 42 additions and 46 deletions
|
@ -28,8 +28,6 @@ import { removeNullCharacters } from "./ui_utils.js";
|
|||
* @property {TextHighlighter} highlighter - Optional object that will handle
|
||||
* highlighting text from the find controller.
|
||||
* @property {TextAccessibilityManager} [accessibilityManager]
|
||||
* @property {boolean} [isOffscreenCanvasSupported] - Allows to use an
|
||||
* OffscreenCanvas if needed.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -49,7 +47,6 @@ class TextLayerBuilder {
|
|||
constructor({
|
||||
highlighter = null,
|
||||
accessibilityManager = null,
|
||||
isOffscreenCanvasSupported = true,
|
||||
enablePermissions = false,
|
||||
}) {
|
||||
this.textContentItemsStr = [];
|
||||
|
@ -59,7 +56,6 @@ class TextLayerBuilder {
|
|||
this.textLayerRenderTask = null;
|
||||
this.highlighter = highlighter;
|
||||
this.accessibilityManager = accessibilityManager;
|
||||
this.isOffscreenCanvasSupported = isOffscreenCanvasSupported;
|
||||
this.#enablePermissions = enablePermissions === true;
|
||||
|
||||
/**
|
||||
|
@ -107,7 +103,6 @@ class TextLayerBuilder {
|
|||
viewport,
|
||||
textDivs: this.textDivs,
|
||||
textDivProperties: this.textDivProperties,
|
||||
isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,
|
||||
mustRescale,
|
||||
mustRotate,
|
||||
});
|
||||
|
@ -129,7 +124,6 @@ class TextLayerBuilder {
|
|||
textDivs: this.textDivs,
|
||||
textDivProperties: this.textDivProperties,
|
||||
textContentItemsStr: this.textContentItemsStr,
|
||||
isOffscreenCanvasSupported: this.isOffscreenCanvasSupported,
|
||||
});
|
||||
|
||||
await this.textLayerRenderTask.promise;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue