Fix vendored emoji font (#36357)

* add font

* use it

* rm old one
pull/36356/head
Shane Smiskol 6 days ago committed by GitHub
parent f290fb1e05
commit 3553a754a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      selfdrive/assets/fonts/NotoColorEmoji-Regular.ttf
  2. 3
      selfdrive/assets/fonts/NotoColorEmoji.ttf
  3. 4
      system/ui/lib/emoji.py

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:69f216a4ec672bb910d652678301ffe3094c44e5d03276e794ef793d936a1f1d
size 25096376

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:93cdc4ee9aa40e2afceecc63da0ca05ec7aab4bec991ece51a6b52389f48a477
size 10788068

@ -4,6 +4,8 @@ import re
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
import pyray as rl import pyray as rl
from openpilot.system.ui.lib.application import FONT_DIR
_cache: dict[str, rl.Texture] = {} _cache: dict[str, rl.Texture] = {}
EMOJI_REGEX = re.compile( EMOJI_REGEX = re.compile(
@ -37,7 +39,7 @@ def emoji_tex(emoji):
if emoji not in _cache: if emoji not in _cache:
img = Image.new("RGBA", (128, 128), (0, 0, 0, 0)) img = Image.new("RGBA", (128, 128), (0, 0, 0, 0))
draw = ImageDraw.Draw(img) draw = ImageDraw.Draw(img)
font = ImageFont.truetype("NotoColorEmoji", 109) font = ImageFont.truetype(FONT_DIR.joinpath("NotoColorEmoji.ttf"), 109)
draw.text((0, 0), emoji, font=font, embedded_color=True) draw.text((0, 0), emoji, font=font, embedded_color=True)
buffer = io.BytesIO() buffer = io.BytesIO()
img.save(buffer, format="PNG") img.save(buffer, format="PNG")

Loading…
Cancel
Save