fontist 1.11.2 → 1.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fontist.gemspec +1 -0
- data/lib/fontist/import/recursive_extraction.rb +3 -1
- data/lib/fontist/system_font.rb +8 -0
- data/lib/fontist/system_index.rb +38 -23
- data/lib/fontist/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0461da7c09c672b443f4a0bad5443f3bf48294cb3e0aee5ea7082838825519ca
|
4
|
+
data.tar.gz: 0e5931e6617e4484074b7d740fbe9f593dc3a31d9b524859167d90cdfc060498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0b30b8bfc0f01507d436dea54d5b122751c852a63d2309a5236a5a5f698c140892e54c2f665dbbce4bf0c6f6276c9a7cd1910f212aa7a27937ceca1b8ba510d
|
7
|
+
data.tar.gz: de92e684e1368ee2a5c10d1789962181316590b87ea5b806d8fd0a959329c54dd0d95723d99334038f75e2865d277b12dbc2c17aeed39b5b57436506273e7be4
|
data/fontist.gemspec
CHANGED
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency "nokogiri", "~> 1.0"
|
41
41
|
spec.add_development_dependency "rake", "~> 13"
|
42
42
|
spec.add_development_dependency "rspec", "~> 3.0"
|
43
|
+
spec.add_development_dependency "rspec-benchmark", "~> 0.6"
|
43
44
|
spec.add_development_dependency "rubocop", "1.5.2"
|
44
45
|
spec.add_development_dependency "rubocop-rails"
|
45
46
|
spec.add_development_dependency "rubocop-performance"
|
@@ -4,7 +4,7 @@ module Fontist
|
|
4
4
|
module Import
|
5
5
|
class RecursiveExtraction
|
6
6
|
LICENSE_PATTERN =
|
7
|
-
/(ofl\.txt|ufl\.txt|licenses?\.txt|license
|
7
|
+
/(ofl\.txt|ufl\.txt|licenses?\.txt|license(\.md)?|copying)$/i.freeze
|
8
8
|
|
9
9
|
def initialize(archive, subarchive: nil, subdir: nil)
|
10
10
|
@archive = archive
|
@@ -70,6 +70,8 @@ module Fontist
|
|
70
70
|
|
71
71
|
def extract_data(archive)
|
72
72
|
Excavate::Archive.new(path(archive)).files(recursive_packages: true) do |path|
|
73
|
+
next unless File.file?(path)
|
74
|
+
|
73
75
|
match_license(path)
|
74
76
|
match_font(path) if font_directory?(path)
|
75
77
|
end
|
data/lib/fontist/system_font.rb
CHANGED
@@ -12,6 +12,10 @@ module Fontist
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.system_font_paths
|
15
|
+
@system_font_paths ||= load_system_font_paths
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.load_system_font_paths
|
15
19
|
config_path = Fontist.system_file_path
|
16
20
|
os = Fontist::Utils::System.user_os.to_s
|
17
21
|
templates = YAML.load_file(config_path)["system"][os]["paths"]
|
@@ -20,6 +24,10 @@ module Fontist
|
|
20
24
|
Dir.glob(patterns)
|
21
25
|
end
|
22
26
|
|
27
|
+
def self.reset_system_font_paths_cache
|
28
|
+
@system_font_paths = nil
|
29
|
+
end
|
30
|
+
|
23
31
|
def self.expand_paths(paths)
|
24
32
|
paths.map do |path|
|
25
33
|
require "etc"
|
data/lib/fontist/system_index.rb
CHANGED
@@ -37,35 +37,39 @@ module Fontist
|
|
37
37
|
LANGUAGE_MAC_ENGLISH = 0
|
38
38
|
LANGUAGE_MS_ENGLISH_AMERICAN = 0x409
|
39
39
|
|
40
|
-
attr_reader :font_paths
|
41
|
-
|
42
40
|
def self.system_index
|
43
|
-
if Fontist.preferred_family?
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
41
|
+
path = if Fontist.preferred_family?
|
42
|
+
Fontist.system_preferred_family_index_path
|
43
|
+
else
|
44
|
+
Fontist.system_index_path
|
45
|
+
end
|
46
|
+
|
47
|
+
@system_index ||= {}
|
48
|
+
@system_index[Fontist.preferred_family?] ||= {}
|
49
|
+
@system_index[Fontist.preferred_family?][path] ||=
|
50
|
+
new(path, -> { SystemFont.font_paths }, family)
|
52
51
|
end
|
53
52
|
|
54
53
|
def self.fontist_index
|
55
|
-
if Fontist.preferred_family?
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
path = if Fontist.preferred_family?
|
55
|
+
Fontist.fontist_preferred_family_index_path
|
56
|
+
else
|
57
|
+
Fontist.fontist_index_path
|
58
|
+
end
|
59
|
+
|
60
|
+
@fontist_index ||= {}
|
61
|
+
@fontist_index[Fontist.preferred_family?] ||= {}
|
62
|
+
@fontist_index[Fontist.preferred_family?][path] ||=
|
63
|
+
new(path, -> { SystemFont.fontist_font_paths }, family)
|
64
64
|
end
|
65
65
|
|
66
|
-
def
|
66
|
+
def self.family
|
67
|
+
Fontist.preferred_family? ? PreferredFamily.new : DefaultFamily.new
|
68
|
+
end
|
69
|
+
|
70
|
+
def initialize(index_path, font_paths_fetcher, family)
|
67
71
|
@index_path = index_path
|
68
|
-
@
|
72
|
+
@font_paths_fetcher = font_paths_fetcher
|
69
73
|
@family = family
|
70
74
|
end
|
71
75
|
|
@@ -85,7 +89,18 @@ module Fontist
|
|
85
89
|
private
|
86
90
|
|
87
91
|
def index
|
88
|
-
@index
|
92
|
+
return @index unless index_changed?
|
93
|
+
|
94
|
+
@index = build_index
|
95
|
+
end
|
96
|
+
|
97
|
+
def index_changed?
|
98
|
+
@index.nil? ||
|
99
|
+
@index.map { |x| x[:path] }.uniq.sort != font_paths.sort
|
100
|
+
end
|
101
|
+
|
102
|
+
def font_paths
|
103
|
+
@font_paths_fetcher.call
|
89
104
|
end
|
90
105
|
|
91
106
|
def build_index
|
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.11.
|
4
|
+
version: 1.11.3
|
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-09-
|
11
|
+
date: 2021-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: down
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '3.0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rspec-benchmark
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.6'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.6'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: rubocop
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|