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



645
646
647
# File 'lib/fontisan/type1/encodings.rb', line 645

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



631
632
633
# File 'lib/fontisan/type1/encodings.rb', line 631

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

.encoding_nameString

Get encoding name

Returns:

  • (String)

    "ISOLatin1"



638
639
640
# File 'lib/fontisan/type1/encodings.rb', line 638

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



623
624
625
# File 'lib/fontisan/type1/encodings.rb', line 623

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