Skip to content

Commit 2e85d5a

Browse files
authored
Add script to preview/validate Nerd Fonts (#1492)
1 parent 39bd88b commit 2e85d5a

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ indent_style = tab
1717
[*.json]
1818
indent_style = space
1919
indent_size = 2
20+
21+
[*.rb]
22+
indent_style = space
23+
indent_size = 2

scripts/nf-preview.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env ruby
2+
require "yaml"
3+
4+
LANGUAGES_FILE = File.expand_path("../../languages.yaml", __FILE__)
5+
6+
languages = YAML.safe_load_file(ARGV[0] || LANGUAGES_FILE, symbolize_names: true)
7+
8+
languages.each do |language, attributes|
9+
icon = attributes[:icon]
10+
next if icon.nil?
11+
match = /\A\\u\{([A-F0-9]{4,})\}\z/i.match(icon)
12+
raise "Icon for #{language} is not in the correct format: `#{icon}`" unless match
13+
glyph = match.captures[0].hex.chr("UTF-8")
14+
puts "#{language}: #{glyph}"
15+
end

0 commit comments

Comments
 (0)