Class: Prawn::Rtl::Connector::Logic::CharacterInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/rtl/connector/logic.rb

Overview

Represents information about an Arabic character and its contextual forms.

Each Arabic letter can have up to four different forms depending on its position within a word and connection to surrounding letters.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(common, isolated, final, initial, medial, connects, diacritic) ⇒ CharacterInfo

Initializes a new CharacterInfo instance.

Parameters:

  • common (String)

    the base Unicode character

  • isolated (String)

    the isolated form of the character

  • final (String)

    the final form of the character

  • initial (String)

    the initial form of the character

  • medial (String)

    the medial form of the character

  • connects (Boolean)

    whether this character connects to the next

  • diacritic (Boolean)

    whether this character is a diacritic mark



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/prawn/rtl/connector/logic.rb', line 35

def initialize(common, isolated, final, initial, medial, connects, diacritic)
  @common = common
  @formatted = {
    isolated: isolated,
    final: final,
    initial: initial,
    medial: medial
  }
  @connects = connects
  @diacritic = diacritic
end

Instance Attribute Details

#commonString

Returns the base Unicode character.

Returns:

  • (String)

    the base Unicode character



21
22
23
# File 'lib/prawn/rtl/connector/logic.rb', line 21

def common
  @common
end

#formattedHash

Returns the character’s forms (:isolated, :final, :initial, :medial).

Returns:

  • (Hash)

    the character’s forms (:isolated, :final, :initial, :medial)



24
25
26
# File 'lib/prawn/rtl/connector/logic.rb', line 24

def formatted
  @formatted
end

Instance Method Details

#connects?Boolean

Checks if this character connects to the following character.

Returns:

  • (Boolean)

    true if the character connects forward



50
51
52
# File 'lib/prawn/rtl/connector/logic.rb', line 50

def connects?
  @connects
end

#diacritic?Boolean

Checks if this character is a diacritic mark.

Returns:

  • (Boolean)

    true if the character is a diacritic



57
58
59
# File 'lib/prawn/rtl/connector/logic.rb', line 57

def diacritic?
  @diacritic
end