New topic: 

Monospaced Fonts

<http://forums.realsoftware.com/viewtopic.php?t=46796>

         Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic          Author  
Message        Pengwin          Post subject: Monospaced FontsPosted: Sat Feb 
02, 2013 6:42 pm                                 
Joined: Fri Mar 03, 2006 5:57 pm
Posts: 58
Location: Elgin, Scotland                I am working on an app that will allow 
the user to change fonts, butI would like to limit the selection to monospaced 
fonts.
Is there a simple way to get a list of ONLY the monospaced fonts, or do I need 
to check each of the fonts individually?      
_________________
Mark
[Real Studio 2011r4 Pro on OSX 10.8.2 targeting OSX]
MarkSpotCode - My trials and tribulations in the world of computer programming. 
 
                             Top                DaveS          Post subject: 
Re: Monospaced FontsPosted: Sat Feb 02, 2013 6:45 pm                            
     
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4493
Location: San Diego, CA                you need to check them all.. but it is 
easy to do

loop thru all the fonts and keep only those where 
g.stringwidth("W")=g.stringwidth("l")

capital "W" and lowercase "L"
I have a code snippet somewhere that does this... will post it if I can find 
it.      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                Pengwin          Post subject: 
Re: Monospaced FontsPosted: Sat Feb 02, 2013 6:52 pm                            
     
Joined: Fri Mar 03, 2006 5:57 pm
Posts: 58
Location: Elgin, Scotland                Thanks for that Dave.

That's currently the solution I have, but, obviously with a system that houses 
a large number of fonts, this could slow down the start up process. I was just 
wondering is RS already had a speedy facility with this.      
_________________
Mark
[Real Studio 2011r4 Pro on OSX 10.8.2 targeting OSX]
MarkSpotCode - My trials and tribulations in the world of computer programming. 
 
                             Top                DaveS          Post subject: 
Re: Monospaced FontsPosted: Sat Feb 02, 2013 6:55 pm                            
     
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4493
Location: San Diego, CA                the project that I used that in... which 
I can't seem to find....  went thru all the system fonts (a few hundred) in 
like 2 seconds      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                wpurvis          Post subject: 
Re: Monospaced FontsPosted: Sun Feb 03, 2013 1:07 am                         
Joined: Tue Oct 04, 2005 10:55 am
Posts: 39
Location: Fort Myers, FL                Pengwin wrote:with a system that houses 
a large number of fonts, this could slow down the start up process.

Don't do it during start-up. Don't do it at all until and unless the user 
actually decides to change fonts, then throw up a little progress indicator 
with a message "Checking installed fonts...". A couple of seconds won't bother 
the user in that context.

In addition, you can cache the results of your font-checking and store them on 
disk, so in the future you'll only need to check new fonts the user may have 
installed, which almost never happens. In fact, you could go ahead and ship 
your app with an embedded list of mono and non-mono fonts. I.e., embed a list 
like this -- http://en.wikipedia.org/wiki/List_of_typefaces -- into your app. 
Then you just have to compare the user's installed fonts with your lists, and 
you'll only have to check font names that aren't already in your list (which, 
again, will almost never happen).   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to