Class: Dvi::Opcode::FntNum

Inherits:
Base
  • Object
show all
Defined in:
lib/dvi/opcode.rb

Overview

FunNum is a class for fnt_num_0 … fnt_num_63 opcodes.

Direct Known Subclasses

Fnt

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

range, set_range

Constructor Details

#initialize(index) ⇒ FntNum

Returns a new instance of FntNum.

Raises:

  • (ArgumentError)


331
332
333
334
# File 'lib/dvi/opcode.rb', line 331

def initialize(index)
  raise ArgumentError unless 0 <= index && index <= 63
  @index = index
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



329
330
331
# File 'lib/dvi/opcode.rb', line 329

def index
  @index
end

Class Method Details

.read(cmd, io) ⇒ Object



336
337
338
# File 'lib/dvi/opcode.rb', line 336

def self.read(cmd, io)
  return self.new(cmd - 171)
end

Instance Method Details

#interpret(ps) ⇒ Object

Changes the current processor’s font. The font should be defined by fnt_def1 .. fnt_def4.

Raises:



342
343
344
345
# File 'lib/dvi/opcode.rb', line 342

def interpret(ps)
  raise Error unless ps.fonts.has_key?(@index)
  ps.font = ps.fonts[@index]
end