Class: Fontisan::Type1::Encodings::AdobeStandard

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

Overview

Adobe Standard Encoding

The most common encoding for Type 1 fonts, providing a consistent mapping of glyph names to character positions in the range 0-255.

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



598
599
600
# File 'lib/fontisan/type1/encodings.rb', line 598

def self.all_glyph_names
  ADOBE_STANDARD.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



584
585
586
# File 'lib/fontisan/type1/encodings.rb', line 584

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

.encoding_nameString

Get encoding name

Returns:

  • (String)

    "AdobeStandard"



591
592
593
# File 'lib/fontisan/type1/encodings.rb', line 591

def self.encoding_name
  "AdobeStandard"
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



576
577
578
# File 'lib/fontisan/type1/encodings.rb', line 576

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