fontisan 0.2.9 → 0.2.10
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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +9 -10
- data/lib/fontisan/sfnt_font.rb +9 -18
- data/lib/fontisan/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 56f9d8ef4cfdc6eff4a70e8a6c658d276342e2ef11a272e2ba4e683fa8b1ce6e
|
|
4
|
+
data.tar.gz: a6a0102247dbd1069785afab4b296bc2ade281be5e81526aa3e89029ca61ac56
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f8e8b4df368e19a52bf9c3bc3c2e0d58cb33f7d2235c67b5f077abfa2a4ca1b2e00c21b29d9c56e72cbb167d43b178d295bc95676518c9de7d0c66a3fbc52383
|
|
7
|
+
data.tar.gz: 7e42e9a834e044c5577523a22a32d79eb92a32769e244c24c1b52cfe6242a2dbb4da0370e536abc8e66cbdfb38ee5eecc53e68e238a643902dc06105d08ac62c
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-01-17
|
|
3
|
+
# on 2026-01-17 04:54:25 UTC using RuboCop version 1.82.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -11,6 +11,13 @@ Gemspec/RequiredRubyVersion:
|
|
|
11
11
|
Exclude:
|
|
12
12
|
- 'fontisan.gemspec'
|
|
13
13
|
|
|
14
|
+
# Offense count: 2
|
|
15
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
16
|
+
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
|
17
|
+
Layout/ExtraSpacing:
|
|
18
|
+
Exclude:
|
|
19
|
+
- 'lib/fontisan/sfnt_font.rb'
|
|
20
|
+
|
|
14
21
|
# Offense count: 1259
|
|
15
22
|
# This cop supports safe autocorrection (--autocorrect).
|
|
16
23
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
@@ -111,7 +118,7 @@ Metrics/BlockNesting:
|
|
|
111
118
|
Metrics/CyclomaticComplexity:
|
|
112
119
|
Enabled: false
|
|
113
120
|
|
|
114
|
-
# Offense count:
|
|
121
|
+
# Offense count: 785
|
|
115
122
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
116
123
|
Metrics/MethodLength:
|
|
117
124
|
Max: 135
|
|
@@ -127,14 +134,6 @@ Metrics/ParameterLists:
|
|
|
127
134
|
Metrics/PerceivedComplexity:
|
|
128
135
|
Enabled: false
|
|
129
136
|
|
|
130
|
-
# Offense count: 1
|
|
131
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
132
|
-
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
|
133
|
-
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
|
134
|
-
Naming/MemoizedInstanceVariableName:
|
|
135
|
-
Exclude:
|
|
136
|
-
- 'lib/fontisan/sfnt_font.rb'
|
|
137
|
-
|
|
138
137
|
# Offense count: 17
|
|
139
138
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
|
140
139
|
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
data/lib/fontisan/sfnt_font.rb
CHANGED
|
@@ -135,6 +135,9 @@ module Fontisan
|
|
|
135
135
|
Constants::LOCA_TAG => Tables::LocaTable,
|
|
136
136
|
}.freeze
|
|
137
137
|
|
|
138
|
+
# Padding bytes for table alignment (frozen to avoid reallocation)
|
|
139
|
+
PADDING_BYTES = ("\x00" * 4).freeze
|
|
140
|
+
|
|
138
141
|
# Read SFNT Font from a file
|
|
139
142
|
#
|
|
140
143
|
# @param path [String] Path to the font file
|
|
@@ -200,14 +203,11 @@ module Fontisan
|
|
|
200
203
|
@parsed_tables = {}
|
|
201
204
|
@sfnt_tables = {}
|
|
202
205
|
@table_entry_cache = {}
|
|
203
|
-
@tag_encoding_cache = {}
|
|
204
|
-
@
|
|
206
|
+
@tag_encoding_cache = {} # Cache for normalized tag encodings
|
|
207
|
+
@table_names = nil # Cache for table names array
|
|
205
208
|
@loading_mode = LoadingModes::FULL
|
|
206
209
|
@lazy_load_enabled = false
|
|
207
210
|
@io_source = nil
|
|
208
|
-
|
|
209
|
-
# Pre-build table entry cache for O(1) lookups
|
|
210
|
-
build_table_entry_cache
|
|
211
211
|
end
|
|
212
212
|
|
|
213
213
|
# Read table data for all tables in the font
|
|
@@ -447,13 +447,13 @@ module Fontisan
|
|
|
447
447
|
end
|
|
448
448
|
end
|
|
449
449
|
|
|
450
|
+
# Return cached if available (fast path)
|
|
450
451
|
return @parsed_tables[tag] if @parsed_tables.key?(tag)
|
|
451
452
|
|
|
452
453
|
# Lazy load table data if enabled
|
|
453
|
-
if @lazy_load_enabled && !@table_data.key?(tag)
|
|
454
|
-
load_table_data(tag)
|
|
455
|
-
end
|
|
454
|
+
load_table_data(tag) if @lazy_load_enabled && !@table_data.key?(tag)
|
|
456
455
|
|
|
456
|
+
# Parse and cache
|
|
457
457
|
@parsed_tables[tag] ||= parse_table(tag)
|
|
458
458
|
end
|
|
459
459
|
|
|
@@ -570,15 +570,6 @@ module Fontisan
|
|
|
570
570
|
|
|
571
571
|
private
|
|
572
572
|
|
|
573
|
-
# Build table entry cache for O(1) lookups
|
|
574
|
-
#
|
|
575
|
-
# @return [void]
|
|
576
|
-
def build_table_entry_cache
|
|
577
|
-
tables.each do |entry|
|
|
578
|
-
@table_entry_cache[entry.tag] = entry
|
|
579
|
-
end
|
|
580
|
-
end
|
|
581
|
-
|
|
582
573
|
# Normalize tag encoding to UTF-8 (cached for performance)
|
|
583
574
|
#
|
|
584
575
|
# @param tag [String] The tag to normalize
|
|
@@ -675,7 +666,7 @@ module Fontisan
|
|
|
675
666
|
|
|
676
667
|
# Add padding to align to 4-byte boundary
|
|
677
668
|
padding = (Constants::TABLE_ALIGNMENT - (io.pos % Constants::TABLE_ALIGNMENT)) % Constants::TABLE_ALIGNMENT
|
|
678
|
-
io.write(
|
|
669
|
+
io.write(PADDING_BYTES[0, padding]) if padding.positive?
|
|
679
670
|
|
|
680
671
|
# Zero out checksumAdjustment field in head table
|
|
681
672
|
if entry.tag == Constants::HEAD_TAG
|
data/lib/fontisan/version.rb
CHANGED