Skip to content

Commit

Permalink
Fix rubocop Style/AccessorGrouping cop
Browse files Browse the repository at this point in the history
  • Loading branch information
ShockwaveNN committed Nov 20, 2020
1 parent c0f62e8 commit a16fb67
Show file tree
Hide file tree
Showing 28 changed files with 28 additions and 176 deletions.
7 changes: 0 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ Performance/CollectionLiteralInLoop:
RSpec/MultipleMemoizedHelpers:
Max: 21

# Offense count: 164
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: separated, grouped
Style/AccessorGrouping:
Enabled: false

# Offense count: 3
# Configuration parameters: MinBranchesCount.
Style/HashLikeCase:
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

module TTFunk
class File
attr_reader :contents
attr_reader :directory
attr_reader :contents, :directory

def self.open(io_or_path)
new verify_and_open(io_or_path).read
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/directory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

module TTFunk
class Directory
attr_reader :tables
attr_reader :scaler_type
attr_reader :tables, :scaler_type

def initialize(io, offset = 0)
io.seek(offset)
Expand Down
4 changes: 1 addition & 3 deletions lib/ttfunk/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ module TTFunk
class Table
include Reader

attr_reader :file
attr_reader :offset
attr_reader :length
attr_reader :file, :offset, :length

def initialize(file)
@file = file
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class Cff < TTFunk::Table

TAG = 'CFF ' # the extra space is important

attr_reader :header, :name_index, :top_index, :string_index
attr_reader :global_subr_index
attr_reader :header, :name_index, :top_index, :string_index, :global_subr_index

def tag
TAG
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cff/charset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def strings_for_charset_id(charset_id)
end
end

attr_reader :entries, :length
attr_reader :top_dict, :format, :count, :offset_or_id
attr_reader :entries, :length, :top_dict, :format, :count, :offset_or_id

def initialize(top_dict, file, offset_or_id = nil, length = nil)
@top_dict = top_dict
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cff/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class Index < TTFunk::SubTable
# offset array element size
attr_reader :offset_size

attr_reader :raw_offset_length, :offsets, :raw_data
attr_reader :data_start_pos
attr_reader :raw_offset_length, :offsets, :raw_data, :data_start_pos

