Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pointlessone committed Mar 1, 2024
1 parent 44b7aca commit 88b7a19
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/ttfunk/bin_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module BinUtils
#
# @param arr [Array<Integer>]
# @param bit_width [Integer] bit width of the elements
# @return Integer
# @return [Integer]
def stitch_int(arr, bit_width:)
value = 0

Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/bit_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize(value = 0)

# Set bit on.
#
# @prama pos [Integer] bit position
# @param pos [Integer] bit position
# @return [void]
def on(pos)
@value |= 2**pos
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/encoded_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize

# Append to string.
#
# @param [String, Placeholder, EncodedString]
# @param obj [String, Placeholder, EncodedString]
# @return [self]
def <<(obj)
case obj
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/resource_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ResourceFile

# Open a resource file
#
# @param [String, Pathname]
# @param path [String, Pathname]
# @yieldparam resource_file [TTFunk::ResourceFile]
# @return [any] result of the block
def self.open(path)
Expand Down
11 changes: 6 additions & 5 deletions lib/ttfunk/sub_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ def eot?

# Read a series of values.
#
# @param bytes [Integer] number of bytes to read.
# @param format [String] format to parse the bytes.
# @return [Array]
# @raise [EOTError]
# @see # Ruby Packed data
# @overload read(bytes, format)
# @param bytes [Integer] number of bytes to read.
# @param format [String] format to parse the bytes.
# @return [Array]
# @raise [EOTError]
# @see # Ruby Packed data
def read(*args)
if eot?
raise EOTError, 'attempted to read past the end of the table'
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/subset/code_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def to_unicode_map

# Add a character to subset.
#
# @param [Integer] Unicode codepoint
# @param character [Integer] Unicode codepoint
# @return [void]
def use(character)
@subset[from_unicode(character)] = character
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/subset/unicode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def to_unicode_map

# Add a character to subset.
#
# @param [Integer] Unicode codepoint
# @param character [Integer] Unicode codepoint
# @return [void]
def use(character)
@subset << character
Expand Down
4 changes: 2 additions & 2 deletions lib/ttfunk/subset/unicode_8bit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def to_unicode_map

# Add a character to subset.
#
# @param [Integer] Unicode codepoint
# @param character [Integer] Unicode codepoint
# @return [void]
def use(character)
unless @unicodes.key?(character)
Expand All @@ -44,7 +44,7 @@ def use(character)

# Can this subset include the character?
#
# @param _character [Integer] Unicode codepoint
# @param character [Integer] Unicode codepoint
# @return [Boolean]
def covers?(character)
@unicodes.key?(character) || @next < 256
Expand Down
8 changes: 5 additions & 3 deletions lib/ttfunk/table/cff/charstrings_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ class CharstringsIndex < TTFunk::Table::Cff::Index
# @return [TTFunk::Table::Cff::TopDict]
attr_reader :top_dict

# @param top_dict [TTFunk::Table:Cff::TopDict]
# @param file [TTFunk::File]
# @param subtable_start [Integer]
# @overload initialize(top_dict, file, offset, length = nil)
# @param top_dict [TTFunk::Table:Cff::TopDict]
# @param file [TTFunk::File]
# @param offset [Integer]
# @param length [Integer]
def initialize(top_dict, *remaining_args)
super(*remaining_args)
@top_dict = top_dict
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/table/cff/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def items_count

# Encode index.
#
# @param *args all arguments are passed to `encode_item` method.
# @param args all arguments are passed to `encode_item` method.
# @return [TTFunk::EncodedString]
def encode(*args)
new_items = encode_items(*args)
Expand Down
3 changes: 2 additions & 1 deletion lib/ttfunk/table/cff/one_based_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class OneBasedIndex
# @return [TTFunk::Table::Cff::Index]
attr_reader :base_index

# @param *args [Array] all params are passed to the base index.
# @param args [Array] all params are passed to the base index.
# @see Index
def initialize(*args)
@base_index = Index.new(*args)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/table/cff/private_dict.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def encode

# Finalize dict.
#
# @param new_cff_data [TTFunk::EncodedString]
# @param private_dict_data [TTFunk::EncodedString]
# @return [void]
def finalize(private_dict_data)
return unless subr_index
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/table/cff/top_dict.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def encode(*)

# Finalize the table.
#
# @prama new_cff_data [TTFunk::EncodedString]
# @param new_cff_data [TTFunk::EncodedString]
# @param charmap [Hash{Integer => Hash}] keys are the charac codes,
# values are hashes:
# * `:old` (<tt>Integer</tt>) - glyph ID in the original font.
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/table/dsig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SignatureRecord
# @return [String]
attr_reader :signature

# @param forma [Integer]
# @param format [Integer]
# @param length [Integer]
# @param offset [Integer]
# @param signature [String]
Expand Down
1 change: 1 addition & 0 deletions lib/ttfunk/table/glyf/compound.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Compound
attr_reader :y_max


# IDs of compound glyphs.
attr_reader :glyph_ids

# Component glyph.
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/table/name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def strip_extended

# Encode table.
#
# @param name [TTFunk::Table::Name]
# @param names [TTFunk::Table::Name]
# @param key [String]
# @return [String]
def self.encode(names, key = '')
Expand Down
2 changes: 1 addition & 1 deletion lib/ttfunk/table/post/format40.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Post
module Format40
# Get glyph name for character code.
#
# @param _code [Integer]
# @param code [Integer]
# @return [String]
def glyph_for(code)
@map[code] || 0xFFFF
Expand Down
6 changes: 6 additions & 0 deletions spec/support/path_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# frozen_string_literal: true

module PathHelpers
# Get a test font file.
#
# @param name [String] name of the font file
# @param ext [Symbol, String] font file extension
# @return [String] full path to the test font file
# @raise [ArgumentError] if the requested font file can't be found
def test_font(name, ext = :ttf)
base_path = File.expand_path('../fonts', __dir__)
valid_filename = File.join(base_path, "#{name}.#{ext}")
Expand Down
1 change: 1 addition & 0 deletions spec/support/test_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def initialize(io)
@io = io
end

# Fake font directory entry for the table with the provided tag.
def directory_info(*)
{ offset: 0, length: io.length }
end
Expand Down

0 comments on commit 88b7a19

Please sign in to comment.