Despite trying to follow the advice in the Help pages and in posts such as this, I am having no success in getting the default font size to change in ClearWin+ windows. I offer the following code as an illustration of my failings. It creates 3 separate windows: the first uses the default font; then after a call to a function that tries to increase the default font size by a factor of 20, the second window generates smaller output; the third creates slightly larger text. I have tried with and without local_font, and with and without %fh, and nothing changes.
Winapp
Program p
Use clrwin, Only: winio@
Integer, Parameter :: iout1 = 11
Integer, Parameter :: iout2 = 12
Integer, Parameter :: iout3 = 13
!
Integer :: iw, ic1, ic2, ic3
!
Integer(Kind=7) :: idfont ! - default font handle -
!
! Window 1
iw = winio@('%ca@&', 'Test1')
iw = winio@('%40.3cw&', iout1)
iw = winio@('%lw', ic1)
Write (Unit=iout1, Fmt='(A)') 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
! Window 2
Call init_font (20)
iw = winio@('%ca@&', 'Test2')
iw = winio@('%fh&', idfont)
iw = winio@('%40.3cw&', iout2)
iw = winio@('%lw', ic2)
Write (Unit=iout2, Fmt='(A)') 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
! Window 3
Call init_font (4)
iw = winio@('%ca@&', 'Test3')
iw = winio@('%fh&', idfont)
iw = winio@('%40.3cw&', iout3)
iw = winio@('%lw', ic3)
Write (Unit=iout3, Fmt='(A)') 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
!
Contains
!
Subroutine init_font (iscale)
Use mswin32, Only: CreateFont
Use clrwin, Only: get_system_font@, set_default_font@, set_default_to_fixed_font@
!
Integer, Intent(In) :: iscale
!
Integer :: ifnt_hght, ifnt_wdth, ifnt_escp, ifnt_ornt, ifnt_wght, ifnt_ital, ifnt_ulin, ifnt_strk, ifnt_cset, &
ifnt_prec, ifnt_clip, ifnt_qual, ifnt_ptch
!
Character(Len=80) :: cdfname
!
! Set default font characteristics
Call set_default_to_fixed_font@ ()
Call get_system_font@ (ifnt_hght, ifnt_wdth, ifnt_escp, ifnt_ornt, ifnt_wght, ifnt_ital, ifnt_ulin, ifnt_strk, ifnt_cset, &
ifnt_prec, ifnt_clip, ifnt_qual, ifnt_ptch, cdfname)
ifnt_hght = ifnt_hght*iscale
ifnt_wdth = ifnt_wdth*iscale
idfont = CreateFont (ifnt_hght, ifnt_wdth, ifnt_escp, ifnt_ornt, ifnt_wght, ifnt_ital, ifnt_ulin, ifnt_strk, ifnt_cset, &
ifnt_prec, ifnt_clip, ifnt_qual, ifnt_ptch, cdfname)
Call set_default_font@ (idfont)
!
Return
End Subroutine init_font
!
End Program p