ASL FontRequester with DoStyle

This forum is for general developer support questions.
Post Reply
User avatar
tbreeden
Posts: 160
Joined: Sat Jun 18, 2011 12:57 am
Location: Charlottesville, VA, USA
Contact:

ASL FontRequester with DoStyle

Post by tbreeden »

It seems that the ASL FontRequester with Style choices can be confusing to the user and does not return enough information to the programmer (SDK 53.24).

eg, it would be nicer if Bold in the styles were automatically selected when the user selects a bold version of one of the listed fonts, eg "DejaVu Sans Bold".
Otherwise, the programmer can't tell if the user really wanted a "Plain" font but clicked on the wrong name, or the user wanted a bold font but ignored the Styles choices.

I realize this might not be easy - I can't see a way to tell that "DejaVu Sans Bold" is inherently bold except by OpenDiskFont() on it (or searching for the word Bold in its name).

When non-Bullet fonts are included in the list, it adds more complexity for the programmer. A SetSoftStyle() on the rp is needed for them.
It would be nice if the FontRequester, returned info on whether a softstyle needs to be used on this font or not. For older fonts-> yes, for an otag font that generates itself a bold version from the normal name, eg. "CGTimes" -> no.

Is it feasible for ASL FontRequester to do either of these?

Thanks,

Tom
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: ASL FontRequester with DoStyle

Post by chris »

tbreeden wrote:eg, it would be nicer if Bold in the styles were automatically selected when the user selects a bold version of one of the listed fonts, eg "DejaVu Sans Bold".
Otherwise, the programmer can't tell if the user really wanted a "Plain" font but clicked on the wrong name, or the user wanted a bold font but ignored the Styles choices.

I realize this might not be easy - I can't see a way to tell that "DejaVu Sans Bold" is inherently bold except by OpenDiskFont() on it (or searching for the word Bold in its name).
You can (potentially) find out by seeing if the BName is self-referential.

Really these variations should be filtered out, and selected by the software if the user (or the software) requests a bold version. At the moment you can set SoftStyles in various fashions, but if you request bold most probably you'll end up with a computed bold rather than the designed version..

A lot of this stuff needs to be worked out in diskfont.library rather than ASL.
When non-Bullet fonts are included in the list, it adds more complexity for the programmer. A SetSoftStyle() on the rp is needed for them.
It would be nice if the FontRequester, returned info on whether a softstyle needs to be used on this font or not. For older fonts-> yes, for an otag font that generates itself a bold version from the normal name, eg. "CGTimes" -> no.
You can do SoftStyles on outline fonts too (maybe not using the graphics.library functions - I've never tried - but certainly by setting attributes through diskfont.library you can)

To find out if you can use a designed font, you just need to check if BName (or BIName, or whatever) is set, and open that font if it does. This does involve querying using diskfont though, it isn't something easily done from graphics.library.
User avatar
tbreeden
Posts: 160
Joined: Sat Jun 18, 2011 12:57 am
Location: Charlottesville, VA, USA
Contact:

Re: ASL FontRequester with DoStyle

Post by tbreeden »

You can do SoftStyles on outline fonts too (maybe not using the graphics.library functions - I've never tried - but certainly by setting attributes through diskfont.library you can)
I checked and for an otag plain font a SetSoftStyle(Bold) on the rp does result in a good algorithmic bolding. To my eye, some of the scaled outline fonts look better soft bolded than intrinsic.

It looks like calling SetSoftStyle(Bold) on an intrinsically bolded outline font is just ignored. You don't get any kind of double bold appearance.

At any rate, i guess need to call OpenDiskFont() after calling the FontRequester is not a really a problem.

Tom
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: ASL FontRequester with DoStyle

Post by chris »

tbreeden wrote:It looks like calling SetSoftStyle(Bold) on an intrinsically bolded outline font is just ignored. You don't get any kind of double bold appearance.
I've just spotted this in the bullet.library AutoDoc:
o OT_StemWeight is used to determine whether these outlines
describe a BOLD style font.
o OT_SlantStyle is used to determine whether these outlines
describe an ITALIC style font.
So that's how you can find out whether a font is already bold/italic. I guess ASL could use this information to filter out designed bold/italic fonts, and then if the user has selected a font with a bold/italic designed version specified, and the bold/italic checkbox, it could return the designed font name instead.

That sounds like a feature request to me.
Post Reply