#
# sgfonz.rb
#
# $Id: sgfonz.rb,v 1.1.1.1 2011-02-23 07:21:27 horinout Exp $
#

require "narray"
require "numru/dcl"

include NumRu
include Math


#-- graph ---
iws = (ARGV[0] || (puts ' WORKSTATION ID (I)  ? ;'; DCL::sgpwsn; gets)).to_i
DCL::sgopn -(iws.abs)

DCL::slmgn(0.1, 0.1, 0.1, 0.1)
DCL::slrat(1.0, 1.0)

for n in 1..2
  DCL::sgfrm

  DCL::sgiset('IFONT', n)

  DCL::sgswnd(0.0, 16.0, 0.0, 16.0)
  DCL::sgsvpt(0.05, 0.95, 0.0, 0.9)
  DCL::sgstrn(1)
  DCL::sgstrf

  for i in 0..16
    DCL::sglnzu(i.to_f, 0.0, i.to_f, 16.0, 2)
    DCL::sglnzu(0.0, i.to_f, 16.0, i.to_f, 2)
  end

  cttl = format("FONT NO. = %1d", n)
  DCL::sgtxzv(0.5, 0.95, cttl, 0.03, 0, 0, 3)

  for i in 0..255
    ux=i/16+0.5
    uy=16-(i.divmod(16))[1]-0.5
    if (!(i == 30 || i == 31))
      DCL::sgtxzu(ux, uy, DCL::csgi(i), 0.035, 0, 0, 3)
    end
    ux=ux+0.48
    uy=uy+0.38
    ch = format("%3d", i)
    DCL::sgtxzu(ux, uy, ch, 0.01, 0, +1, 1)
  end
end

DCL::sgcls

