Class: Fontisan::Type1::Encodings::ISOLatin1

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

Overview

ISO-8859-1 (Latin-1) Encoding

Encoding for Western European languages, based on ISO-8859-1 standard.

Constant Summary collapse

CODE_TO_GLYPH =
code_to_glyph.freeze
GLYPH_TO_CODE =
glyph_to_code.freeze

Class Method Summary collapse

Methods inherited from Encoding

include?

Class Method Details

.all_glyph_namesArray<String>

Get all glyph names in encoding

Returns:

  • (Array<String>)

    All glyph names except .notdef



647
648
649
# File 'lib/fontisan/type1/encodings.rb', line 647

def self.all_glyph_names
  ISO_8859_1.reject { |n| n == ".notdef" }
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



633
634
635
# File 'lib/fontisan/type1/encodings.rb', line 633

def self.codepoint_for_glyph(name)
  GLYPH_TO_CODE[name]
end

.encoding_nameString

Get encoding name

Returns:

  • (String)

    “ISOLatin1”



640
641
642
# File 'lib/fontisan/type1/encodings.rb', line 640

def self.encoding_name
  "ISOLatin1"
end

.glyph_name_for_code(codepoint) ⇒ String?

Get glyph name for character code

Parameters:

  • codepoint (Integer)

    Character code (0-255)

Returns:

  • (String, nil)

    Glyph name or nil if not found



625
626
627
# File 'lib/fontisan/type1/encodings.rb', line 625

def self.glyph_name_for_code(codepoint)
  CODE_TO_GLYPH[codepoint]
end