Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
build_emoji: Use clean emoji sheets without Apple fallback images.
Anders Kaseorg80b9cffb3d42
diff --git a/tools/setup/emoji/build_emoji b/tools/setup/emoji/build_emojiindex 931e12248f8..33fc7ebd503 100755--- a/tools/setup/emoji/build_emoji+++ b/tools/setup/emoji/build_emoji@@ -6,6 +6,7 @@ import osimport shutilimport subprocessimport sys+import tempfilefrom collections.abc import Iterator, Sequencefrom typing import Any@@ -312,16 +313,25 @@ def setup_emoji_farms(cache_path: str, emoji_data: list[dict[str, Any]]) -> Nonef"emoji-datasource-{emojiset}","img",emojiset,- "sheets-256",+ "sheets-clean","64.png",)sheet_dst = os.path.join(TARGET_EMOJI_SHEETS, f"{emojiset}.webp")- # From libwebp: [Q is] between 0 and 100. For lossy, 0 gives- # the smallest size and 100 the largest. For lossless, this- # parameter is the amount of effort put into the- # compression: 0 is the fastest but gives larger files- # compared to the slowest, but best, 100.- subprocess.check_call(["vips", "copy", sheet_src, f"{sheet_dst}[lossless=true,Q=100]"])++ with tempfile.TemporaryDirectory() as tmpdir:+ # First quantize the image to 256 colors (like sheets-256 in+ # emoji-datasource); libvips can only do this when saving to a PNG.+ quantized = os.path.join(tmpdir, "quantized.png")+ subprocess.check_call(+ ["vips", "copy", sheet_src, f"{quantized}[palette,dither=0,effort=10]"]+ )++ # From libwebp: [Q is] between 0 and 100. For lossy, 0 gives+ # the smallest size and 100 the largest. For lossless, this+ # parameter is the amount of effort put into the+ # compression: 0 is the fastest but gives larger files+ # compared to the slowest, but best, 100.+ subprocess.check_call(["vips", "copy", quantized, f"{sheet_dst}[lossless,Q=100]"])# Set up standard emoji sets.for emojiset in ["google", "twitter"]: