fontist 1.8.11 → 1.8.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -3
- data/README.md +1 -1
- data/lib/fontist/formula_paths.rb +1 -0
- data/lib/fontist/manifest/install.rb +1 -1
- data/lib/fontist/manifest/locations.rb +20 -6
- data/lib/fontist/system_font.rb +4 -12
- data/lib/fontist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1ece96735fa8114f5ce56d56217b20208e8c5dced1c8d0b4092094ebac4ec17
|
4
|
+
data.tar.gz: 30e6189789d580d5c6bd56aa12d02c91057a05a286ec513469c4897d193a2542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20044f9435f70398c851eca878a846dad762c065ace4de9efcd6b1c05a3b5c6e9ab1f6bef4aefdf6231db020f3d5cb4454c5a2e4cf4c1f151f19288890449b11
|
7
|
+
data.tar.gz: d93ca29eedc83eeb4fb60b574ae254b277eb210e2e1e8fbcad68ad6a15d86f3f2fe981f549444fdfb13f559221cd2bc03b73f0a00a89496f7a22482c6493afa3
|
data/.rubocop.yml
CHANGED
@@ -9,14 +9,14 @@ AllCops:
|
|
9
9
|
Rails:
|
10
10
|
Enabled: false
|
11
11
|
|
12
|
-
|
12
|
+
Layout/LineLength:
|
13
13
|
Exclude:
|
14
14
|
- 'lib/fontist/formulas/**/*.rb'
|
15
15
|
|
16
|
-
Layout/
|
16
|
+
Layout/FirstHashElementIndentation:
|
17
17
|
Exclude:
|
18
18
|
- 'lib/fontist/formulas/**/*.rb'
|
19
19
|
|
20
|
-
Layout/
|
20
|
+
Layout/HeredocIndentation:
|
21
21
|
Exclude:
|
22
22
|
- 'lib/fontist/formulas/**/*.rb'
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Fontist
|
2
2
|
|
3
3
|
[![Build Status](https://github.com/fontist/fontist/actions/workflows/rspec.yml/badge.svg)](https://github.com/fontist/fontist/actions/workflows/rspec.yml)
|
4
|
-
[![Gem Version](https://img.shields.io/gem/v/fontist.svg)](https://rubygems.org/gems/fontist
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/fontist.svg)](https://rubygems.org/gems/fontist)
|
5
5
|
[![Pull Requests](https://img.shields.io/github/issues-pr-raw/fontist/fontist.svg)](https://github.com/fontist/fontist/pulls)
|
6
6
|
|
7
7
|
A simple library to find and download fonts for Windows, Linux and Mac.
|
@@ -42,26 +42,40 @@ module Fontist
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def style_paths_map(font, names)
|
45
|
-
|
46
|
-
|
45
|
+
styles = style_paths(font, names)
|
46
|
+
group_paths(styles)
|
47
47
|
end
|
48
48
|
|
49
49
|
def style_paths(font, names)
|
50
|
-
names.
|
51
|
-
file_paths(font, style)
|
50
|
+
names.flat_map do |style|
|
51
|
+
file_paths(font, style) || empty_paths(style)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
def group_paths(styles)
|
56
|
+
styles.group_by { |s| s[:type] }
|
57
|
+
.transform_values { |group| style(group) }
|
58
|
+
end
|
59
|
+
|
60
|
+
def style(styles)
|
61
|
+
{ "full_name" => styles.first[:full_name],
|
62
|
+
"paths" => styles.map { |x| x[:path] } }.compact
|
63
|
+
end
|
64
|
+
|
55
65
|
def file_paths(font, style)
|
56
66
|
find_font_with_name(font, style).tap do |x|
|
57
|
-
if x
|
67
|
+
if x.nil?
|
58
68
|
raise Errors::MissingFontError.new(font, style)
|
59
69
|
end
|
60
70
|
end
|
61
71
|
end
|
62
72
|
|
63
73
|
def find_font_with_name(font, style)
|
64
|
-
Fontist::SystemFont.
|
74
|
+
Fontist::SystemFont.find_styles(font, style)
|
75
|
+
end
|
76
|
+
|
77
|
+
def empty_paths(style)
|
78
|
+
[{ "full_name" => nil, "type" => style, "path" => nil }]
|
65
79
|
end
|
66
80
|
end
|
67
81
|
end
|
data/lib/fontist/system_font.rb
CHANGED
@@ -40,8 +40,8 @@ module Fontist
|
|
40
40
|
new(font: font, sources: sources).find
|
41
41
|
end
|
42
42
|
|
43
|
-
def self.
|
44
|
-
new(font: font, style: style).
|
43
|
+
def self.find_styles(font, style)
|
44
|
+
new(font: font, style: style).find_styles
|
45
45
|
end
|
46
46
|
|
47
47
|
def find
|
@@ -51,22 +51,14 @@ module Fontist
|
|
51
51
|
styles.map { |x| x[:path] }
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
|
56
|
-
return { full_name: nil, paths: [] } unless styles
|
57
|
-
|
58
|
-
{ full_name: styles.first[:full_name],
|
59
|
-
paths: styles.map { |x| x[:path] } }
|
54
|
+
def find_styles
|
55
|
+
find_by_index || find_by_formulas
|
60
56
|
end
|
61
57
|
|
62
58
|
private
|
63
59
|
|
64
60
|
attr_reader :font, :style, :user_sources
|
65
61
|
|
66
|
-
def find_styles
|
67
|
-
find_by_index || find_by_formulas
|
68
|
-
end
|
69
|
-
|
70
62
|
def find_by_index
|
71
63
|
SystemIndex.new(all_paths).find(font, style)
|
72
64
|
end
|
data/lib/fontist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fontist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|