lib/ttfunk/table/sbix.rb in ttfunk-1.6.2.1 vs lib/ttfunk/table/sbix.rb in ttfunk-1.7.0
- old
+ new
@@ -19,11 +19,11 @@
glyph_offset = strike[:glyph_data_offset][glyph_id]
next_glyph_offset = strike[:glyph_data_offset][glyph_id + 1]
if glyph_offset && next_glyph_offset
bytes = next_glyph_offset - glyph_offset
- if bytes > 0
+ if bytes.positive?
parse_from(offset + strike[:offset] + glyph_offset) do
x, y, type = read(8, 's2A4')
data = StringIO.new(io.read(bytes - 8))
BitmapData.new(
x, y, type, data, strike[:ppem], strike[:resolution]
@@ -43,23 +43,25 @@
def parse!
@version, @flags, @num_strikes = read(8, 'n2N')
strike_offsets = Array.new(num_strikes) { read(4, 'N').first }
- @strikes = strike_offsets.map do |strike_offset|
- parse_from(offset + strike_offset) do
- ppem, resolution = read(4, 'n2')
- data_offsets = Array.new(file.maximum_profile.num_glyphs + 1) do
- read(4, 'N').first
+ @strikes =
+ strike_offsets.map do |strike_offset|
+ parse_from(offset + strike_offset) do
+ ppem, resolution = read(4, 'n2')
+ data_offsets =
+ Array.new(file.maximum_profile.num_glyphs + 1) do
+ read(4, 'N').first
+ end
+ {
+ ppem: ppem,
+ resolution: resolution,
+ offset: strike_offset,
+ glyph_data_offset: data_offsets
+ }
end
- {
- ppem: ppem,
- resolution: resolution,
- offset: strike_offset,
- glyph_data_offset: data_offsets
- }
end
- end
end
end
end
end