def [](index)
entry_cache[index] ||= raw_data[
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
module TTFunk
class Table
class Cmap < Table
attr_reader :version
attr_reader :tables
attr_reader :version, :tables

def self.encode(charmap, encoding)
result = Cmap::Subtable.encode(charmap, encoding)
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cmap/format00.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module TTFunk
class Table
class Cmap
module Format00
attr_reader :language
attr_reader :code_map
attr_reader :language, :code_map

# Expects a hash mapping character codes to glyph ids (where the
# glyph ids are from the original font). Returns a hash including
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cmap/format04.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module TTFunk
class Table
class Cmap
module Format04
attr_reader :language
attr_reader :code_map
attr_reader :language, :code_map

# Expects a hash mapping character codes to glyph ids (where the
# glyph ids are from the original font). Returns a hash including
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cmap/format06.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module TTFunk
class Table
class Cmap
module Format06
attr_reader :language
attr_reader :code_map
attr_reader :language, :code_map

def self.encode(charmap)
next_id = 0
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cmap/format10.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module TTFunk
class Table
class Cmap
module Format10
attr_reader :language
attr_reader :code_map
attr_reader :language, :code_map

def self.encode(charmap)
next_id = 0
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/cmap/format12.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module TTFunk
class Table
class Cmap
module Format12
attr_reader :language
attr_reader :code_map
attr_reader :language, :code_map

def self.encode(charmap)
next_id = 0
Expand Down
4 changes: 1 addition & 3 deletions lib/ttfunk/table/cmap/subtable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ class Cmap
class Subtable
include Reader

attr_reader :platform_id
attr_reader :encoding_id
attr_reader :format
attr_reader :platform_id, :encoding_id, :format

ENCODING_MAPPINGS = {
mac_roman: { platform_id: 1, encoding_id: 0 }.freeze,
Expand Down
5 changes: 1 addition & 4 deletions lib/ttfunk/table/glyf/compound.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ class Compound
WE_HAVE_A_TWO_BY_TWO = 0x0080
WE_HAVE_INSTRUCTIONS = 0x0100

attr_reader :id, :raw
attr_reader :number_of_contours
attr_reader :x_min, :y_min, :x_max, :y_max
attr_reader :glyph_ids
attr_reader :id, :raw, :number_of_contours, :x_min, :y_min, :x_max, :y_max, :glyph_ids

Component = Struct.new(:flags, :glyph_index, :arg1, :arg2, :transform)

Expand Down
4 changes: 1 addition & 3 deletions lib/ttfunk/table/glyf/path_based.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ module TTFunk
class Table
class Glyf
class PathBased
attr_reader :path, :horizontal_metrics
attr_reader :x_min, :y_min, :x_max, :y_max
attr_reader :left_side_bearing, :right_side_bearing
attr_reader :path, :horizontal_metrics, :x_min, :y_min, :x_max, :y_max, :left_side_bearing, :right_side_bearing

def initialize(path, horizontal_metrics)
@path = path
Expand Down
6 changes: 1 addition & 5 deletions lib/ttfunk/table/glyf/simple.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ module TTFunk
class Table
class Glyf
class Simple
attr_reader :id, :raw
attr_reader :number_of_contours
attr_reader :x_min, :y_min, :x_max, :y_max
attr_reader :end_points_of_contours
attr_reader :instruction_length, :instructions
attr_reader :id, :raw, :number_of_contours, :x_min, :y_min, :x_max, :y_max, :end_points_of_contours, :instruction_length, :instructions

def initialize(id, raw)
@id = id
Expand Down
18 changes: 1 addition & 17 deletions lib/ttfunk/table/head.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,7 @@
module TTFunk
class Table
class Head < TTFunk::Table
attr_reader :version
attr_reader :font_revision
attr_reader :checksum_adjustment
attr_reader :magic_number
attr_reader :flags
attr_reader :units_per_em
attr_reader :created
attr_reader :modified
attr_reader :x_min
attr_reader :y_min
attr_reader :x_max
attr_reader :y_max
attr_reader :mac_style
attr_reader :lowest_rec_ppem
attr_reader :font_direction_hint
attr_reader :index_to_loc_format
attr_reader :glyph_data_format
attr_reader :version, :font_revision, :checksum_adjustment, :magic_number, :flags, :units_per_em, :created, :modified, :x_min, :y_min, :x_max, :y_max, :mac_style, :lowest_rec_ppem, :font_direction_hint, :index_to_loc_format, :glyph_data_format

class << self
# mapping is new -> old glyph ids
Expand Down
14 changes: 1 addition & 13 deletions lib/ttfunk/table/hhea.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,7 @@
module TTFunk
class Table
class Hhea < Table
attr_reader :version
attr_reader :ascent
attr_reader :descent
attr_reader :line_gap
attr_reader :advance_width_max
attr_reader :min_left_side_bearing
attr_reader :min_right_side_bearing
attr_reader :x_max_extent
attr_reader :carot_slope_rise
attr_reader :carot_slope_run
attr_reader :caret_offset
attr_reader :metric_data_format
attr_reader :number_of_metrics
attr_reader :version, :ascent, :descent, :line_gap, :advance_width_max, :min_left_side_bearing, :min_right_side_bearing, :x_max_extent, :carot_slope_rise, :carot_slope_run, :caret_offset, :metric_data_format, :number_of_metrics

class << self
def encode(hhea, hmtx, original, mapping)
Expand Down
4 changes: 1 addition & 3 deletions lib/ttfunk/table/hmtx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
module TTFunk
class Table
class Hmtx < Table
attr_reader :metrics
attr_reader :left_side_bearings
attr_reader :widths
attr_reader :metrics, :left_side_bearings, :widths

def self.encode(hmtx, mapping)
metrics = mapping.keys.sort.map do |new_id|
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/kern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
module TTFunk
class Table
class Kern < Table
attr_reader :version
attr_reader :tables
attr_reader :version, :tables

def self.encode(kerning, mapping)
return nil unless kerning.exists? && kerning.tables.any?
Expand Down
3 changes: 1 addition & 2 deletions lib/ttfunk/table/kern/format0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class Kern
class Format0
include Reader

attr_reader :attributes
attr_reader :pairs
attr_reader :attributes, :pairs

def initialize(attributes = {})
@attributes = attributes
Expand Down
16 changes: 1 addition & 15 deletions lib/ttfunk/table/maxp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@
module TTFunk
class Table
class Maxp < Table
attr_reader :version
attr_reader :num_glyphs
attr_reader :max_points
attr_reader :max_contours
attr_reader :max_component_points
attr_reader :max_component_contours
attr_reader :max_zones
attr_reader :max_twilight_points
attr_reader :max_storage
attr_reader :max_function_defs
attr_reader :max_instruction_defs
attr_reader :max_stack_elements
attr_reader :max_size_of_instructions
attr_reader :max_component_elements
attr_reader :max_component_depth
attr_reader :version, :num_glyphs, :max_points, :max_contours, :max_component_points, :max_component_contours, :max_zones, :max_twilight_points, :max_storage, :max_function_defs, :max_instruction_defs, :max_stack_elements, :max_size_of_instructions, :max_component_elements, :max_component_depth

def self.encode(maxp, mapping)
num_glyphs = mapping.length
Expand Down
26 changes: 2 additions & 24 deletions lib/ttfunk/table/name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ module TTFunk
class Table
class Name < Table
class NameString < ::String
attr_reader :platform_id
attr_reader :encoding_id
attr_reader :language_id
attr_reader :platform_id, :encoding_id, :language_id

def initialize(text, platform_id, encoding_id, language_id)
super(text)
Expand All @@ -25,27 +23,7 @@ def strip_extended
end
end

attr_reader :entries
attr_reader :strings

attr_reader :copyright
attr_reader :font_family
attr_reader :font_subfamily
attr_reader :unique_subfamily
attr_reader :font_name
attr_reader :version
attr_reader :trademark
attr_reader :manufacturer
attr_reader :designer
attr_reader :description
attr_reader :vendor_url
attr_reader :designer_url
attr_reader :license
attr_reader :license_url
attr_reader :preferred_family
attr_reader :preferred_subfamily
attr_reader :compatible_full
attr_reader :sample_text
attr_reader :entries, :strings, :copyright, :font_family, :font_subfamily, :unique_subfamily, :font_name, :version, :trademark, :manufacturer, :designer, :description, :vendor_url, :designer_url, :license, :license_url, :preferred_family, :preferred_subfamily, :compatible_full, :sample_text

COPYRIGHT_NAME_ID = 0
FONT_FAMILY_NAME_ID = 1
Expand Down
37 changes: 1 addition & 36 deletions lib/ttfunk/table/os2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,7 @@
module TTFunk
class Table
class OS2 < Table
attr_reader :version

attr_reader :ave_char_width
attr_reader :weight_class
attr_reader :width_class
attr_reader :type
attr_reader :y_subscript_x_size
attr_reader :y_subscript_y_size
attr_reader :y_subscript_x_offset
attr_reader :y_subscript_y_offset
attr_reader :y_superscript_x_size
attr_reader :y_superscript_y_size
attr_reader :y_superscript_x_offset
attr_reader :y_superscript_y_offset
attr_reader :y_strikeout_size
attr_reader :y_strikeout_position
attr_reader :family_class
attr_reader :panose
attr_reader :char_range
attr_reader :vendor_id
attr_reader :selection
attr_reader :first_char_index
attr_reader :last_char_index

attr_reader :ascent
attr_reader :descent
attr_reader :line_gap
attr_reader :win_ascent
attr_reader :win_descent
attr_reader :code_page_range

attr_reader :x_height
attr_reader :cap_height
attr_reader :default_char
attr_reader :break_char
attr_reader :max_context
attr_reader :version, :ave_char_width, :weight_class, :width_class, :type, :y_subscript_x_size, :y_subscript_y_size, :y_subscript_x_offset, :y_subscript_y_offset, :y_superscript_x_size, :y_superscript_y_size, :y_superscript_x_offset, :y_superscript_y_offset, :y_strikeout_size, :y_strikeout_position, :family_class, :panose, :char_range, :vendor_id, :selection, :first_char_index, :last_char_index, :ascent, :descent, :line_gap, :win_ascent, :win_descent, :code_page_range, :x_height, :cap_height, :default_char, :break_char, :max_context

CODE_PAGE_BITS = {
1252 => 0, 1250 => 1, 1251 => 2, 1253 => 3, 1254 => 4,
Expand Down
12 changes: 1 addition & 11 deletions lib/ttfunk/table/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@
module TTFunk
class Table
class Post < Table
attr_reader :format
attr_reader :italic_angle
attr_reader :underline_position
attr_reader :underline_thickness
attr_reader :fixed_pitch
attr_reader :min_mem_type42
attr_reader :max_mem_type42
attr_reader :min_mem_type1
attr_reader :max_mem_type1

attr_reader :subtable
attr_reader :format, :italic_angle, :underline_position, :underline_thickness, :fixed_pitch, :min_mem_type42, :max_mem_type42, :min_mem_type1, :max_mem_type1, :subtable

def self.encode(post, mapping)
return nil unless post.exists?
Expand Down
5 changes: 1 addition & 4 deletions lib/ttfunk/table/sbix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
module TTFunk
class Table
class Sbix < Table
attr_reader :version
attr_reader :flags
attr_reader :num_strikes
attr_reader :strikes
attr_reader :version, :flags, :num_strikes, :strikes

BitmapData = Struct.new(:x, :y, :type, :data, :ppem, :resolution)

Expand Down
Loading

0 comments on commit a16fb67

Please sign in to comment.