fontist 0.4.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macosx.yml +1 -1
  3. data/.github/workflows/ubuntu.yml +1 -1
  4. data/.gitignore +4 -2
  5. data/README.md +87 -25
  6. data/fontist.gemspec +1 -0
  7. data/lib/fontist.rb +30 -13
  8. data/lib/fontist/errors.rb +3 -1
  9. data/lib/fontist/font.rb +113 -0
  10. data/lib/fontist/font_formula.rb +123 -0
  11. data/lib/fontist/formula.rb +90 -0
  12. data/lib/fontist/formulas.rb +10 -5
  13. data/lib/fontist/formulas/andale_font.rb +80 -0
  14. data/lib/fontist/formulas/arial_black_font.rb +79 -0
  15. data/lib/fontist/formulas/cleartype_fonts.rb +227 -0
  16. data/lib/fontist/formulas/comic_font.rb +78 -0
  17. data/lib/fontist/formulas/courier_font.rb +68 -12
  18. data/lib/fontist/formulas/euphemia_font.rb +85 -0
  19. data/lib/fontist/formulas/georgia_font.rb +80 -0
  20. data/lib/fontist/formulas/impact_font.rb +78 -0
  21. data/lib/fontist/formulas/montserrat_font.rb +132 -0
  22. data/lib/fontist/formulas/ms_truetype_fonts.rb +125 -0
  23. data/lib/fontist/formulas/open_sans_fonts.rb +263 -0
  24. data/lib/fontist/formulas/overpass_font.rb +73 -0
  25. data/lib/fontist/formulas/source_fonts.rb +109 -0
  26. data/lib/fontist/formulas/stix_fonts.rb +108 -0
  27. data/lib/fontist/formulas/tahoma_font.rb +147 -0
  28. data/lib/fontist/formulas/webding_font.rb +78 -0
  29. data/lib/fontist/registry.rb +43 -0
  30. data/lib/fontist/{data/source.yml → system.yml} +5 -8
  31. data/lib/fontist/system_font.rb +19 -14
  32. data/lib/fontist/utils.rb +10 -0
  33. data/lib/fontist/utils/downloader.rb +79 -0
  34. data/lib/fontist/utils/dsl.rb +77 -0
  35. data/lib/fontist/utils/exe_extractor.rb +72 -0
  36. data/lib/fontist/utils/ui.rb +15 -0
  37. data/lib/fontist/utils/zip_extractor.rb +38 -0
  38. data/lib/fontist/version.rb +1 -1
  39. data/spec/fontist/font_formula_spec.rb +67 -0
  40. data/spec/fontist/font_spec.rb +113 -0
  41. data/spec/fontist/formula_spec.rb +67 -0
  42. data/spec/fontist/formulas/andale_font_spec.rb +29 -0
  43. data/spec/fontist/formulas/arial_black_font_spec.rb +29 -0
  44. data/spec/fontist/formulas/cleartype_fonts_spec.rb +38 -0
  45. data/spec/fontist/formulas/comic_font_spec.rb +29 -0
  46. data/spec/fontist/formulas/courier_font_spec.rb +18 -19
  47. data/spec/fontist/formulas/euphemia_font_spec.rb +29 -0
  48. data/spec/fontist/formulas/georgia_font_spec.rb +29 -0
  49. data/spec/fontist/formulas/impact_font_spec.rb +29 -0
  50. data/spec/fontist/formulas/montserrat_font_spec.rb +29 -0
  51. data/spec/fontist/formulas/ms_truetype_fonts_spec.rb +29 -0
  52. data/spec/fontist/formulas/open_sans_fonts_spec.rb +29 -0
  53. data/spec/fontist/formulas/overpass_font_spec.rb +29 -0
  54. data/spec/fontist/formulas/source_fonts_spec.rb +31 -0
  55. data/spec/fontist/formulas/stix_fonts_spec.rb +29 -0
  56. data/spec/fontist/formulas/tahoma_font_spec.rb +29 -0
  57. data/spec/fontist/formulas/webding_font_spec.rb +29 -0
  58. data/spec/fontist/registry_spec.rb +47 -0
  59. data/spec/fontist/system_font_spec.rb +12 -7
  60. data/spec/fontist/{downloader_spec.rb → utils/downloader_spec.rb} +6 -5
  61. data/spec/spec_helper.rb +4 -2
  62. data/spec/support/fontist_helper.rb +4 -2
  63. metadata +62 -27
  64. data/lib/fontist/data/formulas/courier.yml +0 -26
  65. data/lib/fontist/data/formulas/ms_system.yml +0 -68
  66. data/lib/fontist/data/formulas/ms_vista.yml +0 -118
  67. data/lib/fontist/data/formulas/source_font.yml +0 -163
  68. data/lib/fontist/downloader.rb +0 -70
  69. data/lib/fontist/finder.rb +0 -45
  70. data/lib/fontist/formula_finder.rb +0 -94
  71. data/lib/fontist/formulas/base.rb +0 -72
  72. data/lib/fontist/formulas/helpers/exe_extractor.rb +0 -45
  73. data/lib/fontist/formulas/helpers/zip_extractor.rb +0 -36
  74. data/lib/fontist/formulas/ms_system.rb +0 -29
  75. data/lib/fontist/formulas/ms_vista.rb +0 -42
  76. data/lib/fontist/formulas/source_font.rb +0 -25
  77. data/lib/fontist/installer.rb +0 -42
  78. data/lib/fontist/source.rb +0 -58
  79. data/spec/fontist/finder_spec.rb +0 -41
  80. data/spec/fontist/formula_finder_spec.rb +0 -54
  81. data/spec/fontist/formulas/ms_system_spec.rb +0 -31
  82. data/spec/fontist/formulas/ms_vista_spec.rb +0 -27
  83. data/spec/fontist/formulas/source_font_spec.rb +0 -18
  84. data/spec/fontist/installer_spec.rb +0 -48
  85. data/spec/fontist/source_spec.rb +0 -24
