Use emoji sheet with fallback

This commit is contained in:
Fedor Indutny
2025-10-29 12:39:47 -07:00
committed by GitHub
parent 06448ea80e
commit 1f7ea7d088
5 changed files with 12 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

View File

@@ -102,8 +102,8 @@
"build:release-win32-all": "pnpm run build:release --arm64 --x64",
"build:preload-cache": "node ts/scripts/generate-preload-cache.node.js",
"build:emoji": "run-p build:emoji:32 build:emoji:64",
"build:emoji:32": "cwebp -progress -mt -preset icon -alpha_filter best -alpha_q 20 -pass 10 -q 75 ./node_modules/emoji-datasource-apple/img/apple/sheets-clean/32.png -o ./images/emoji-sheet-32.webp",
"build:emoji:64": "cwebp -progress -mt -preset icon -alpha_filter best -alpha_q 20 -pass 10 -q 75 ./node_modules/emoji-datasource-apple/img/apple/sheets-clean/64.png -o ./images/emoji-sheet-64.webp",
"build:emoji:32": "cwebp -progress -mt -preset icon -alpha_filter best -alpha_q 20 -pass 10 -q 75 ./node_modules/emoji-datasource-apple/img/apple/sheets/32.png -o ./images/emoji-sheet-32.webp",
"build:emoji:64": "cwebp -progress -mt -preset icon -alpha_filter best -alpha_q 20 -pass 10 -q 75 ./node_modules/emoji-datasource-apple/img/apple/sheets/64.png -o ./images/emoji-sheet-64.webp",
"verify": "run-p --print-label verify:*",
"verify:ts": "tsc --noEmit",
"electron:install-app-deps": "electron-builder install-app-deps",

View File

@@ -406,6 +406,9 @@ function addVariant(parentKey: EmojiParentKey, variant: EmojiVariantData) {
}
for (const rawEmoji of RAW_EMOJI_DATA) {
if (!rawEmoji.has_img_apple) {
continue;
}
const parentKey = toEmojiParentKey(rawEmoji.unified);
const defaultVariant: EmojiVariantData = {
@@ -426,6 +429,9 @@ for (const rawEmoji of RAW_EMOJI_DATA) {
const map = new Map<string, EmojiVariantKey>();
for (const [key, value] of Object.entries(rawEmoji.skin_variations)) {
if (!value.has_img_apple) {
continue;
}
const variantKey = toEmojiVariantKey(value.unified);
map.set(key, variantKey);

View File

@@ -9,7 +9,6 @@ import {
isEmojiVariantValue,
} from './data/emojis.std.js';
import type { LocaleEmojiListType } from '../../types/emoji.std.js';
import { strictAssert } from '../../util/assert.std.js';
import { useFunEmojiLocalization } from './FunEmojiLocalizationProvider.dom.js';
export type FunEmojiLocalizerIndex = Readonly<{
@@ -30,10 +29,10 @@ export function createFunEmojiLocalizerIndex(
const localeShortNameToParentKey = new Map<string, EmojiParentKey>();
for (const entry of localeEmojiList) {
strictAssert(
isEmojiVariantValue(entry.emoji),
'createFunEmojiLocalizerIndex: Must be emoji variant value'
);
// Sadly some localized emoji are not present in our spritesheets
if (!isEmojiVariantValue(entry.emoji)) {
continue;
}
const variantKey = getEmojiVariantKeyByValue(entry.emoji);
const parentKey = getEmojiParentKeyByVariantKey(variantKey);