Skip to content

Commit

Permalink
Some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
PoomSmart committed Dec 31, 2023
1 parent 9a9ba43 commit 9255d65
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 12 deletions.
7 changes: 3 additions & 4 deletions CAVEATS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Missing emojis or limitations of each non-Apple themed font will be listed here.

## Facebook Emoji

- Unicode 14.0 only.
- Nothing of significant.

## FluentUI Emoji

Expand All @@ -20,11 +20,10 @@ Missing emojis or limitations of each non-Apple themed font will be listed here.

## JoyPixels Emoji

- Unicode 14.0 only.
- Nothing of significant.

## OpenMoji Emoji

- Unicode 14.0 only.
- Couple emojis of different skins will not share the same hair color as it seems so in the original OpenMoji. In my opinion, this is better because why would two people of different races always share the same hair color?

## Samsung One UI Emoji
Expand All @@ -39,7 +38,7 @@ Missing emojis or limitations of each non-Apple themed font will be listed here.

## Twitter Twemoji

- Unicode 14.0 only.
- Nothing of significant.

## WhatsApp Emoji

Expand Down
33 changes: 33 additions & 0 deletions facebook/facebook-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

set -e

APPLE_FONT_NAME=AppleColorEmoji@2x
NAME=facebook
FONT_NAME=NotoColorEmoji
ASSETS=../../facebook-emojis/images/96

../image-sizes.sh false

cp -r $ASSETS/ images/96

echo "Extracting font..."
ttx -q -f -z extfile $FONT_NAME.ttf
ttx -q -f -s -t GSUB $FONT_NAME.ttf

echo "Resizing and optimizing PNGs..."
mogrify -resize 96x96 -path images/96 bitmaps/strike0/*.png
../resize.sh false false false
rm -rf bitmaps

mkdir -p extra/images/96
cp extra/original/*.png extra/images/96
../get-assets.sh facebook

python3 $NAME.py ../apple/${APPLE_FONT_NAME}_00.ttf $FONT_NAME.ttf $FONT_NAME.G_S_U_B_.ttx
python3 $NAME.py ../apple/${APPLE_FONT_NAME}_01.ttf $FONT_NAME.ttf $FONT_NAME.G_S_U_B_.ttx

otf2otc ${APPLE_FONT_NAME}_00.ttf ${APPLE_FONT_NAME}_01.ttf -o $NAME.ttc
rm -f *_00.ttf *_01.ttf

echo "Output file at $NAME/$NAME.ttc"
23 changes: 16 additions & 7 deletions facebook/facebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@

sys.path.append('..')
from shared import *
from shared_lig import *

# input: font ttf

ttf = sys.argv[1]
bttf = sys.argv[2]
bgsubttx = sys.argv[3]

f = ttLib.TTFont(ttf)

lig = Lig(f, bttf, bgsubttx)
lig.build()

def norm_name(name: str):
name = base_norm_name(name)
if '20e3' in name or name in signs:
Expand All @@ -34,13 +39,17 @@ def facebook_name(name: str):
continue
name = base_norm_variants(name)
name = base_norm_special(name)
name = facebook_name(name)
path = f'images/{ppem}/{name}.png'
if not os.path.exists(path) or name.startswith('1f491') or name.startswith('1f48f'):
path = f'extra/images/{ppem}/{name}.png'
o_name = facebook_name(name)
name = lig.norm_name(name)
name = lig.get_glyph_name(name)
path = f'images/{ppem}/{o_name}.png'
if not os.path.exists(path) or name.startswith('1f491') or o_name.startswith('1f48f'):
path = f'extra/images/{ppem}/{o_name}.png'
if not os.path.exists(path):
name = name.replace('-', '_')
path = f'extra/images/{ppem}/{name}.png'
o_name = o_name.replace('-', '_')
path = f'extra/images/{ppem}/{o_name}.png'
if not os.path.exists(path):
path = f'images/{ppem}/{name}.png'
glyph.imageData = get_image_data(path)

if not os.path.exists('../.test'):
Expand Down
2 changes: 1 addition & 1 deletion fluentui/fluentui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'1f91d_1f3fb', '1f91d_1f3fc', '1f91d_1f3fd', '1f91d_1f3fe', '1f91d_1f3ff',
'1f9d1_200d_1f4bb',
'1f9d1_1f3fb_200d_1f4bb', '1f9d1_1f3fc_200d_1f4bb', '1f9d1_1f3fd_200d_1f4bb', '1f9d1_1f3fe_200d_1f4bb', '1f9d1_1f3ff_200d_1f4bb',
] + u15
]

def norm_special(name: str):
if name == '1f441_1f5e8':
Expand Down
46 changes: 46 additions & 0 deletions noto-emoji-cursed/noto-emoji-cursed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os
import sys

sys.path.append('..')
from shared import *
from shared_lig import *

# input: apple font ttf, noto-emoji-cursed font ttf, noto-emoji-cursed GSUB ttx

ttf = sys.argv[1]
bttf = sys.argv[2]
bgsubttx = sys.argv[3]

f = ttLib.TTFont(ttf)

lig = Lig(f, bttf, bgsubttx)
lig.build()

prepare_strikes(f)
for ppem, strike in f['sbix'].strikes.items():
print(f'Reading strike of size {ppem}x{ppem}')
for name, glyph in strike.glyphs.items():
if glyph.graphicType != 'png ':
continue
name = base_norm_name(name)
if base_is_whitelist(name):
continue
name = norm_fam(name)
name = norm_dual(name)
if name is None:
continue
name = base_norm_variants(name)
name = base_norm_special(name)
name = lig.norm_name(name)
name = lig.get_glyph_name(name)
path = f'images/{ppem}/{name}.png'
if not os.path.exists(path):
print(name)
name = native_norm_name(name)
path = f'../noto-emoji/extra/images/{ppem}/{name}.png'
glyph.imageData = get_image_data(path)

if not os.path.exists('../.test'):
print('Saving changes...')
ttf = ttf.replace('../apple/', '')
f.save(ttf)
27 changes: 27 additions & 0 deletions noto-emoji-cursed/noto-emoji-cursed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -e

APPLE_FONT_NAME=AppleColorEmoji@2x
NAME=noto-emoji-cursed
FONT_NAME=SamsungColorEmoji
FONT_PATH=$FONT_NAME.ttf

../image-sizes.sh false

echo "Extracting font..."
ttx -q -f -z extfile $FONT_NAME.ttf
ttx -q -f -s -t GSUB $FONT_NAME.ttf

echo "Resizing and optimizing PNGs..."
mogrify -resize 96x96 -path images/96 bitmaps/strike0/*.png
../resize.sh false false false
rm -rf bitmaps

python3 $NAME.py ../apple/${APPLE_FONT_NAME}_00.ttf $FONT_NAME.ttf $FONT_NAME.G_S_U_B_.ttx
python3 $NAME.py ../apple/${APPLE_FONT_NAME}_01.ttf $FONT_NAME.ttf $FONT_NAME.G_S_U_B_.ttx

otf2otc ${APPLE_FONT_NAME}_00.ttf ${APPLE_FONT_NAME}_01.ttf -o $NAME.ttc
rm -f *_00.ttf *_01.ttf

echo "Output file at $NAME/$NAME.ttc"

0 comments on commit 9255d65

Please sign in to comment.