Class: Dvi::Opcode::Fnt

Inherits:
FntNum show all
Defined in:
lib/dvi/opcode.rb

Overview

Fnt is a class for fnt1 … fnt4 opcodes.

Instance Attribute Summary

Attributes inherited from FntNum

#index

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from FntNum

#interpret

Methods inherited from Base

#interpret, range, set_range

Constructor Details

#initialize(index, n) ⇒ Fnt

Returns a new instance of Fnt.



352
353
354
355
356
357
358
359
360
361
# File 'lib/dvi/opcode.rb', line 352

def initialize(index, n)
  unless case n
     when 1; 0 <= index && index < 256
     when 2; 0 <= index && index < 65536
     when 3; 0 <= index && index < 16777216
     when 4; -2147483648 <= index && index < 2147483648
     else false end
    raise ArgumentError
  end
end

Class Method Details

.read(cmd, io) ⇒ Object



363
364
365
366
367
# File 'lib/dvi/opcode.rb', line 363

def self.read(cmd, io)
  n = cmd - 234
  f = if n < 4 then "read_uint" + n.to_s else "read_int" + n.to_s end
  return self.new(io.__send__(f), n)
end