fontist 1.10.0 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +0,0 @@
1
- module Fontist
2
- class FormulaPaths
3
- attr_reader :font_paths
4
-
5
- def initialize(font_paths)
6
- @font_paths = font_paths
7
- end
8
-
9
- def find(font, style = nil)
10
- styles = find_styles_by_formulas(font, style)
11
- return if styles.empty?
12
-
13
- fonts = styles.uniq { |s| s["font"] }.flat_map do |s|
14
- paths = search_font_paths(s["font"])
15
- paths.map do |path|
16
- { full_name: s["full_name"],
17
- type: s["type"],
18
- path: path }
19
- end
20
- end
21
-
22
- fonts.empty? ? nil : fonts
23
- end
24
-
25
- private
26
-
27
- def find_styles_by_formulas(font, style)
28
- if style
29
- Formula.find_styles(font, style)
30
- else
31
- fonts = Formula.find_fonts(font)
32
- return [] unless fonts
33
-
34
- fonts.flat_map(&:styles)
35
- end
36
- end
37
-
38
- def search_font_paths(filename)
39
- font_paths.select do |path|
40
- File.basename(path) == filename
41
- end
42
- end
43
- end
44
- end
@@ -1,10 +0,0 @@
1
- # How to work with Protobuf
2
-
3
- Protobuf file could be downloaded from
4
- https://raw.githubusercontent.com/googlefonts/gftools/master/Lib/gftools/fonts_public.proto
5
-
6
- To compile Protobuf to Ruby use
7
-
8
- ```sh
9
- ruby-protoc lib/fontist/import/google/fonts_public.proto
10
- ```
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Generated by the protocol buffer compiler. DO NOT EDIT!
3
-
4
- require 'protocol_buffers'
5
-
6
- module Google
7
- module Fonts
8
- # forward declarations
9
- class FamilyProto < ::ProtocolBuffers::Message; end
10
- class FontProto < ::ProtocolBuffers::Message; end
11
- class AxisProto < ::ProtocolBuffers::Message; end
12
- class SourceProto < ::ProtocolBuffers::Message; end
13
-
14
- class FamilyProto < ::ProtocolBuffers::Message
15
- # forward declarations
16
- class ApiDefaultOverridesEntry < ::ProtocolBuffers::Message; end
17
-
18
- set_fully_qualified_name "google.fonts.FamilyProto"
19
-
20
- # nested messages
21
- class ApiDefaultOverridesEntry < ::ProtocolBuffers::Message
22
- set_fully_qualified_name "google.fonts.FamilyProto.ApiDefaultOverridesEntry"
23
-
24
- optional :string, :key, 1
25
- optional :float, :value, 2
26
- end
27
-
28
- required :string, :name, 1
29
- required :string, :designer, 2
30
- required :string, :license, 3
31
- required :string, :category, 4
32
- required :string, :date_added, 5
33
- repeated ::Google::Fonts::FontProto, :fonts, 6
34
- repeated :string, :aliases, 7
35
- repeated :string, :subsets, 8
36
- optional :string, :ttf_autohint_args, 9
37
- repeated ::Google::Fonts::AxisProto, :axes, 10
38
- repeated ::Google::Fonts::FamilyProto::ApiDefaultOverridesEntry, :api_default_overrides, 11
39
- optional ::Google::Fonts::SourceProto, :source, 12
40
- end
41
-
42
- class FontProto < ::ProtocolBuffers::Message
43
- set_fully_qualified_name "google.fonts.FontProto"
44
-
45
- required :string, :name, 1
46
- required :string, :style, 2
47
- required :int32, :weight, 3
48
- required :string, :filename, 4
49
- required :string, :post_script_name, 5
50
- required :string, :full_name, 6
51
- optional :string, :copyright, 7
52
- end
53
-
54
- class AxisProto < ::ProtocolBuffers::Message
55
- set_fully_qualified_name "google.fonts.AxisProto"
56
-
57
- optional :string, :tag, 1
58
- optional :float, :min_value, 2
59
- optional :float, :default_value, 3
60
- optional :float, :max_value, 4
61
- end
62
-
63
- class SourceProto < ::ProtocolBuffers::Message
64
- set_fully_qualified_name "google.fonts.SourceProto"
65
-
66
- optional :string, :repository_url, 1
67
- optional :string, :commit, 2
68
- end
69
-
70
- end
71
- end
@@ -1,46 +0,0 @@
1
- syntax = "proto2";
2
-
3
- /**
4
- * Open Source'd font metadata proto formats.
5
- */
6
- package google.fonts;
7
-
8
- option java_package = "com.google.fonts.proto";
9
- option java_outer_classname = "FontsPublic";
10
-
11
- message FamilyProto {
12
- required string name = 1;
13
- required string designer = 2;
14
- required string license = 3;
15
- required string category = 4;
16
- required string date_added = 5;
17
- repeated FontProto fonts = 6;
18
- repeated string aliases = 7;
19
- repeated string subsets = 8;
20
- optional string ttf_autohint_args = 9;
21
- repeated AxisProto axes = 10;
22
- map<string, float> api_default_overrides = 11;
23
- optional SourceProto source = 12;
24
- };
25
-
26
- message FontProto {
27
- required string name = 1;
28
- required string style = 2;
29
- required int32 weight = 3;
30
- required string filename = 4;
31
- required string post_script_name = 5;
32
- required string full_name = 6;
33
- optional string copyright = 7;
34
- };
35
-
36
- message AxisProto {
37
- optional string tag = 1;
38
- optional float min_value = 2;
39
- optional float default_value = 3;
40
- optional float max_value = 4;
41
- };
42
-
43
- message SourceProto {
44
- optional string repository_url = 1;
45
- optional string commit = 2;
46
- }