fontisan 0.1.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 (56) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +13 -0
  4. data/.rubocop_todo.yml +217 -0
  5. data/Gemfile +15 -0
  6. data/LICENSE +24 -0
  7. data/README.adoc +984 -0
  8. data/Rakefile +95 -0
  9. data/exe/fontisan +7 -0
  10. data/fontisan.gemspec +44 -0
  11. data/lib/fontisan/binary/base_record.rb +57 -0
  12. data/lib/fontisan/binary/structures.rb +84 -0
  13. data/lib/fontisan/cli.rb +192 -0
  14. data/lib/fontisan/commands/base_command.rb +82 -0
  15. data/lib/fontisan/commands/dump_table_command.rb +71 -0
  16. data/lib/fontisan/commands/features_command.rb +94 -0
  17. data/lib/fontisan/commands/glyphs_command.rb +50 -0
  18. data/lib/fontisan/commands/info_command.rb +120 -0
  19. data/lib/fontisan/commands/optical_size_command.rb +41 -0
  20. data/lib/fontisan/commands/scripts_command.rb +59 -0
  21. data/lib/fontisan/commands/tables_command.rb +52 -0
  22. data/lib/fontisan/commands/unicode_command.rb +76 -0
  23. data/lib/fontisan/commands/variable_command.rb +61 -0
  24. data/lib/fontisan/config/features.yml +143 -0
  25. data/lib/fontisan/config/scripts.yml +42 -0
  26. data/lib/fontisan/constants.rb +78 -0
  27. data/lib/fontisan/error.rb +15 -0
  28. data/lib/fontisan/font_loader.rb +109 -0
  29. data/lib/fontisan/formatters/text_formatter.rb +314 -0
  30. data/lib/fontisan/models/all_scripts_features_info.rb +21 -0
  31. data/lib/fontisan/models/features_info.rb +42 -0
  32. data/lib/fontisan/models/font_info.rb +99 -0
  33. data/lib/fontisan/models/glyph_info.rb +26 -0
  34. data/lib/fontisan/models/optical_size_info.rb +33 -0
  35. data/lib/fontisan/models/scripts_info.rb +39 -0
  36. data/lib/fontisan/models/table_info.rb +55 -0
  37. data/lib/fontisan/models/unicode_mappings.rb +42 -0
  38. data/lib/fontisan/models/variable_font_info.rb +82 -0
  39. data/lib/fontisan/open_type_collection.rb +97 -0
  40. data/lib/fontisan/open_type_font.rb +292 -0
  41. data/lib/fontisan/parsers/tag.rb +77 -0
  42. data/lib/fontisan/tables/cmap.rb +284 -0
  43. data/lib/fontisan/tables/fvar.rb +157 -0
  44. data/lib/fontisan/tables/gpos.rb +111 -0
  45. data/lib/fontisan/tables/gsub.rb +111 -0
  46. data/lib/fontisan/tables/head.rb +114 -0
  47. data/lib/fontisan/tables/layout_common.rb +73 -0
  48. data/lib/fontisan/tables/name.rb +188 -0
  49. data/lib/fontisan/tables/os2.rb +175 -0
  50. data/lib/fontisan/tables/post.rb +148 -0
  51. data/lib/fontisan/true_type_collection.rb +98 -0
  52. data/lib/fontisan/true_type_font.rb +313 -0
  53. data/lib/fontisan/utilities/checksum_calculator.rb +89 -0
  54. data/lib/fontisan/version.rb +5 -0
  55. data/lib/fontisan.rb +80 -0
  56. metadata +150 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c8b32da5e8f80b260886e7b152d30a661fc62fd4b78b7dcd8a0efb002052e5ca
