- /** Returns the ATSUStyle associated with the given XWT font spec.
- * This method first checks its internal cache before creating the
- * ATSUStyle object from scratch. */
- protected RawData _getATSUStyle( String fontSpec ) {
- WrappedRawData ret = null;
- ret = (WrappedRawData) atsuStyleCache.get( fontSpec );
- if (ret != null) return ret.wrapee;
-
- Platform.ParsedFont pf = new Platform.ParsedFont( fontSpec );
-
- // Find the font
- if (pf.name.equals("serif")) pf.name = "lucida_grande";
- else if (pf.name.equals("sansserif")) pf.name = "helvetica";
- else if (pf.name.equals("monospace")) pf.name = "courier";
- else if (pf.name.equals("dialog")) pf.name = "lucida_grande";
- else if (pf.name.equals("tty")) pf.name = "courier";
-
- // Find the ATSFontRef
- WrappedRawData fontRef = (WrappedRawData) nativeFontCache.get( pf.name );
- // If we couldn't find the font, use the default font
- if ( fontRef == null ) fontRef = (WrappedRawData) nativeFontCache.get( defaultFontName );
- if ( fontRef == null ) throw new Error( "Default font cannot be found" );
-
- // Create the ATSUStyle object
- ret = new WrappedRawData( _createATSUStyle( fontRef.wrapee, pf.size, pf.bold, pf.italic, pf.underline ) );
-
- // Map this font spec to the ATSFontRef to optimize future requests
- atsuStyleCache.put( fontSpec, ret );
+ /** Returns the ATSUStyle associated with the given XWT font spec.
+ * This method first checks its internal cache before creating the
+ * ATSUStyle object from scratch. */
+ protected RawData _getATSUStyle( String fontSpec ) {
+ WrappedRawData ret = null;
+ ret = (WrappedRawData) atsuStyleCache.get( fontSpec );
+ if (ret != null) return ret.wrapee;
+
+ Platform.ParsedFont pf = new Platform.ParsedFont( fontSpec );
+
+ // Find the font
+ if (pf.name.equals("serif")) pf.name = "lucida_grande";
+ else if (pf.name.equals("sansserif")) pf.name = "helvetica";
+ else if (pf.name.equals("monospace")) pf.name = "courier";
+ else if (pf.name.equals("dialog")) pf.name = "lucida_grande";
+ else if (pf.name.equals("tty")) pf.name = "courier";
+
+ // Find the ATSFontRef
+ WrappedRawData fontRef = (WrappedRawData) nativeFontCache.get( pf.name );
+ // If we couldn't find the font, use the default font
+ if ( fontRef == null ) fontRef = (WrappedRawData) nativeFontCache.get( defaultFontName );
+ if ( fontRef == null ) throw new Error( "Default font cannot be found" );
+
+ // Create the ATSUStyle object
+ ret = new WrappedRawData( _createATSUStyle( fontRef.wrapee, pf.size, pf.bold, pf.italic, pf.underline ) );
+
+ // Map this font spec to the ATSFontRef to optimize future requests
+ atsuStyleCache.put( fontSpec, ret );