Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mac Fonts: which can be made bold?



We do something similar in our program, but take a different approach. Here's the code for bold that we use:

Font f1 = Font.decode(fontName);
String fontName = f1.getFontName();
if (fontName.equals(f1.deriveFont(Font.BOLD).getFontName())) {
	boldCheckBox.setSelected(false);
	boldCheckBox.setEnabled(false);
} else {
	boldCheckBox.setEnabled(true);
}

A similar check is done for italics. This has been working for us for some time now. We basically check to see if the name of the derived bold font is the same as the plain one. If so, then there's no bold.

Steve


Our app has this same kind of functionality. We have a method called getFontsForFamily() - we simply iterate over this list to see if any of font (names) for a given family contain "Bold", which has worked well.

For italic, we check for both "Italic" and "Oblique".

jeff



_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.