From 85c94599c5c6fd86dae9ac7a4f83b54cd21e369c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 1 Oct 2025 12:22:36 -0700 Subject: [PATCH] emoji: Remove deprecated Google blobs emoji set. Signed-off-by: Anders Kaseorg --- package.json | 1 - pnpm-lock.yaml | 8 --- tools/setup/emoji/build_emoji | 55 +++----------------- version.py | 2 +- web/src/emojisets.ts | 3 -- web/templates/settings/preferences_emoji.hbs | 4 -- 6 files changed, 8 insertions(+), 65 deletions(-) diff --git a/package.json b/package.json index f5629478d4..840f1af446 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "date-fns": "^4.1.0", "email-addresses": "^5.0.0", "emoji-datasource-google": "^15.0.1", - "emoji-datasource-google-blob": "npm:emoji-datasource-google@^3.0.0", "emoji-datasource-twitter": "^15.0.1", "error-stack-parser": "^2.0.2", "expose-loader": "^5.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b3a98ed4bd..6b02a0b6aa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -134,9 +134,6 @@ importers: emoji-datasource-google: specifier: ^15.0.1 version: 15.1.2 - emoji-datasource-google-blob: - specifier: npm:emoji-datasource-google@^3.0.0 - version: emoji-datasource-google@3.0.0 emoji-datasource-twitter: specifier: ^15.0.1 version: 15.1.2 @@ -4420,9 +4417,6 @@ packages: emoji-datasource-google@15.1.2: resolution: {integrity: sha512-RzBMQtclTnSDgjf/QbcNAkgZmA7al3TSnQxKJvZNwdDjOOlYdzBSmkvGYP9ZzHpBS4HBQ8IOQDsueV1YCA64LA==} - emoji-datasource-google@3.0.0: - resolution: {integrity: sha512-Ms+IO6V40EKcfBjxs76iLYQexo6Tgl8MbTxM7Z4Qm5n/Hwkr/DNNYui40aU3YaVd8oRNLaMXN1/rS++/VHViPQ==} - emoji-datasource-twitter@15.1.2: resolution: {integrity: sha512-Xz60XJ2v8W1POg8I/UkkxJXw2FnKIPO6y20nFXjHhhGV07MqXYh3O085WaYElW8UAwUgxmASaZxvYiUUepw3qg==} @@ -14266,8 +14260,6 @@ snapshots: emoji-datasource-google@15.1.2: {} - emoji-datasource-google@3.0.0: {} - emoji-datasource-twitter@15.1.2: {} emoji-regex-xs@2.0.1: {} diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emoji index 3ef92d912c..931e12248f 100755 --- a/tools/setup/emoji/build_emoji +++ b/tools/setup/emoji/build_emoji @@ -153,11 +153,7 @@ def get_square_size(emoji_data: Sequence[dict[str, Any]]) -> int: def generate_sprite_css_files( - cache_path: str, - emoji_data: list[dict[str, Any]], - emojiset: str, - alt_name: str, - fallback_emoji_data: Sequence[dict[str, Any]], + cache_path: str, emoji_data: list[dict[str, Any]], emojiset: str ) -> None: """ Spritesheets are usually NxN squares. @@ -236,28 +232,11 @@ def generate_sprite_css_files( f.write( SPRITE_CSS_FILE_TEMPLATE.format( emojiset=emojiset, - alt_name=alt_name, emoji_positions=emoji_positions, background_size=background_size, ), ) - # Google Classic stopped being supported in 2017. To be able to use other emoji, we - # fallback to Google Modern for any emoji not covered by Google Classic. - if emojiset == "google-blob": - extra_emoji_positions = "" - covered_emoji_codes = [ - get_emoji_code(emoji) for emoji in emoji_data if emoji["has_img_google"] - ] - for emoji in fallback_emoji_data: - code = get_emoji_code(emoji) - if emoji["has_img_google"] and code not in covered_emoji_codes: - extra_emoji_positions += EMOJI_OVERRIDE_TEMPLATE.format( - codepoint=code, - ) - with open(SPRITE_CSS_PATH, "a") as f: - f.write(extra_emoji_positions) - # The Twitter emoji team was laid off in 2022, so new emoji aren't supported. # https://github.com/twitter/twemoji/issues/570#issuecomment-1303422143. # The "twitter" sprite sheet we’re using does have images in those locations, @@ -295,32 +274,20 @@ def setup_emoji_farms(cache_path: str, emoji_data: list[dict[str, Any]]) -> None dst_file = os.path.join(target_emoji_farm, img_file_name) shutil.copy2(src_file, dst_file) - def setup_emoji_farm( - emojiset: str, - emoji_data: list[dict[str, Any]], - alt_name: str | None = None, - fallback_emoji_data: Sequence[dict[str, Any]] = [], - ) -> None: - # `alt_name` is an optional parameter that we use to avoid duplicating below - # code. It is only used while setting up google-blob emoji set as it is just - # a wrapper for an older version of emoji-datasource package due to which we - # need to use 'google' at some places in this code. It has no meaning for other - # emoji sets and is just equivalent to `emojiset`. - alt_name = alt_name or emojiset - + def setup_emoji_farm(emojiset: str, emoji_data: list[dict[str, Any]]) -> None: # Copy individual emoji images from npm packages. src_emoji_farm = os.path.join( - NODE_MODULES_PATH, "emoji-datasource-" + emojiset, "img", alt_name, "64" + NODE_MODULES_PATH, "emoji-datasource-" + emojiset, "img", emojiset, "64" ) target_emoji_farm = os.path.join(cache_path, "static", "images-" + emojiset + "-64") os.makedirs(target_emoji_farm, exist_ok=True) print(f"Copying individual {emojiset} image files...") for emoji_dict in emoji_data: - if emoji_dict["has_img_" + alt_name]: + if emoji_dict["has_img_" + emojiset]: ensure_emoji_image(emoji_dict, src_emoji_farm, target_emoji_farm) skin_variations = emoji_dict.get("skin_variations", {}) for img_info in skin_variations.values(): - if img_info["has_img_" + alt_name]: + if img_info["has_img_" + emojiset]: ensure_emoji_image(img_info, src_emoji_farm, target_emoji_farm) # Copy zulip.png to the emoji farm. @@ -334,7 +301,7 @@ def setup_emoji_farms(cache_path: str, emoji_data: list[dict[str, Any]]) -> None output_img_file = os.path.join(target_emoji_farm, "1f419.png") shutil.copyfile(input_img_file, output_img_file) - generate_sprite_css_files(cache_path, emoji_data, emojiset, alt_name, fallback_emoji_data) + generate_sprite_css_files(cache_path, emoji_data, emojiset) print(f"Converting {emojiset} sheet to webp...") TARGET_EMOJI_SHEETS = os.path.join(cache_path, "web", "emoji") @@ -344,7 +311,7 @@ def setup_emoji_farms(cache_path: str, emoji_data: list[dict[str, Any]]) -> None NODE_MODULES_PATH, f"emoji-datasource-{emojiset}", "img", - alt_name, + emojiset, "sheets-256", "64.png", ) @@ -360,14 +327,6 @@ def setup_emoji_farms(cache_path: str, emoji_data: list[dict[str, Any]]) -> None for emojiset in ["google", "twitter"]: setup_emoji_farm(emojiset, emoji_data) - # Set up old Google "blobs" emoji set. - GOOGLE_BLOB_EMOJI_DATA_PATH = os.path.join( - NODE_MODULES_PATH, "emoji-datasource-google-blob", "emoji.json" - ) - with open(GOOGLE_BLOB_EMOJI_DATA_PATH, "rb") as fp: - blob_emoji_data = orjson.loads(fp.read()) - setup_emoji_farm("google-blob", blob_emoji_data, "google", emoji_data) - def setup_old_emoji_farm( cache_path: str, emoji_map: dict[str, str], emoji_data: list[dict[str, Any]] diff --git a/version.py b/version.py index 3407f55467..b04437af30 100644 --- a/version.py +++ b/version.py @@ -49,4 +49,4 @@ API_FEATURE_LEVEL = 427 # historical commits sharing the same major version, in which case a # minor version bump suffices. -PROVISION_VERSION = (350, 0) # bumped 2025-09-30 to upgrade Python requirements +PROVISION_VERSION = (351, 0) # bumped 2025-10-01 to remove emoji-datasource-google-blob diff --git a/web/src/emojisets.ts b/web/src/emojisets.ts index 7cb3f9d2eb..931cbb4aa5 100644 --- a/web/src/emojisets.ts +++ b/web/src/emojisets.ts @@ -1,12 +1,10 @@ import octopus_url from "../../static/generated/emoji/images-google-64/1f419.png"; -import google_blob_sheet from "../generated/emoji/google-blob.webp"; import google_sheet from "../generated/emoji/google.webp"; import twitter_sheet from "../generated/emoji/twitter.webp"; import * as blueslip from "./blueslip.ts"; import {user_settings} from "./user_settings.ts"; -import google_blob_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-blob-sprite.css"; import google_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-sprite.css"; import twitter_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/twitter-sprite.css"; @@ -17,7 +15,6 @@ type EmojiSet = { const emojisets = new Map([ ["google", {css: google_css, sheet: google_sheet}], - ["google-blob", {css: google_blob_css, sheet: google_blob_sheet}], ["twitter", {css: twitter_css, sheet: twitter_sheet}], ]); diff --git a/web/templates/settings/preferences_emoji.hbs b/web/templates/settings/preferences_emoji.hbs index cae9463242..c70e42bdb6 100644 --- a/web/templates/settings/preferences_emoji.hbs +++ b/web/templates/settings/preferences_emoji.hbs @@ -12,10 +12,6 @@ {{this.text}} - {{#if (eq this.key "google-blob")}} - ({{t "deprecated" }}) - {{> ../help_link_widget link="/help/emoji-and-emoticons#change-your-emoji-set" }} - {{/if}} {{#if (eq this.key "text") }}