PROGRAM Test_FontLIB
! =======================================================================
!
! PURPOSE: To demonstrate the use of FontLIB
!
! =======================================================================
   LIBRARY "{AmigaTools}FontLIB*"


   ! *******************************************
   ! Functions in the LIBRARY that I want to use
   ! *******************************************
   DECLARE FUNCTION Open_Font, ASK_Spacing


   ! *********************************************
   ! Define the drawing surface.  For this example
   ! I chose to scale in pixel numbers
   ! *********************************************
   SET MODE "LOW4"
   LET XLeft   = 1
   LET XRight  = 320
   LET YBottom = 1
   LET YTop    = 200
   LET XMID    = (XLeft+XRight)/2
   LET YMID    = (YBottom+YTop)/2
   SET WINDOW XLeft, XRight, YBottom, YTop
   LET SYS_Spacing = ASK_Spacing
   SET BACKGROUND COLOR "WHITE"
   

   ! **************************************
   ! These are the fonts that I want to use
   ! **************************************
   LET Emerald20 = Open_Font(20, "emerald.font")
   LET Sapphire19 = Open_Font(19, "sapphire.font")
   LET Opal12 = Open_Font(12, "opal.font")


   ! ************************************
   ! Use True BASIC's automatic centering
   ! ************************************
   SET TEXT JUSTIFY "CENTER", "BASE"


   ! ***********************************
   ! Choose a font and character spacing
   ! ***********************************
   CALL SET_Font(Emerald20)
   CALL SET_Spacing(2)


   ! *****************************************************************
   ! To render an outline font at a desired location, render first
   ! in one color with a one pixel offset in every possible direction.
   ! Then render in a second color at the desired location.
   ! *****************************************************************
   SET COLOR "BLACK"
   LET Y = 125
   LET A$ = "CUSTOM FONTS"
   PLOT TEXT, AT XMID-1,Y-1: A$
   PLOT TEXT, AT XMID-1,Y: A$
   PLOT TEXT, AT XMID-1,Y+1: A$
   PLOT TEXT, AT XMID+1,Y-1: A$
   PLOT TEXT, AT XMID+1,Y: A$
   PLOT TEXT, AT XMID+1,Y+1: A$
   PLOT TEXT, AT XMID,Y+1: A$
   PLOT TEXT, AT XMID,Y-1: A$
   SET COLOR "RED"
   PLOT TEXT, AT XMID,Y: A$


   ! *************************************************************
   ! To render a shadowed font at a desired location, render first
   ! in one color with a one pixel offset in one direction, then
   ! render in a second color at the desired location.
   ! *************************************************************
   SET COLOR "BLACK"
   LET Y = 85
   LET A$ = "in TRUE BASIC"
   CALL SET_Font(Sapphire19)
   CALL SET_Bold
   CALL SET_Spacing(2)
   PLOT TEXT, AT XMID-1,Y+1: A$
   SET COLOR "RED"
   PLOT TEXT, AT XMID,Y: A$
   CALL SET_Normal


   CALL SET_Font(Opal12)
   CALL SET_Spacing(1)
   CALL SET_Bold
   SET COLOR "BLUE"
   LET Y = 55
   LET A$ = "using PLOT TEXT"
   PLOT TEXT, AT XMID,Y: A$


   ! *************************************
   ! Put thing back the way you found them
   ! *************************************
   CALL SET_Normal
   CALL SET_Spacing(SYS_Spacing)
   CALL SET_SYSFont
   CALL Close_Font(Emerald20)
   CALL Close_Font(Sapphire19)
   CALL Close_Font(Opal12)

END
