
! script name: draft.d/fonttable
! topic: Sample - table that shows the characters in a font.

!A
!A NAME:
!A
!A 	Font Table
!A
!A DESCRIPTION:
!A
!A	This script shows in a table the characters in a font
!A
!B NOTES:
!B
!B 	This script is a template only. A user may copy and modify
!B 	this script to produce custom charts.  Weber Systems is not
!B 	responsible for customization of charts for particular needs.
!B
!# see also - help.d/fonts.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: font table ")

DIM Answer$[256]
DIM Destination$[256]
DIM A$[256]
DEG

ActivateUndo
Current_font= GetDefault(WsTextFont)

Stat=SetInputFormat("n0=","")
Stat= SetEqualsValue(fontnum)
Fontnum=GetValue("FONT NUMBER ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
Stat=SetDefaults(WsTextFont,Fontnum)

Pc= PointXYZ(0.0,0.0,0.0)
Nr= 60
Nc= 10

Table1= CreateBlankTable(Pc,"FONT TABLE",Nr,Nc,WsLowerRight," ")
Stat= SetTableResize(Table1,0,0,WsFalse)
Stat= DeleteEntity(Pc)

PlotOff
R1= 1
C1= 1
FOR I= 1 TO 255
	N1= NCharStrokes(I,Fontnum)
	IF N1 THEN
	A$= VAL$(I)
	Stat= InsertIntoTable(Table1,A$,R1,C1)
	Stat=AutoSizeTable(Table1,3,3,R1,C1)
	C1= C1+1

	A$= CHR$(I)
	Stat= InsertIntoTable(Table1,A$,R1,C1)
	Stat=AutoSizeTable(Table1,15,3,R1,C1)
	C1= C1+1
	IF C1 > 10 THEN
		R1= R1+1
		C1=1
	END IF
	END IF
NEXT I
Stat= RedimTableRows(Table1,R1,WsFalse)

Stat= TableTextOrigin(Table1,0,0,WsCenterText)
Stat=SetDefaults(WsTextFont,Current_font)
Stat=DeleteEntity(Pc)
PlotOn
Stat= PlotEntity(Table1)

ActivateUndo
Stat= AdvanceUndoNumber("font table")
Stat= AddItemToUndo(WsUBCreateMode,Table1)

Leave:!
Stat=DeleteEntity(Pc)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
