Thanks Richard,

I just tested it again, and I can confirm it doesn't work that way -- when it can't find the specified font, it does not apply the fontStyle or fontSize settings.

The Test: I created a test stack with five fields on OSX that had the following font, style and size properties:

1. Nothing set (all default)
2. Set bold attribute only
3. Set to 14 pt
4. Set font = "0"
5 Set font = "0" and bold

I added a button that when clicked outputs the textFont, textStyle and textSize of each field. Here are the results:

On Mac OS X:
1. blank, blank, blank
2. Lucida Grande, bold, 11 (text is bold)
3. Lucida Grande, plain, 14 (text is 14pt)
4. 0, plain, 12
5. 0, bold, 12 (text is bold)

I moved the stack to Windows XP, and it showed:
1. blank, blank, blank
2. Lucida Grande, bold, 11 (text is NOT bold)
3. Lucida Grande, plain, 14 (text is NOT 14pt)
4. 0, plain, 12
5. 0, bold, 12 (text is NOT bold)

And on Windows 2000:
1. blank, blank, blank
2. Lucida Grande, bold, 11 (text is NOT bold)
3. Lucida Grande, plain, 14 (text is NOT 14pt)
4. 0, plain, 12
5. 0, bold, 12 (text is NOT bold)

Even worse, I found that even calling "set the textStyle of field "Field 2" to bold" on XP and 2000 didn't do anything. Apparently, when it has an unknown textFont (e.g. Lucida Grande or "0"), RunRev won't apply either the size or style of the control (field, label, checkbox, etc.). The only way I could get the size and style information to be displayed in fields 2-5 of this test were by calling:

   set the textFont of field "Field 2" to ""
   set the textStyle of field "Field 2" to ""
   set the textSize of field "Field 2" to ""
   set the textStyle of field "Field 2" to "bold"

then, finally, the field turned bold.

Bottomline, it looks like the only way to get cross-platform bold controls (fields, labels, checkboxes, etc.) is by doing a runtime hack to unset all font info, then setting it again. And if they have their system font set to something other than 12 point, watch out, 'cause all your carefully sized labels and fields will surely overflow!

Hmmmm, maybe using Arial wasn't such a bad idea after all :-)

-- Frank

p.s. And the baseline problem shows up in this test stack as well -- the 14pt fields move up 4 pixels on XP and 2000, and the button text moves down 1 pixel.

Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/

On Jul 27, 2004, at 11:12 AM, [EMAIL PROTECTED] wrote:

From: Richard Gaskin <[EMAIL PROTECTED]>
Subject: Re: Cross-platform fonts...what is everyone else doing?
To: How to use Revolution <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Frank Leahy wrote:
1) Is there a hack to determine the system font at runtime on Windows?
Or should I just assume "MS Sans Serif"?

In XP I believe it's Verdana. And it can be changed by the user, as on
Mac OS and most Linux window managers.


2) Is using a "preOpenStack" handler that runs through every control
and sets the textFont attribute -- at *runtime* -- the only way to do
what I want to do?

Not at all: font attributes, along with color and patterns, are
inherited. You can set things once for the stack and all objects which
don't have their own settings will be rendered with the inherited settings.


3) Can anyone suggest a better alternative (and no, having the user
install a good looking cross-platform font isn't an option :-)

I set the font for the mainStack to "0" (zero), and then set textSize appropriate for the target platform. Whenever the engine can't find a specified font it will render in the systemFont.

Scott Raney advises me not to rely on that, but in the absence of a
systemFont function I can't think of another way to avoid hard-wiring
the font name.  Besides, any font vendor that names a font "0" should
expect trouble. ;)

_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to