Well, caching probably will speed it up but GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamil yNames() is not supposed to be used often. And if font is gonna to be used it will be parsed in any case - so caching only font/family names will not help at all.
Cacheing font names helps -- if an application does not display every font in the system!
Sometimes getAvailableFontFamilyNames() can be backgrounded or done during idle times, but not always. Consider the case of a pure Java web browser with a startup page that uses CSS to list preferred fonts, something like "Exotic Font, Arial, Helvetica, Sansserif". It needs all the family names in order to choose the best match available. Since this is the startup page, it is effectively part of the application's startup sequence and the user is waiting. Some users have 1000s of fonts, so this can be time consuming. This application is not going to display all 1000 fonts, but it needs all the font names.
Come to think of it, Java needs font names for new Font("name",
<style>, <size>). Does it read all font names at that time or stop
opening font files once it has found a match?Tom
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
