colorful rat Ratfactor.com > Dave's Repos

faceclick

A lightweight Emoji picker popup library with labels and keyword search.
git clone http://ratfactor.com/repos/faceclick/faceclick.git

faceclick/data/maketxt.rb

Download raw file: data/maketxt.rb

1 #!/usr/bin/env ruby 2 require 'json' 3 4 #maketxt.rb myemoj.json > myemoji.txt 5 6 # Prints out a text file containing only the Emoji characters 7 # listed in the input JSON file. 8 # The purpose of this was to provide a list of characters to 9 # make a subset of a web font to display just these characters. 10 # 11 # (Also contains commented-out code to find ranges for specifying the 12 # unicode-range to use in the CSS @font-face rule.) 13 # 14 # For more, see 15 # https://ratfactor.com/cards/make-a-webfont-subset 16 17 fin = ARGV[0] 18 19 json = File.read(fin) 20 list = JSON.parse(json) 21 22 weelist = list.map do |e| 23 e['emoji'] 24 end 25 26 #puts JSON.generate(weelist) 27 28 outstr = weelist.join(''); 29 30 puts outstr 31 32 # BAD CODE ALERT! 33 # really low-effort and "low-resolution" range finding 34 #last = 0 35 #outstr.codepoints.sort.each do |c| 36 # if c - last > 500 37 # puts last.to_s(16) 38 # puts "#{c.to_s(16)}..." 39 # end 40 # last = c 41 #end 42 #puts last.to_s(16)