|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
wahorger
Joined: 13 Oct 2014 Posts: 1242 Location: Morrison, CO, USA
|
Posted: Sun Jan 05, 2025 4:25 pm Post subject: Font Picker dialog |
|
|
Is there already a way to invoke the Windows Font Picker dialog? I have need of a user selection of the font, style type, and size. I see how when I review the MSDN description, and wondered if I just missed something in the .enh or .chm help.
Bill |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2893 Location: South Pole, Antarctica
|
Posted: Wed Jan 08, 2025 6:20 am Post subject: |
|
|
Bill,
Selection of fonts to use for %gr graphics windows it is very easy. Here is an extraction from my very old Fortran77 code. It check all existing fonts on your computer and shows you their names in a dialog. You can also pic there font size, bold/italic and with one more additional easy (but missing here) command the font color
Selection of fonts for text windows or for OpenGL windows is a different story, but also probably doable this way.
Code: | winapp 500000,500000
include <windows.ins>
c use clrwin
external RADEX_LOGO5
integer RADEX_LOGO5
c character*30 FontNames(1000), string
real*8 FontCapt1Size
common /font_capt1/ ifontCapt1, ibold1, FontCapt1Size
character*50 Fontname1,string, StandardRADEXFont
common /CompFontsNames_/ Numb_CompFonts, iStandardRADEXFont,
* Fontname1(300), StandardRADEXFont
common /GrSize_/ixWidGrRL5, iyWidGrRL5
iOutUnit = 0
ihwhole = 11
ihgrRL5 = 1
ixWidGrRL5 = 740
iyWidGrRL5 = 580
ibold1 = 1
FontCapt1Size = 7
ifontCapt1 = 1
do j=1,300
call get_font_name@(string,j)
if (string.eq.' ') goto 999
Fontname1(j)=string
c print *,j,' [',string,']'
enddo
999 Numb_CompFonts = j-1
if(Numb_CompFonts.le.1) Numb_CompFonts = 1
i=winio@('%ww[no_border,casts_shadow]&')
i=winio@('%ca[Testing Texts]%bg[grey]&')
i=winio@('%sy[3d_raised]&')
i = winio@('%mn[File[&Caption]]&',RADEX_LOGO5)
i = winio@('%mn[[E&xit]]&','exit')
i=winio@('%ob[named_l][Fonts] %`bg[window]%^20.4ls&',
* Fontname1, Numb_CompFonts, ifontCapt1, RADEX_LOGO5)
i = winio@('%ac[Esc]&', 'exit')
c i=winio@('%lw&',lw)
i=winio@(' Font No %ta%dd%il%4^rd%nl&',
* 1, 1,Numb_CompFonts, ifontCapt1, RADEX_LOGO5)
i=winio@(' Font Size %ta%df%fl%4^rf %nl&',
* 1.d0, 0.d0, 100.d0, FontCapt1Size, RADEX_LOGO5)
i=winio@(' Bold %2ta%^rb[ ] %cb%ff&', ibold1, RADEX_LOGO5)
i=winio@('%pv%^gr[full_mouse_input, rgb_colours, '//
* 'user_resize, white]%lc',
* ixWidGrRL5, iyWidGrRL5, RADEX_LOGO5, ihgrRL5)
c do j=1,300
c call get_font_name@(string,j)
c if (string.eq.' ') goto 9999
c Fontname1(j)=string
c print *,j,' [',string,']'
c enddo
c9999 continue
End
integer function RADEX_LOGO5 ()
RADEX_LOGO5 =2
end function |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8087 Location: Salford, UK
|
Posted: Wed Jan 08, 2025 10:05 am Post subject: |
|
|
Dan
Thank you for this very useful sample program.
I will keep it (in a simplified form) for future reference.
Here is a copy...
Code: | winapp
use clrwin
real*8 FontSize
character*80 FontName(300),str
integer ifontNo,iBold,i,j,NumbFonts
integer,external::cb
iBold = 1
FontSize = 7d0
ifontNo = 1
do j=1,300
call get_font_name@(str,j)
if (str.eq.' ') exit
FontName(j)=str
enddo
NumbFonts = j-1
if(NumbFonts.le.1) NumbFonts = 1
i=winio@('%ww%ca[Testing Fonts]&')
i=winio@('%ob[named_l][Fonts]%^20.4ls&',FontName,NumbFonts,ifontNo,cb)
i=winio@(' Font No %ta%dd%il%4^rd%nl&', 1, 1,NumbFonts,ifontNo,cb)
i=winio@(' Font Size %ta%df%fl%4^rf %nl&',1.d0,0.d0,100.d0,FontSize,cb)
i=winio@(' Bold %ta%^rb[ ] %cb%ff', iBold, cb)
end
integer function cb()
cb=2
end function |
|
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1242 Location: Morrison, CO, USA
|
Posted: Thu Jan 09, 2025 6:06 pm Post subject: |
|
|
Thanks, Dan and Paul,
My need is a bit "different" in that I am trying to choose a font, and imbed this into my report generator (creates a PDF), not into an existing ClearWin+ usage.
That said, I will keep this as a reference for sometime in the future.
Bill
P.S. As an aside, I have found that not all fonts in Windows have a file to be referenced (as I would need to know to embed into the PDF), these being "native" for Windows. Even if I download a free one from the Microsoft store, it doesn't appear with a file name at all!
Has anyone looked at buying fonts for use? It is quite pricey! |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8087 Location: Salford, UK
|
Posted: Mon Jan 20, 2025 10:41 am Post subject: |
|
|
New options [font_pitch=p] and/or [font_set=s] have been added for listboxes and dropdown lists (%ls, %`ls and %el). These automatically populate a list with the names of available fonts.
p has the value 1 for fixed pitch, 2 for variable pitch or 3 for both.
s has the value zero for the ANSI character set or 2 for the symbol character set. Other values of s, in the range 128 to 238, denote various language sets.
The arguments, named 'items' and 'num_items' are not required and must be omitted in this context.
The number of items shown in a dropdown list is limited, first by the supplied value of m (in %`m.nls) and then by the vertical height of the display screen. As a result, a dropdown list cannot be used when there are a large number of fonts available because some items will not be displayed. |
|
Back to top |
|
|
wahorger
Joined: 13 Oct 2014 Posts: 1242 Location: Morrison, CO, USA
|
Posted: Mon Jan 20, 2025 3:58 pm Post subject: |
|
|
I will enjoy trying this feature out on the next release, or partial release(?).
Bill |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|