Class: Dvi::Opcode::FntDef

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

Overview

FntDef is a class for fnt_def1 … fnt_def4 opcodes.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

range, set_range

Constructor Details

#initialize(num, checksum, scale, design_size, area, fontname) ⇒ FntDef

Returns a new instance of FntDef.



395
396
397
398
399
400
401
402
# File 'lib/dvi/opcode.rb', line 395

def initialize(num, checksum, scale, design_size, area, fontname)
  @num = num
  @checksum = checksum
  @scale = scale
  @design_size = design_size
  @area = area
  @fontname = fontname
end

Instance Attribute Details

#areaObject (readonly)

Returns the value of attribute area.



393
394
395
# File 'lib/dvi/opcode.rb', line 393

def area
  @area
end

#checksumObject (readonly)

Returns the value of attribute checksum.



393
394
395
# File 'lib/dvi/opcode.rb', line 393

def checksum
  @checksum
end

#design_sizeObject (readonly)

Returns the value of attribute design_size.



393
394
395
# File 'lib/dvi/opcode.rb', line 393

def design_size
  @design_size
end

#fontnameObject (readonly)

Returns the value of attribute fontname.



393
394
395
# File 'lib/dvi/opcode.rb', line 393

def fontname
  @fontname
end

#numObject (readonly)

Returns the value of attribute num.



393
394
395
# File 'lib/dvi/opcode.rb', line 393

def num
  @num
end

#scaleObject (readonly)

Returns the value of attribute scale.



393
394
395
# File 'lib/dvi/opcode.rb', line 393

def scale
  @scale
end

Class Method Details

.read(cmd, io) ⇒ Object



404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/dvi/opcode.rb', line 404

def self.read(cmd, io)
  n = cmd - 242
  num = if n < 4 then io.__send__("read_uint" + n.to_s) else io.read_int4 end
  checksum = io.read_uint4
  scale = io.read_uint4
  design_size = io.read_uint4
  a = io.read_uint1
  l = io.read_uint1
  area = io.read(a)
  fontname = io.read(l)
  return self.new(num, checksum, scale, design_size, area, fontname)
end

Instance Method Details

#interpret(ps) ⇒ Object



417
418
419
420
421
# File 'lib/dvi/opcode.rb', line 417

def interpret(ps)
  tfm = Dvi::Tfm.read(ps.lsr.find(@fontname + ".tfm"))
  ps.fonts[@num] =
    Dvi::Font.new(@checksum, @scale, @design_size, @area, @fontname, tfm)
end