Skip to content

Commit 859778c

Browse files
committed
Fix image filename lookups for default emoji.
"Default emoji" == emoji that can be modified with skin tone modifiers.
1 parent 11b4f69 commit 859778c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/emoji/extractor.rb

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ def extract!
2323
hexes = ttf_name.split('_').map { |n| n.gsub(/^u/, '').downcase }
2424

2525
if emoji_char_codes.include?(hexes.first.to_i(16))
26+
# When an emoji supports skin-tone modifiers, all variants--including
27+
# the unmodified "base" emoji--are suffixed with a "." + a number:
28+
# 0 for the base, then 1-5 which maps to Fitzpatrick types 2-6
29+
# (https://en.wikipedia.org/wiki/Fitzpatrick_scale). We remove the
30+
# base's suffix to fix its lookups.
31+
hexes.last.gsub!(/\.0$/, '')
2632
filename = "#{hexes.join('-')}.#{bitmap.type}"
2733
File.write(images_path.join(filename), bitmap.data.read)
2834
end

0 commit comments

Comments
 (0)