From c17e1001eb4d82389217ac184f0ca4a297edc16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Tue, 20 Aug 2024 20:38:23 -0700 Subject: [PATCH] Removed workaround for bidirectional isolation in GL JS --- src/constants/label.js | 15 ++------------- test/spec/label.js | 16 ++++++---------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/constants/label.js b/src/constants/label.js index a93f5c5e7..ec0f33e72 100644 --- a/src/constants/label.js +++ b/src/constants/label.js @@ -471,25 +471,14 @@ export const localizedNameWithLocalGloss = [ "format", ["var", "localizedNameList"], "\n", - "(\u200B", + "(\u2068", { "font-scale": 0.8 }, - // GL JS lacks support for bidirectional isolating characters, so use a - // character from the localized name to insulate the parentheses from the - // embedded text's writing direction. Make it so small that GL JS doesn't - // bother rendering it. - ["concat", ["slice", ["var", "localizedName"], 0, 1], " "], - { "font-scale": 0.001 }, listValuesExpression(["get", "name"], inlineSeparator, [ "var", "localizedName", ]), { "font-scale": 0.8 }, - ["concat", " ", ["slice", ["var", "localizedName"], 0, 1]], - { "font-scale": 0.001 }, - // A ZWSP prevents GL JS from combining this component with the preceding - // one, which would cause it to vanish along with the faux isolating - // character. - "\u200B)", + "\u2069)", { "font-scale": 0.8 }, ], ], diff --git a/test/spec/label.js b/test/spec/label.js index 5dd7046fb..a4329cb05 100644 --- a/test/spec/label.js +++ b/test/spec/label.js @@ -292,7 +292,7 @@ describe("label", function () { if (typeof evaluated === "string") { return [evaluated]; } - return [evaluated.sections[0].text, evaluated.sections[4]?.text]; + return [evaluated.sections[0].text, evaluated.sections[3]?.text]; }; let expectGloss = ( @@ -336,18 +336,14 @@ describe("label", function () { name: "Insula Nullius", }); - expect(evaluated.sections.length).to.be.eql(7); + expect(evaluated.sections.length).to.be.eql(5); expect(evaluated.sections[0].text).to.be.eql("Null Island"); expect(evaluated.sections[1].text).to.be.eql("\n"); - expect(evaluated.sections[2].text).to.be.eql("(\u200B"); - expect(evaluated.sections[3].text).to.be.eql("Null Island"[0] + " "); - expect(evaluated.sections[4].text).to.be.eql("Insula Nullius"); - expect(evaluated.sections[5].text).to.be.eql(" " + "Null Island"[0]); - expect(evaluated.sections[6].text).to.be.eql("\u200B)"); + expect(evaluated.sections[2].text).to.be.eql("(\u2068"); + expect(evaluated.sections[3].text).to.be.eql("Insula Nullius"); + expect(evaluated.sections[4].text).to.be.eql("\u2069)"); - expect(evaluated.sections[3].scale).to.be.below(0.1); - expect(evaluated.sections[4].scale).to.be.below(1); - expect(evaluated.sections[5].scale).to.be.below(0.1); + expect(evaluated.sections[3].scale).to.be.below(1); }); it("deduplicates matching anglicized and local names", function () { expectGloss("en", "Null Island", "Null Island", "Null Island");