4
+ data.tar.gz: 81c1a1de4b070f4e76fc83ee71f748432362b5e12d873ad39447c32116eaf5d3
5
+ SHA512:
6
+ metadata.gz: d121f479798f3ab42f1c05b8d79a957ee2fd1955a66e826c347b42a0e54e1f3045682ba6c6c6e9682507db6e2fec158109ccca1d92cec44dc90c3939ad580ceb
7
+ data.tar.gz: b6504de4f5043fad535ddd29c38dc0cb491670218c58529bbe3d7ac1b7e17bcf338b8c6ab70b6ea4c5bd19c84fa994ce33753d9fedba338fa23e4911bdd3373b
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ inherit_from:
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ - .rubocop_todo.yml
6
+
7
+ # local repo-specific modifications
8
+ # ...
9
+
10
+ plugins:
11
+ - rubocop-performance
12
+ - rubocop-rake
13
+ - rubocop-rspec
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,217 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-11-08 05:30:55 UTC using RuboCop version 1.81.7.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 7
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
+ Bundler/OrderedGems:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 1
17
+ # Configuration parameters: Severity.
18
+ Gemspec/RequiredRubyVersion:
19
+ Exclude:
20
+ - 'fontisan.gemspec'
21
+
22
+ # Offense count: 2
23
+ # This cop supports safe autocorrection (--autocorrect).
24
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
25
+ # SupportedStyles: with_first_argument, with_fixed_indentation
26
+ Layout/ArgumentAlignment:
27
+ Exclude:
28
+ - 'lib/fontisan/tables/cmap.rb'
29
+
30
+ # Offense count: 2
31
+ # This cop supports safe autocorrection (--autocorrect).
32
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
33
+ # SupportedStyles: with_first_element, with_fixed_indentation
34
+ Layout/ArrayAlignment:
35
+ Exclude:
36
+ - 'spec/fontisan/commands/base_command_spec.rb'
37
+
38
+ # Offense count: 1
39
+ # This cop supports safe autocorrection (--autocorrect).
40
+ # Configuration parameters: EnforcedStyleAlignWith.
41
+ # SupportedStylesAlignWith: either, start_of_block, start_of_line
42
+ Layout/BlockAlignment:
43
+ Exclude:
44
+ - 'spec/fontisan/commands/base_command_spec.rb'
45
+
46
+ # Offense count: 1
47
+ # This cop supports safe autocorrection (--autocorrect).
48
+ Layout/BlockEndNewline:
49
+ Exclude:
50
+ - 'spec/fontisan/commands/base_command_spec.rb'
51
+
52
+ # Offense count: 2
53
+ # This cop supports safe autocorrection (--autocorrect).
54
+ # Configuration parameters: Width, AllowedPatterns.
55
+ Layout/IndentationWidth:
56
+ Exclude:
57
+ - 'spec/fontisan/commands/base_command_spec.rb'
58
+
59
+ # Offense count: 94
60
+ # This cop supports safe autocorrection (--autocorrect).
61
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
62
+ # URISchemes: http, https
63
+ Layout/LineLength:
64
+ Enabled: false
65
+
66
+ # Offense count: 4
67
+ # This cop supports safe autocorrection (--autocorrect).
68
+ # Configuration parameters: AllowInHeredoc.
69
+ Layout/TrailingWhitespace:
70
+ Exclude:
71
+ - 'lib/fontisan/tables/cmap.rb'
72
+ - 'spec/fontisan/commands/base_command_spec.rb'
73
+
74
+ # Offense count: 3
75
+ # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
76
+ Lint/DuplicateBranch:
77
+ Exclude:
78
+ - 'lib/fontisan/commands/base_command.rb'
79
+ - 'lib/fontisan/commands/dump_table_command.rb'
80
+ - 'lib/fontisan/tables/name.rb'
81
+
82
+ # Offense count: 1
83
+ # This cop supports safe autocorrection (--autocorrect).
84
+ # Configuration parameters: AllowComments.
85
+ Lint/EmptyConditionalBody:
86
+ Exclude:
87
+ - 'lib/fontisan/cli.rb'
88
+
89
+ # Offense count: 2
90
+ Lint/FloatComparison:
91
+ Exclude:
92
+ - 'lib/fontisan/tables/post.rb'
93
+
94
+ # Offense count: 47
95
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
96
+ Metrics/AbcSize:
97
+ Enabled: false
98
+
99
+ # Offense count: 3
100
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
101
+ # AllowedMethods: refine
102
+ Metrics/BlockLength:
103
+ Max: 67
104
+
105
+ # Offense count: 14
106
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
107
+ Metrics/CyclomaticComplexity:
108
+ Exclude:
109
+ - 'lib/fontisan/commands/info_command.rb'
110
+ - 'lib/fontisan/commands/unicode_command.rb'
111
+ - 'lib/fontisan/font_loader.rb'
112
+ - 'lib/fontisan/formatters/text_formatter.rb'
113
+ - 'lib/fontisan/open_type_font.rb'
114
+ - 'lib/fontisan/tables/fvar.rb'
115
+ - 'lib/fontisan/tables/gpos.rb'
116
+ - 'lib/fontisan/tables/gsub.rb'
117
+ - 'lib/fontisan/tables/name.rb'
118
+ - 'lib/fontisan/tables/post.rb'
119
+ - 'spec/fontisan/tables/post_spec.rb'
120
+
121
+ # Offense count: 42
122
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
123
+ Metrics/MethodLength:
124
+ Max: 37
125
+
126
+ # Offense count: 3
127
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
128
+ Metrics/ParameterLists:
129
+ Max: 39
130
+
131
+ # Offense count: 7
132
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
133
+ Metrics/PerceivedComplexity:
134
+ Exclude:
135
+ - 'lib/fontisan/tables/gpos.rb'
136
+ - 'lib/fontisan/tables/gsub.rb'
137
+ - 'lib/fontisan/tables/name.rb'
138
+ - 'spec/fontisan/tables/post_spec.rb'
139
+
140
+ # Offense count: 2
141
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
142
+ # SupportedStyles: snake_case, normalcase, non_integer
143
+ # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
144
+ Naming/VariableNumber:
145
+ Exclude:
146
+ - 'lib/fontisan/tables/cmap.rb'
147
+
148
+ # Offense count: 15
149
+ # Configuration parameters: MinSize.
150
+ Performance/CollectionLiteralInLoop:
151
+ Exclude:
152
+ - 'lib/fontisan/open_type_font.rb'
153
+ - 'lib/fontisan/true_type_font.rb'
154
+ - 'spec/fontisan/cli_spec.rb'
155
+ - 'spec/fontisan/commands/glyphs_command_spec.rb'
156
+ - 'spec/fontisan/commands/info_command_spec.rb'
157
+ - 'spec/fontisan/commands/tables_command_spec.rb'
158
+
159
+ # Offense count: 1
160
+ # Configuration parameters: Prefixes, AllowedPatterns.
161
+ # Prefixes: when, with, without
162
+ RSpec/ContextWording:
163
+ Exclude:
164
+ - 'spec/fontisan/commands/scripts_command_spec.rb'
165
+
166
+ # Offense count: 76
167
+ # Configuration parameters: CountAsOne.
168
+ RSpec/ExampleLength:
169
+ Max: 66
170
+
171
+ # Offense count: 1
172
+ RSpec/MultipleDescribes:
173
+ Exclude:
174
+ - 'spec/fontisan/models/table_info_spec.rb'
175
+
176
+ # Offense count: 151
177
+ RSpec/MultipleExpectations:
178
+ Max: 16
179
+
180
+ # Offense count: 1
181
+ # Configuration parameters: AllowedGroups.
182
+ RSpec/NestedGroups:
183
+ Max: 4
184
+
185
+ # Offense count: 7
186
+ RSpec/RepeatedExample:
187
+ Exclude:
188
+ - 'spec/fontisan/tables/os2_spec.rb'
189
+
190
+ # Offense count: 1
191
+ Rake/MethodDefinitionInTask:
192
+ Exclude:
193
+ - 'Rakefile'
194
+
195
+ # Offense count: 1
196
+ Security/Open:
197
+ Exclude:
198
+ - 'Rakefile'
199
+
200
+ # Offense count: 1
201
+ # This cop supports safe autocorrection (--autocorrect).
202
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
203
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
204
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
205
+ # FunctionalMethods: let, let!, subject, watch
206
+ # AllowedMethods: lambda, proc, it
207
+ Style/BlockDelimiters:
208
+ Exclude:
209
+ - 'spec/fontisan/commands/base_command_spec.rb'
210
+
211
+ # Offense count: 2
212
+ # This cop supports safe autocorrection (--autocorrect).
213
+ # Configuration parameters: EnforcedStyle, MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
214
+ # SupportedStyles: annotated, template, unannotated
215
+ Style/FormatStringToken:
216
+ Exclude:
217
+ - 'lib/fontisan/formatters/text_formatter.rb'
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in fontisan.gemspec
6
+ gemspec
7
+
8
+ gem "openssl"
9
+ gem "rake"
10
+ gem "rspec"
11
+ gem "rubocop"
12
+ gem "rubocop-performance"
13
+ gem "rubocop-rake"
14
+ gem "rubocop-rspec"
15
+ gem "rubyzip"
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2025, Ribose Inc.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.