com.threerings.opengl.gui.config
Class FontConfig

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.config.ManagedConfig
          extended by com.threerings.opengl.gui.config.FontConfig
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, Exportable, ResourceManager.ModificationObserver, Copyable, Cloneable

public class FontConfig
extends ManagedConfig

Describes a cursor.


Nested Class Summary
static class FontConfig.Style
          The available font styles.
 
Field Summary
protected  HashMap<IntTuple,Font> _fonts
          Cached font instances.
 boolean antialias
          Whether or not the font should be antialiased.
 String file
          The font file.
static FontConfig NULL
          An object to use when the config cannot be resolved.
 
Fields inherited from class com.threerings.config.ManagedConfig
_cfgmgr, _listeners, _name, _updateConfigs, _updateResources
 
Constructor Summary
FontConfig()
           
 
Method Summary
protected  Font createFont(GlContext ctx, int style, int size)
          Creates the font with the specified style and size.
protected  void fireConfigUpdated()
          Fires a configuration updated event.
protected  Font getFont(GlContext ctx, int style, int size)
          Returns the cached font with the specified style and size.
 TextFactory getTextFactory(GlContext ctx, FontConfig.Style style, int size)
          Returns the text factory for this font with the specified style and point size.
 TextFactory getTextFactory(GlContext ctx, int style, int size)
          Returns the text factory for this font with the specified style and point size.
protected  void getUpdateResources(HashSet<String> paths)
          Collects the paths of all resources referenced by this config that, when modified, should trigger a call to ManagedConfig.fireConfigUpdated().
 
Methods inherited from class com.threerings.config.ManagedConfig
addListener, addUpdateDependencies, clearUpdateDependencies, configUpdated, getConfigManager, getInstance, getInstance, getInstance, getInstance, getInstance, getName, getReference, getUpdateReferences, init, maybeFireOnConfigManager, removeListener, resourceModified, setName, updateFromSource, validateOuters, validateReferences, wasUpdated
 
Methods inherited from class com.threerings.util.DeepObject
clone, copy, copy, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL

public static final FontConfig NULL
An object to use when the config cannot be resolved.


file

@Editable(editor="resource",
          nullable=true)
@FileConstraints(description="m.font_files_desc",
                 extensions=".ttf",
                 directory="font_dir")
public String file
The font file.


antialias

@Editable
public boolean antialias
Whether or not the font should be antialiased.


_fonts

@DeepOmit
protected transient HashMap<IntTuple,Font> _fonts
Cached font instances.

Constructor Detail

FontConfig

public FontConfig()
Method Detail

getTextFactory

public TextFactory getTextFactory(GlContext ctx,
                                  FontConfig.Style style,
                                  int size)
Returns the text factory for this font with the specified style and point size.


getTextFactory

public TextFactory getTextFactory(GlContext ctx,
                                  int style,
                                  int size)
Returns the text factory for this font with the specified style and point size.


fireConfigUpdated

protected void fireConfigUpdated()
Description copied from class: ManagedConfig
Fires a configuration updated event.

Overrides:
fireConfigUpdated in class ManagedConfig

getUpdateResources

protected void getUpdateResources(HashSet<String> paths)
Description copied from class: ManagedConfig
Collects the paths of all resources referenced by this config that, when modified, should trigger a call to ManagedConfig.fireConfigUpdated().

Overrides:
getUpdateResources in class ManagedConfig

getFont

protected Font getFont(GlContext ctx,
                       int style,
                       int size)
Returns the cached font with the specified style and size.


createFont

protected Font createFont(GlContext ctx,
                          int style,
                          int size)
Creates the font with the specified style and size.