Setting fonts

Eric Chatonet eric.chatonet at sosmartsoftware.com
Wed Jul 6 02:07:33 EDT 2005


Hi Charles,

Some clues which can help:

1. Combining a specified font and a "not specified" font:
If you have a field with no font specified (use owner's font) and  
then you set the font for some lines, for instance, to Courier New  
(selecting these lines and choosing the right font in the Text menu).
Then when you set the textFont of the stack (by script or in the  
properties inspector), only lines which use owner's font will change:  
they will appear in the specified font but the lines previously set  
in Courier New will stay unchanged.
This way assumes that the monospaced font you use is the same on all  
platforms and other texts may change (or the opposite).

To implement the feature, you can use a switch (or if/then/else)  
structure in a preOpenStack handler:

on preOpenStack
   switch the platform
   case "MacOS"
     set the textFont of this stack to x
     break
   case "Win32"
     set the textFont of this stack to y
     break
   default
     answerNotSupported :-)
   end switch
end preOpenStack

Note: If you have many other things to change according to the  
platform, you might be interested in switching profiles.

2. Using "cross-platform" fonts:
For Mac OS X and Win XP, you can use fonts available on both  
platform: Arial, Comic sans MS, Courier New, Georgia,  Tahoma,  
Textile, Times or Verdana (may be I missed one or two).
Then the problem is gone :-)

Best Regards from Paris,

Eric Chatonet.

Le 6 juil. 05 à 05:07, Charles Hartman a écrit :

> This Dreamcard stack will need to run under the Player on both Mac  
> (where I'm writing it) and Windows. The app centers on many cards  
> that are full of information, usually in a scrolling text field.  
> Most of the text in the field uses whatever I set as the font for  
> the main stack (obviously) -- Palatino on Mac, probably Times New  
> Roman on Windows. Certain lines within the text on many cards need  
> to be in a monospaced font (Courier on Mac, Courier New on Windows).
>
> So two linked questions: What's the best way to set the overall  
> font in a script for the main stack (in an "if the platform is"  
> structure presumably)? I notice that if I just set the font for the  
> main stack (for example, from the message box), it changes on all  
> the cards as expected, though of course not in the lines specified  
> with a particular font (Courier) -- but ALSO not AFTER that text  
> that's marked off for Courier. So that "if the platform is" doesn't  
> seem to be be thorough enough. And then, how do I set the font for  
> the monospaced lines on all cards?
>
> I suppose the stupid brute-force method would be (on opening the  
> main stack) to loop through all lines in the text in all relevant  
> fields in all cards in all substacks. Slow & absurd. Should I be  
> looking at property sets instead? (That *sounds* right, but I don't  
> really understand it yet.) Will this get around the inconsistency  
> in the "main" (stack's default) font that I mentioned? And since  
> the monospaced lines aren't a separate object from the text around  
> them, can they have a property (which can belong to a property set)?
>
> (Putting the monospaced lines into separate objects would be quite  
> a mess, especially since they're embedded in scrolling fields, all  
> of which I would then have to turn into scrolling groups instead,  
> on dozens and dozens of cards.)

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list