Module: fonts

fonts

The fwlib/fonts module provides detailed information about fonts currently installed on the OS by parsing the Adobe .lst font data files created by CS6 suite apps. These files are stored in Adobe/TypeSupport/CS6/ in the OS's user directory.

Source:
  • lib/fwlib/fonts.js, line 5

Requires

  • module:fwlib/files
  • module:fwlib/underscore

Methods

<static> getInfo

Returns detailed information about a font, based on the font name returned by the Fireworks API. The built-in fw.getPlatformNameForPSFont() method returns the full name of the font, but that often isn't the same name as would be used in CSS. The fonts.getInfo() method, on the other hand, can return additional information, such as the numeric weight of a font.

For instance, if the selected text element's font is Adobe Caslon Pro Semibold, then calling fonts.getInfo(fw.selection[0].font) would return:

{
    family: "Adobe Caslon Pro",
    menu: "Adobe Caslon Pro",
    name: "Adobe Caslon Pro Semibold",
    shortName: "ACaslonPro-Semibold",
    style: "Semibold",
    weight: "600",
    width: "5",
    winName: "ACaslonPro-Semibold"
}

The result of getInfo() calls are cached, so subsequent calls for information about the same font should return faster.

Parameters:
Name Type Description
inFontName String

The name of the font as expressed in the Fireworks API, e.g., fw.selection[0].font when a text element is selected.

Source:
  • lib/fwlib/fonts.js, line 180
Returns:

Returns an object containing details about the specified font, or null if the font can't be found:

  • shortName: The name of the font in the Fireworks API.
  • name: The full name of the font, including style.
  • family: The family name of the font.
  • style: The font style.
  • winName: The Windows-specific name of the font.
  • macName: The Mac-specific name of the font.
  • menu: The name of the font as it appears in the menu.
  • weight: The font weight as a numeric string.
  • width: The width of the font as a numeric string.

  • Type
    Object