diff options
author | davidovski <david@davidovski.xyz> | 2022-05-31 11:05:19 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2022-05-31 11:05:19 +0100 |
commit | 48ca75555522716f0f686dcae3dd6cf3d8ad714d (patch) | |
tree | 00c0f58550ba4661e87376f2f02c8001c69bae44 /repo/font/font-noto/noto-meta | |
parent | 871b2b573f01c1b3176a0f65458b3d281b41c437 (diff) |
removed idea of repos
Diffstat (limited to 'repo/font/font-noto/noto-meta')
-rw-r--r-- | repo/font/font-noto/noto-meta | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/repo/font/font-noto/noto-meta b/repo/font/font-noto/noto-meta deleted file mode 100644 index 1ac47a9..0000000 --- a/repo/font/font-noto/noto-meta +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/ruby -require 'erb' -require 'fileutils' -require 'json' -require 'shellwords' - -include FileUtils - - -def die!(msg) - warn msg - exit 1 -end - -def render_template(template, attrs = {}) - context = Class.new(OpenStruct).new(**attrs).instance_eval('binding') - ERB.new(template, 0, '-').result(context) -end - -def gen_font_confs(fonts, out_dir = '.') - out_dir = File.expand_path(out_dir) - mkdir_p(out_dir) - - Dir.chdir(__dir__) do - template = File.read('fontconfig.xml.erb') - - fonts.each do |subpkg, data| - conf_name = "58-noto#{'-' + subpkg if subpkg != '@'}.xml" - - conf = if File.exists?(conf_name) - File.read(conf_name) - else - render_template(template, data: data) - end - File.write(File.join(out_dir, conf_name), conf) - end - end -end - - -fonts = JSON.load_file(File.join(__dir__, 'noto-meta.json')) - -case (action = ARGV[0]) -when 'list-subpkgs' - puts fonts.keys.select { _1 != '@' }.sort_by { [-_1.size, _1] } - -when 'gen-font-confs' - gen_font_confs(fonts, ARGV[1]) - -when 'pkgdesc', 'font-basenames' - key = ARGV[1].sub(/^font-noto-/, '') - data = fonts[key] or die! "unknown font subpkgname: #{ARGV[1]}" - - case action - when 'pkgdesc' - puts data['pkgdesc'] - when 'font-basenames' - puts data['fonts'].map { _1['family'].gsub(' ', '') } - end - -else - die! "invalid action: #{action}" -end |