/** * Sets the {@link FontBridge} which should be used for a certain kind * of {@link DockFont}s. The bridges will be installed with priority * {@link Priority#DEFAULT} at all {@link FontManager}s. * @param kind the kind of {@link DockFont} the bridges will handle * @param factory the factory for new bridges, can be <code>null</code> */ public void putFontBridgeFactory( Path kind, FontBridgeFactory factory ){ fontBridgeFactories.put( kind, factory ); for( Controller setting : controllers ){ FontManager fonts = setting.controller.getFonts(); FontBridge oldBridge = setting.fonts.remove( kind ); FontBridge newBridge = factory == null ? null : factory.create( fonts ); if( newBridge == null ){ setting.fonts.remove( kind ); if( oldBridge != null ){ fonts.unpublish( Priority.DEFAULT, kind ); } } else{ setting.fonts.put( kind, newBridge ); fonts.publish( Priority.DEFAULT, kind, newBridge ); } } }
/** * Sets the {@link FontBridge} which should be used for a certain kind * of {@link DockFont}s. The bridges will be installed with priority * {@link Priority#DEFAULT} at all {@link FontManager}s. * @param kind the kind of {@link DockFont} the bridges will handle * @param factory the factory for new bridges, can be <code>null</code> */ public void putFontBridgeFactory( Path kind, FontBridgeFactory factory ){ fontBridgeFactories.put( kind, factory ); for( Controller setting : controllers ){ FontManager fonts = setting.controller.getFonts(); FontBridge oldBridge = setting.fonts.remove( kind ); FontBridge newBridge = factory == null ? null : factory.create( fonts ); if( newBridge == null ){ setting.fonts.remove( kind ); if( oldBridge != null ){ fonts.unpublish( Priority.DEFAULT, kind ); } } else{ setting.fonts.put( kind, newBridge ); fonts.publish( Priority.DEFAULT, kind, newBridge ); } } }
for( Map.Entry<Path, FontBridgeFactory> entry : fontBridgeFactories.entrySet() ){ FontBridge bridge = entry.getValue().create( fonts ); fonts.publish( Priority.DEFAULT, entry.getKey(), bridge ); settings.fonts.put( entry.getKey(), bridge );
for( Map.Entry<Path, FontBridgeFactory> entry : fontBridgeFactories.entrySet() ){ FontBridge bridge = entry.getValue().create( fonts ); fonts.publish( Priority.DEFAULT, entry.getKey(), bridge ); settings.fonts.put( entry.getKey(), bridge );