@@ -1,26 +0,0 @@
1
- courier:
2
- agreement: "yes"
3
-
4
- fonts:
5
- - name: Courier
6
- styles:
7
- - type: Regular
8
- font: cour.ttf
9
-
10
- - type: Bold
11
- font: courbd.ttf
12
-
13
- - type: Italic
14
- font: couri.ttf
15
-
16
- - type: Bold Italic
17
- font: courbi.ttf
18
-
19
- file_size: "1675184"
20
- sha: "bb511d861655dde879ae552eb86b134d6fae67cb58502e6ff73ec5d9151f3384"
21
- urls:
22
- - https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/courie32.exe
23
- - http://sft.if.usp.br/msttcorefonts/courie32.exe
24
-
25
- licence: |
26
- Details of the license goes here.
@@ -1,68 +0,0 @@
1
- ms_system:
2
- agreement: "yes"
3
-
4
- fonts:
5
- - name: Arial
6
- styles:
7
- - type: Regular
8
- font: Arial.ttf
9
-
10
- - type: Bold
11
- font: ArialBd.ttf
12
-
13
- - type: Italic
14
- font: ArialBd.ttf
15
-
16
- - type: Bold Italic
17
- font: ArialBI.ttf
18
-
19
- - name: Times New Roman
20
- styles:
21
- - type: Regular
22
- font: Times.ttf
23
-
24
- - type: Bold
25
- font: TimesBd.ttf
26
-
27
- - type: Italic
28
- font: TimesI.ttf
29
-
30
- - type: Bold Italic
31
- font: TimesBI.ttf
32
-
33
- - name: Verdana
34
- styles:
35
- - type: Regular
36
- font: Verdana.ttf
37
-
38
- - type: Bold
39
- font: Verdanab.ttf
40
-
41
- - type: Italic
42
- font: Verdanai.ttf
43
-
44
- - type: Bold Italic
45
- font: Verdanaz.ttf
46
-
47
- - name: Trebuchet
48
- styles:
49
- - type: Regular
50
- font: trebuc.ttf
51
-
52
- - type: Bold
53
- font: trebucbd.ttf
54
-
55
- - type: Italic
56
- font: trebucit.ttf
57
-
58
- - type: Bold Italic
59
- font: trebucbi.ttf
60
-
61
- file_size: "1675184"
62
- sha: "464dd2cd5f09f489f9ac86ea7790b7b8548fc4e46d9f889b68d2cdce47e09ea8"
63
- urls:
64
- - https://download.microsoft.com/download/a/1/8/a180e21e-9c2b-4b54-9c32-bf7fd7429970/EUupdate.EXE
65
- - https://nchc.dl.sourceforge.net/project/corefonts/the%20fonts/final/EUupdate.EXE
66
-
67
- licence: |
68
- Details license goes here
@@ -1,118 +0,0 @@
1
- msvista:
2
- agreement: "yes"
3
-
4
- fonts:
5
- - name: Cambria
6
- styles:
7
- - type: Regular
8
- font: CAMBRIA.TTC
9
-
10
- - type: Bold
11
- font: CAMBRIAB.TTF
12
-
13
- - type: Italic
14
- font: CAMBRIAI.TTF
15
-
16
- - type: Bold Italic
17
- font: CAMBRIAZ.TTF
18
-
19
- - name: Calibri
20
- styles:
21
- - type: Regular
22
- font: CALIBRI.TTF
23
-
24
- - type: Bold
25
- font: CALIBRIB.TTF
26
-
27
- - type: Italic
28
- font: CALIBRII.TTF
29
-
30
- - type: Bold Italic
31
- font: CALIBRIZ.TTF
32
-
33
- - name: Candara
34
- styles:
35
- - type: Regular
36
- font: CANDARA.TTF
37
-
38
- - type: Bold
39
- font: CANDARAB.TTF
40
-
41
- - type: Italic
42
- font: CANDARAI.TTF
43
-
44
- - type: Bold Italic
45
- font: CANDARAZ.TTF
46
-
47
- - name: Consola
48
- styles:
49
- - type: Regular
50
- font: CONSOLA.TTF
51
-
52
- - type: Bold
53
- font: CONSOLAB.TTF
54
-
55
- - type: Italic
56
- font: CONSOLAI.TTF
57
-
58
- - type: Bold Italic
59
- font: CONSOLAZ.TTF
60
-
61
- - name: Constantia
62
- styles:
63
- - type: Regular
64
- font: CONSTAN.TTF
65
-
66
- - type: Bold
67
- font: CONSTANB.TTF
68
-
69
- - type: Italic
70
- font: CONSTANI.TTF
71
-
72
- - type: Bold Italic
73
- font: CONSTANZ.TTF
74
-
75
- - name: Corbel
76
- styles:
77
- - type: Regular
78
- font: CORBEL.TTF
79
-
80
- - type: Bold
81
- font: CORBELB.TTF
82
-
83
- - type: Italic
84
- font: CORBELI.TTF
85
-
86
- - type: Bold Italic
87
- font: CORBELZ.TTF
88
-
89
- # Note: further work necessary
90
- #
91
- # The initial version is returing the ttc fonts as
92
- # it is, but maybe in the upcoming releases we will need
93
- # to extract/parse the ttc fonts if necessary.
94
- #
95
- - name: Meiryo
96
- styles:
97
- - type: Regular
98
- font: MEIRYO.TTC
99
-
100
- - type: Bold
101
- font: MEIRYO.TTC
102
-
103
- - name: Meiryo UI
104
- styles:
105
- - type: Regular
106
- font: MEIRYO.TTC
107
-
108
- - type: Bold
109
- font: MEIRYO.TTC
110
-
111
- file_size: "62914560"
112
- sha: "249473568eba7a1e4f95498acba594e0f42e6581add4dead70c1dfb908a09423"
113
- urls:
114
- - "https://www.dropbox.com/s/dl/6lclhxpydwgkjzh/PowerPointViewer.exe?dl=1"
115
- - "https://web.archive.org/web/20171225132744/http://download.microsoft.com/download/E/6/7/E675FFFC-2A6D-4AB0-B3EB-27C9F8C8F696/PowerPointViewer.exe"
116
-
117
- license: |
118
- Complete MS licence;
@@ -1,163 +0,0 @@
1
- source_font:
2
- agreement: ""
3
-
4
- fonts:
5
- - name: Source Code Pro
6
- styles:
7
- - type: Black
8
- font: SourceCodePro-Black.ttf
9
-
10
- - type: Black Italic
11
- font: SourceCodePro-BlackIt.ttf
12
-
13
- - type: Bold
14
- font: SourceCodePro-Bold.ttf
15
-
16
- - type: Bold Italic
17
- font: SourceCodePro-BoldIt.ttf
18
-
19
- - type: Extra Light
20
- font: SourceCodePro-ExtraLight.ttf
21
-
22
- - type: ExtraLightIt
23
- font: SourceCodePro-ExtraLightIt.ttf
24
-
25
- - type: Italic
26
- font: SourceCodePro-It.ttf
27
-
28
- - type: Light
29
- font: SourceCodePro-Light.ttf
30
-
31
- - type: Light Italic
32
- font: SourceCodePro-LightIt.ttf
33
-
34
- - type: Medium
35
- font: SourceCodePro-Medium.ttf
36
-
37
- - type: Medium Italic
38
- font: SourceCodePro-MediumIt.ttf
39
-
40
- - type: Regular
41
- font: SourceCodePro-Regular.ttf
42
-
43
- - type: Semibold
44
- font: SourceCodePro-Semibold.ttf
45
-
46
- - type: Semibold Italic
47
- font: SourceCodePro-SemiboldIt.ttf
48
-
49
- - name: Source Sans Pro
50
- styles:
51
- - type: Black
52
- font: SourceSansPro-Black.ttf
53
-
54
- - type: Black Italic
55
- font: SourceSansPro-BlackIt.ttf
56
-
57
- - type: Bold
58
- font: SourceSansPro-Bold.ttf
59
-
60
- - type: Bold Italic
61
- font: SourceSansPro-BoldIt.ttf
62
-
63
- - type: Extra Light
64
- font: SourceSansPro-ExtraLight.ttf
65
-
66
- - type: ExtraLightIt
67
- font: SourceSansPro-ExtraLightIt.ttf
68
-
69
- - type: Italic
70
- font: SourceSansPro-It.ttf
71
-
72
- - type: Light
73
- font: SourceSansPro-Light.ttf
74
-
75
- - type: Light Italic
76
- font: SourceSansPro-LightIt.ttf
77
-
78
- - type: Medium
79
- font: SourceSansPro-Medium.ttf
80
-
81
- - type: Medium Italic
82
- font: SourceSansPro-MediumIt.ttf
83
-
84
- - type: Regular
85
- font: SourceSansPro-Regular.ttf
86
-
87
- - type: Semibold
88
- font: SourceSansPro-Semibold.ttf
89
-
90
- - type: Semibold Italic
91
- font: SourceSansPro-SemiboldIt.ttf
92
-
93
- - name: Source Serif Pro
94
- styles:
95
- - type: Black
96
- font: SourceSerifPro-Black.ttf
97
-
98
- - type: Black Italic
99
- font: SourceSerifPro-BlackIt.ttf
100
-
101
- - type: Bold
102
- font: SourceSerifPro-Bold.ttf
103
-
104
- - type: Bold Italic
105
- font: SourceSerifPro-BoldIt.ttf
106
-
107
- - type: Extra Light
108
- font: SourceSerifPro-ExtraLight.ttf
109
-
110
- - type: ExtraLightIt
111
- font: SourceSerifPro-ExtraLightIt.ttf
112
-
113
- - type: Italic
114
- font: SourceSerifPro-It.ttf
115
-
116
- - type: Light
117
- font: SourceSerifPro-Light.ttf
118
-
119
- - type: Light Italic
120
- font: SourceSerifPro-LightIt.ttf
121
-
122
- - type: Medium
123
- font: SourceSerifPro-Medium.ttf
124
-
125
- - type: Medium Italic
126
- font: SourceSerifPro-MediumIt.ttf
127
-
128
- - type: Regular
129
- font: SourceSerifPro-Regular.ttf
130
-
131
- - type: Semibold
132
- font: SourceSerifPro-Semibold.ttf
133
-
134
- - type: Semibold Italic
135
- font: SourceSerifPro-SemiboldIt.ttf
136
-
137
- - name: Source Han Sans
138
- styles:
139
- - type: Regular
140
- font: SourceHanSans-Regular.ttc
141
-
142
- - type: Normal
143
- font: SourceHanSans-Normal.ttc
144
-
145
- - type: Bold
146
- font: SourceHanSans-Bold.ttc
147
-
148
- - type: ExtraLight
149
- font: SourceHanSans-ExtraLight.ttc
150
-
151
- - type: Heavy
152
- font: SourceHanSans-Heavy.ttc
153
-
154
- - type: Light
155
- font: SourceHanSans-Light.ttc
156
-
157
- - type: Medium
158
- font: SourceHanSans-Medium.ttc
159
-
160
- file_size: "101440249"
161
- sha: "0107b5d4ba305cb4dff2ba19138407aa2153632a2c41592f74d20cd0d0261bfd"
162
- urls:
163
- - https://github.com/fontist/source-fonts/releases/download/v1.0/source-fonts-1.0.zip
@@ -1,70 +0,0 @@
1
- require "down"
2
- require "digest"
3
-
4
- module Fontist
5
- class Downloader
6
- def initialize(file, file_size: nil, sha: nil, progress: nil)
7
- @sha = sha
8
- @file = file
9
- @progress = progress
10
- @file_size = (file_size || default_file_size).to_i
11
- end
12
-
13
- def download
14
- file = download_file
15
- verify_file_checksum(file) || raise_invalid_file
16
- end
17
-
18
- def verify_file_checksum(file)
19
- file if Digest::SHA256.file(file) === sha
20
- end
21
-
22
- def raise_invalid_file
23
- raise(Fontist::Errors::TemparedFileError)
24
- end
25
-
26
- def self.download(file, options = {})
27
- new(file, options).download
28
- end
29
-
30
- private
31
-
32
- attr_reader :file, :sha, :file_size
33
-
34
- def default_file_size
35
- 5 * byte_to_megabyte
36
- end
37
-
38
- def byte_to_megabyte
39
- @byte_to_megabyte ||= 1024 * 1024
40
- end
41
-
42
- def download_path
43
- options[:download_path] || Fontist.root_path.join("tmp")
44
- end
45
-
46
- def download_file
47
- bar = ProgressBar.new(file_size / byte_to_megabyte)
48
-
49
- Down.download(
50
- @file,
51
- progress_proc: -> (progress) {
52
- bar.increment(progress / byte_to_megabyte) if @progress === true
53
- }
54
- )
55
- end
56
- end
57
-
58
- class ProgressBar
59
- def initialize(total)
60
- @counter = 1
61
- @total = total
62
- end
63
-
64
- def increment(progress)
65
- complete = sprintf("%#.2f%%", ((@counter.to_f / @total.to_f) * 100))
66
- print "\r\e[0KDownloads: #{@counter}MB/#{@total}MB (#{complete})"
67
- @counter = progress
68
- end
69
- end
70
- end