Correctly generate the NormalizeWithNFKC string in generic build

It fixes #20689.
This commit is contained in:
calixteman 2026-02-22 15:22:41 +01:00
parent ad0a310394
commit fb902c16e1
No known key found for this signature in database
GPG Key ID: 0C5442631EE0691F

View File

@ -120,11 +120,21 @@ function getNormalizeWithNFKC() {
(typeof PDFJSDev === "undefined" && FeatureTest.platform.isFirefox) ||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL"))
) {
// The `NormalizeWithNFKC` string is generated with the for loop below.
// Because of a small difference between Chrome and Firefox, the string is
// only hardcoded for Firefox, and Chrome (or others) will generate it at
// runtime.
// In order to detect if the string is up to date, a check is performed in
// the loop below, and if a difference is detected, an error is thrown.
/* eslint-disable no-irregular-whitespace */
NormalizeWithNFKC ||= `\xA0¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´- - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉--№ℙ-ℝ℠-™ℤΩℨK---ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰ꟱-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;
}
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
if (
typeof PDFJSDev === "undefined" ||
PDFJSDev.test("TESTING") ||
(!PDFJSDev.test("MOZCENTRAL") && !NormalizeWithNFKC)
) {
const ranges = [];
const range = [];
const diacriticsRegex = /^\p{M}$/u;