Skip to content

Commit

Permalink
Update emoji_extractor.rb for macOS 10.12
Browse files Browse the repository at this point in the history
  • Loading branch information
wr authored Jun 14, 2016
1 parent 284ec2a commit 2ceed50
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions emoji_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,21 @@ def extract_png(input)
ofp.close
end

ttf = File.new("/System/Library/Fonts/Apple Color Emoji.ttf","rb")
ttf_data = ttf.read
begin
@ttf = File.new("/System/Library/Fonts/Apple Color Emoji.ttf","rb")
rescue
@ttf = File.new("/System/Library/Fonts/Apple Color Emoji.ttc","rb")
else
puts "Could not find the Apple Color Emoji font file. Exiting."
end

ttf_data = @ttf.read

pos = 0
while m = /\211PNG/.match(ttf_data[pos..-1])
raise "no PNG found" if !m
pos += m.begin(0) + 1
ttf.seek(pos-1)
@ttf.seek(pos-1)

extract_png(ttf)
extract_png(@ttf)
end

0 comments on commit 2ceed50

Please sign in to comment.