Class FontFiles

All Implemented Interfaces:
EventListener, IClientCachePreload, IClientCacheResource, IGProp<GProp<?>[]>, IPropCnr, Cloneable
Direct Known Subclasses:
EditorFontFiles

public class FontFiles extends PropCnr implements IClientCachePreload, IClientCacheResource
Container for all font files used in a FontIconsDefintion.
Author:
Christopher Mindus
  • Field Details

    • UNDEFINED

      public static final String UNDEFINED
      The undefined font family string.
      See Also:
    • LOCAL

      public static final String LOCAL
      The local name of the font, comma separated list.
      See Also:
    • ADDITIONAL

      public static final String ADDITIONAL
      Additional styles, e.g. font-variant, font-feature-settings.
      See Also:
    • FONT_FACE_CSS

      public static final String FONT_FACE_CSS
      Definition: @font-face CSS, i.e. the original imported font face declaration.
      See Also:
    • STYLES

      public static final String[] STYLES
      Possible values for font-style. Defines how the font should be styled. Default value is "normal".
    • STYLE_DEFAULT

      public static final int STYLE_DEFAULT
      Default STYLE index.
      See Also:
    • WEIGHTS

      public static final String[] WEIGHTS
      Possible values for font-weight. Defines the boldness of the font. Default value is "400" (normal).
    • WEIGHTS_DESCR

      public static final String[] WEIGHTS_DESCR
      Possible values for font-weight with description, e.g. "100 - thin (hairline)".
    • WEIGHT_DEFAULT

      public static final int WEIGHT_DEFAULT
      Default (normal or regular) WEIGHT index = 3.
      See Also:
    • WEIGHT_BOLD

      public static final int WEIGHT_BOLD
      Bold WEIGHT index = 6.
      See Also:
    • STANDARD_FONTS

      public static final String[] STANDARD_FONTS
      The list of standard fonts that are installed in the system by default.
  • Constructor Details

    • FontFiles

      public FontFiles()
      Constructor.
    • FontFiles

      public FontFiles(Atom atom)
      Constructor with name.
      Parameters:
      atom - The atom name.
  • Method Details

    • isStandardFontFamily

      public static boolean isStandardFontFamily(String fontFamily)
      Verifies of the font name is a standard font.
      Parameters:
      fontFamily - The font family name.
      Returns:
      true if standard, false otherwise.
    • isPropPrivateAtCreation

      protected boolean isPropPrivateAtCreation()
      The font files container is private and not transported to the client.
      Overrides:
      isPropPrivateAtCreation in class GProp<GProp<?>[]>
      Returns:
      true if the property should be set to private at creation, false for default.
    • usesPropIndex

      public boolean usesPropIndex()
      Font files container uses property index because it's priority based.
      Specified by:
      usesPropIndex in interface IPropCnr
      Overrides:
      usesPropIndex in class PropCnr
      Returns:
      true if index is used, false for non-index based container.
    • onEventSelf

      public void onEventSelf(GEvent event)
      Overridden to check for cache clearing...
      Specified by:
      onEventSelf in interface IGProp<GProp<?>[]>
      Overrides:
      onEventSelf in class GProp<GProp<?>[]>
      Parameters:
      event - The property event.
    • clone

      public FontFiles clone()
      Clones the font files.
      Overrides:
      clone in class PropCnr
    • getFontFiles

      public FontFile[] getFontFiles()
      Gets the font files.
    • getFontFile

      public FontFile getFontFile(EnvProps env)
      Returns the font file that is used for the client session in question.
      Parameters:
      env - The environment for the client.
      Returns:
      The font file to use, or null if not found.
    • getFontFile

      public FontFile getFontFile(BrowserFontFormat browserFontFormat)
      Returns the font file that is used for the client session in question.
      Parameters:
      browserFontFormat - The browser font format instance.
      Returns:
      The font file to use, or null if not found.
    • getCacheOperation

      public int getCacheOperation()
      Gets the cache value.
      Returns:
      The cache value: 0=no cache, 1=on-first-use (default), 2=preload.
    • isCachedOnClient

      public boolean isCachedOnClient()
      Returns if the resource (font, image, etc) is to be cached on the client side or not.
      Specified by:
      isCachedOnClient in interface IClientCacheResource
      Returns:
      true to cache font (default), or false for client session use only.
    • isCachePreloaded

      public boolean isCachePreloaded()
      Returns if the resource (font, image, etc) is to be cached on the client side when the application starts or not.
      Specified by:
      isCachePreloaded in interface IClientCacheResource
    • getPreloadClientCacheResources

      public PreloadClientCacheResource[] getPreloadClientCacheResources(IClientSessionGyro clientGyro)
      Returns the list of resources that are required on the client side in the preload-to-cache mechanism.
      Specified by:
      getPreloadClientCacheResources in interface IClientCachePreload
      Parameters:
      clientGyro - The client gyro engine.
      Returns:
      An array with the resources required.
    • getFontFamily

      public String getFontFamily()
      Gets the font family name to use.
      Returns:
      The font family name to use, or "undefined" as UNDEFINED if not defined.
    • getFontIdentification

      public String getFontIdentification()
      Gets the font identification much like the "Font Variation Description" (FVD).
      Returns:
      The font identification in form of "font-family:font-weight:font-style".
    • getLocalNames

      public String getLocalNames()
      Gets the local name(s) specified.
      Returns:
      A potentially comma separated string with names, null for none.
    • getFontFaceBaseDeclaration

      public String getFontFaceBaseDeclaration()
      Gets the font-face base declaration without the 'src' and 'font-family' definitions. These declarations are font-family, font-stretch, font-style, font-weight and unicode-range plus the additional styles.
      Returns:
      String formatted as e.g. "font-style: normal; font-weight: normal;", defaults to empty string meaning "font-style: normal; font-weight: normal; font-stretch: normal; unicode-range: U+0-10FFFF;".
    • getFontStyle

      public String getFontStyle()
      Gets the font-style.
      Returns:
      The font-style declaration.
    • getFontStyleIndex

      public int getFontStyleIndex()
      Gets the font-style index value.
      Returns:
      The font-style declaration index value.
    • getFontWeight

      public String getFontWeight()
      Gets the font-weight.
      Returns:
      The font-weight declaration.
    • getDescriptiveFontWeight

      public String getDescriptiveFontWeight()
      Gets the descriptive font-weight as e.g. "100 - thin (hairline)".
      Returns:
      The descriptive font-weight declaration.
    • getFontWeightIndex

      public int getFontWeightIndex()
      Gets the font-weight index value.
      Returns:
      The font-weight declaration index value.