Class: Fontisan::Type1::Encodings::Encoding

Inherits:
Object
  • Object
show all
Defined in:
lib/fontisan/type1/encodings.rb

Overview

Base encoding class

All encoding classes should inherit from this and implement the required methods.

Direct Known Subclasses

AdobeStandard, ISOLatin1, Unicode

Class Method Summary collapse

Class Method Details

.all_glyph_namesArray<String>

Get all glyph names in encoding

Returns:

  • (Array<String>)

    All glyph names

Raises:

  • (NotImplementedError)


550
551
552
# File 'lib/fontisan/type1/encodings.rb', line 550

def self.all_glyph_names
  raise NotImplementedError, "#{name} must implement all_glyph_names"
end

.codepoint_for_glyph(name) ⇒ Integer?

Get character code for glyph name

Parameters:

  • name (String)

    Glyph name

Returns:

  • (Integer, nil)

    Character code or nil if not found

Raises:

  • (NotImplementedError)


527
528
529
530
# File 'lib/fontisan/type1/encodings.rb', line 527

def self.codepoint_for_glyph(name)
  raise NotImplementedError,
        "#{name} must implement codepoint_for_glyph"
end

.encoding_nameString

Get encoding name

Returns:

  • (String)

    Encoding name

Raises:

  • (NotImplementedError)


543
544
545
# File 'lib/fontisan/type1/encodings.rb', line 543

def self.encoding_name
  raise NotImplementedError, "#{name} must implement encoding_name"
end

.glyph_name_for_code(codepoint) ⇒ String?

Get glyph name for character code

Parameters:

  • codepoint (Integer)

    Character codepoint

Returns:

  • (String, nil)

    Glyph name or nil if not found

Raises:

  • (NotImplementedError)


518
519
520
521
# File 'lib/fontisan/type1/encodings.rb', line 518

def self.glyph_name_for_code(codepoint)
  raise NotImplementedError,
        "#{name} must implement glyph_name_for_code"
end

.include?(name) ⇒ Boolean

Check if glyph name is in encoding

Parameters:

  • name (String)

    Glyph name

Returns:

  • (Boolean)

    True if glyph is in encoding



536
537
538
# File 'lib/fontisan/type1/encodings.rb', line 536

def self.include?(name)
  !codepoint_for_glyph(name).nil?
end