Class: Dvi::Opcode::SetChar
Overview
SetChar is a class for set_char_0 … set_char_127 opcodes.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Class Method Summary collapse
-
.read(cmd, io) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(index) ⇒ SetChar
constructor
- index
-
character index.
-
#interpret(ps) ⇒ Object
Appends a character and changes the current position.
Methods inherited from Base
Constructor Details
#initialize(index) ⇒ SetChar
- index
-
character index
36 37 38 39 |
# File 'lib/dvi/opcode.rb', line 36 def initialize(index) raise ArgumentError unless 0 <= index && index < 256 @index = index end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
33 34 35 |
# File 'lib/dvi/opcode.rb', line 33 def index @index end |
Class Method Details
.read(cmd, io) ⇒ Object
:nodoc:
41 42 43 |
# File 'lib/dvi/opcode.rb', line 41 def self.read(cmd, io) #:nodoc: return self.new(cmd) end |
Instance Method Details
#interpret(ps) ⇒ Object
Appends a character and changes the current position.
46 47 48 49 50 51 52 53 |
# File 'lib/dvi/opcode.rb', line 46 def interpret(ps) # append a new character ps.chars << char = Dvi::TypesetCharacter.new(@index, ps.h, ps.v, ps.font) # change the current position unless self.kind_of?(Put) ps.h += ps.font.design_size * char.metric.width end end |