forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Restricting fonts selection by 'Types'

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Thu May 28, 2015 1:12 pm    Post subject: Restricting fonts selection by 'Types' Reply with quote

Does anyone know: Is there a Windows API which can present to the user a list of 'font types' from which to choose from ?
What I mean is, for example, to present just a list of say 'Script' fonts from which to choose from.
This could be a way of 'guiding' the user to selecting only visually 'compatible' fonts to be used togethe, and avoiding the human propensity to select horrendous combinations of fonts together (avoiding the trendy clothes selection effects of the 60's and 70's Wink )

I've seen the example where the CLEARWIN CHOOSE_FONT routine can be used to get the standard dialoue box to select an individual font from a list of all fonts on a particular machine ,but
I wondered if this selection can be further be semi-automated in order to offer automatically a selection of only certain ont types to choose from.
The 'filtering' option gives an easy way to filter based on font NAME, and might be an option but it would rely on first supplying a 'category' list within the program itself §(for all possible fonts in the universe !)in order to
have a complete, reliable basis for filtering.

I've researched a bit and can't find any Windows API's to do this specifically but maybe there is one hidden somewhere in the bowels of Micro$oft Towers ?

I've also seen that there are some typical 'accepted categories' for classifying fonts
e.g. as described here on one of the popular font-source siteshere: http://www.fonts.com/content/learning/fontology/level-1/type-anatomy/type-classifications
but there doesn't seem to be an overall 'standard' for classifying them (except maybe the '4 classic' groups: Serif, SansSerif, Script, Decorative ? maybe a few more).


On my machine I've got dozens and dozens above the 'standard ones' due to installing ovr the years and quite frankly the MS system is a mess in terms of capability to 'classify' the fonts within the dialog box on an individual machine, which makes selecting fonts a pain and time-consuming.

I guess it all boils down to what font info. is stored within the font definitions themselves and what Windows API(s) might be out there in the first place,
and/or if there is a complete database of font 'types' for all fonts (whch I doubt since fonts are continually being created, but you never know).

Any advice or experience would be gratefully received.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Thu May 28, 2015 2:39 pm    Post subject: Reply with quote

ClearWin+ has CHOOSE_FONT@ but this does not give the programmer any control over the types of font presented.

CHOOSE_FONT@ calls into the Microsoft API function ChooseFont which you will find (for example) in win32api.ins.

ChooseFont allows control over the type of font via the CHOOSEFONT structure and then the LOGFONT structure.

Converting these structures for use in Fortran can be a little tricky. In simple cases you can use arrays instead. If you use a structure (user TYPE) then apply the SEQUENCE attribute to fix the order of the members.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Fri May 29, 2015 9:15 pm    Post subject: Reply with quote

John,
I have 400 fonts in the computer which became a mess to use. Where the hell is this font called Latha? Or Arimo ? Or Meiryo? I was hell swearing all the time.

So first i've done is alphabetically ordered them. Here is two ways of sorting we discussed less then a year ago in this forum. Here is the code (reference of SORT is on that discussion, try to search it here)

Code:
   
    IndexFonts(:) = 0

!   call chsort@(IndexFonts,Fontname1,Numb_CompFonts)
!   Fontname1= Fontname1(IndexFonts(:))

    CaseInsensitive = .false.
    call SORT(Fontname1(1:Numb_CompFonts),IndexFonts,CaseInsensitive)


Then you fit that into listbox and make choice easier. You can leave only needed fonts in listbox of course.



When you select the font the running line below shows what is in thus font. That can be done many different ways.
And of course you make your favorite fonts more specifically adjusted. You choose all needed sizes for them and tell the code where to use them and where not.
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sat May 30, 2015 8:22 pm    Post subject: Reply with quote

Paul thanks for the pointer in the right direction.
I've had a quick shufty.

The CHOOSE_FONT structure has a large number of parameters associated, amongst which what appears to be the ability to select:-

Fixed Pitch Only, No Vector Fonts, only fonts within a specific size range, only horizontal fonts,
scalable fonts only, true type fonts only, and a few other more obscure options.
This may help, even though it wasn't eexactly what I was looking for.


The LOGFONT structure seems to identify (and thus maybe allow selection limitation) within it a limited classification of the font into one of 5 categories:-
Decorative, Modern , Roman , Script, Swiss


All in all there are possibilities, -i'll have to assess if it's worth the effort though to get entangled with a complicated API structure.

Thanks also for the advice w.r.t. defining the Types for the structures and the SEQ 'trick'.

I'd seen from previous AP_I posts and discussions that arrays were used (presumeably these are such 'simple cases' to which you refer to here, although I was surprised
because I'd thought that all such structures would have to have the direct equivalent to the API one).
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sat May 30, 2015 8:24 pm    Post subject: Reply with quote

Dan, thanks too for your useful reminder re- sorting, which is another aspect which hadn't even crossed my mind. I thought that all the fonts
which popped up in Word, Excel etc.... were in alphabetical order, but maybe I've not been paying attention.

This is the link you're referring to I think ?

http://forums.silverfrost.com/viewtopic.php?t=3003&highlight=chsort


I guess the fonts are given ID's by default in the order they are installed, so maybe Word&Excel cleverly re-order before dropping them in the selection box.

*** Odd think happening **** when making this comment.
If I put the [url] and [\url] front n back round the link (it's not included here !!!!) the comment appears 'blank' when posted. However it is there when I go in to 'edit' it.
Strange.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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