mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
Merge pull request #7048 from penpot/elenatorro-11704-fix-symbols-font
✨ Include symbols support
This commit is contained in:
commit
61d93d69b1
8 changed files with 1939 additions and 20 deletions
BIN
frontend/playwright/data/render-wasm/assets/notomusicsubset.ttf
Normal file
BIN
frontend/playwright/data/render-wasm/assets/notomusicsubset.ttf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
1881
frontend/playwright/data/render-wasm/get-file-text-symbols.json
Normal file
1881
frontend/playwright/data/render-wasm/get-file-text-symbols.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -27,6 +27,21 @@ async function mockGetJapaneseFont(workspace) {
|
|||
);
|
||||
}
|
||||
|
||||
async function mockGetSymbolsFont(workspace) {
|
||||
await workspace.mockGetAsset(
|
||||
/notosanssymbols.*\.ttf$/,
|
||||
"render-wasm/assets/notosanssymbolssubset.ttf"
|
||||
);
|
||||
await workspace.mockGetAsset(
|
||||
/notosanssymbols2.*\.ttf$/,
|
||||
"render-wasm/assets/notosanssymbols2subset.ttf"
|
||||
);
|
||||
await workspace.mockGetAsset(
|
||||
/notomusic.*\.ttf$/,
|
||||
"render-wasm/assets/notomusicsubset.ttf"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
test("Renders a file with texts", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
|
@ -144,6 +159,22 @@ test("Renders a file with texts with images", async ({ page }) => {
|
|||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("Renders a file with texts with emoji and different symbols", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
await mockGetEmojiFont(workspace);
|
||||
await mockGetSymbolsFont(workspace);
|
||||
|
||||
await workspace.mockGetFile("render-wasm/get-file-text-symbols.json");
|
||||
|
||||
await workspace.goToWorkspace({
|
||||
id: "74d31005-5d0c-81fe-8006-949a8226e8c4",
|
||||
pageId: "74d31005-5d0c-81fe-8006-949a8226e8c5",
|
||||
});
|
||||
await workspace.waitForFirstRender();
|
||||
await expect(workspace.canvas).toHaveScreenshot();
|
||||
});
|
||||
|
||||
test("Renders a file with text decoration", async ({ page }) => {
|
||||
const workspace = new WasmWorkspacePage(page);
|
||||
await workspace.setupEmptyFile();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 131 KiB |
|
@ -257,24 +257,27 @@
|
|||
:sinhala {:font-id "gfont-noto-sans-sinhala" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:telugu {:font-id "gfont-noto-sans-telugu" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:tibetan {:font-id "gfont-noto-sans-tibetan" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:javanese {:font-id "noto-sans-javanese" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:kannada {:font-id "noto-sans-kannada" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:oriya {:font-id "noto-sans-oriya" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:mongolian {:font-id "noto-sans-mongolian" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:syriac {:font-id "noto-sans-syriac" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:tifinagh {:font-id "noto-sans-tifinagh" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:coptic {:font-id "noto-sans-coptic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:ol-chiki {:font-id "noto-sans-ol-chiki" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:vai {:font-id "noto-sans-vai" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:shavian {:font-id "noto-sans-shavian" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:osmanya {:font-id "noto-sans-osmanya" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:runic {:font-id "noto-sans-runic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:old-italic {:font-id "noto-sans-old-italic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:brahmi {:font-id "noto-sans-brahmi" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:modi {:font-id "noto-sans-modi" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:sora-sompeng {:font-id "noto-sans-sora-sompeng" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:bamum {:font-id "noto-sans-bamum" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:meroitic {:font-id "noto-sans-meroitic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}})
|
||||
:javanese {:font-id "gfont-noto-sans-javanese" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:kannada {:font-id "gfont-noto-sans-kannada" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:oriya {:font-id "gfont-noto-sans-oriya" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:mongolian {:font-id "gfont-noto-sans-mongolian" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:syriac {:font-id "gfont-noto-sans-syriac" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:tifinagh {:font-id "gfont-noto-sans-tifinagh" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:coptic {:font-id "gfont-noto-sans-coptic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:ol-chiki {:font-id "gfont-noto-sans-ol-chiki" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:vai {:font-id "gfont-noto-sans-vai" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:shavian {:font-id "gfont-noto-sans-shavian" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:osmanya {:font-id "gfont-noto-sans-osmanya" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:runic {:font-id "gfont-noto-sans-runic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:old-italic {:font-id "gfont-noto-sans-old-italic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:brahmi {:font-id "gfont-noto-sans-brahmi" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:modi {:font-id "gfont-noto-sans-modi" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:sora-sompeng {:font-id "gfont-noto-sans-sora-sompeng" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:bamum {:font-id "gfont-noto-sans-bamum" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:meroitic {:font-id "gfont-noto-sans-meroitic" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:symbols {:font-id "gfont-noto-sans-symbols" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:symbols-2 {:font-id "gfont-noto-sans-symbols-2" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}
|
||||
:music {:font-id "gfont-noto-music" :font-variant-id "regular" :style 0 :weight 400 :is-fallback true}})
|
||||
|
||||
|
||||
(defn add-noto-fonts [fonts languages]
|
||||
|
|
|
@ -189,8 +189,12 @@
|
|||
:modi #"[\u11600-\u1165F]"
|
||||
:sora-sompeng #"[\u110D0-\u110FF]"
|
||||
:bamum #"[\uA6A0-\uA6FF]"
|
||||
:meroitic #"[\u10980-\u1099F]"})
|
||||
|
||||
:meroitic #"[\u10980-\u1099F]"
|
||||
;; Arrows, Mathematical Operators, Misc Technical, Geometric Shapes, Misc Symbols, Dingbats, Supplemental Arrows, etc.
|
||||
:symbols #"[\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]"
|
||||
;; Additional arrows, math, technical, geometric, and symbol blocks
|
||||
:symbols-2 #"[\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\u2B00-\u2BFF]"
|
||||
:music #"[\u2669-\u267B\u1D100-\u1D1FF]"})
|
||||
|
||||
(defn contains-emoji? [text]
|
||||
(boolean (some #(re-find emoji-pattern %) (seq text))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue