Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

API

santhoshtr edited this page · 6 revisions
Clone this wiki locally

The following are the apis provided by the $.fn.webfonts prototype. Detailed documentation is given below. The methods can be overridden or extended to meet custom requirement with jquery.webfonts.

init

  • arguments - None
  • return - None
  • description - Initializes the extension. This method applies a default font for the language of the element. Language of the element is lang attribute of the node or lang attribute of the html element. After that, it parses the whole element subnodes. See parse method. The init method is called from Constructor of the webfonts extension.

apply

  • arguments - a) fontFamily, b) Optional $element
  • return - None
  • description - apply a font to the current element. If an optional jquery object $element passed, use that. This method adds an inline style font-family: fontFamily, fallbacks to the the element. Default font fallbacks are 'Helvetica', 'Arial', 'sans-serif'. Font fall back can be changed using the option fontStack

parse

  • arguments - None
  • return - None
  • description - Parse the element for custom font-family styles and for nodes with different language than element. If there is a font-family style for the element- either inline or in a css class associated with the element, try to load that font. If there is no font-family style defined, see the lang attribute match the lang attribute of the parent element. If not, load the default font for that language.

reset

  • arguments - None
  • return - None
  • description - Reset the elements font to its original font.

load

  • arguments - String fontfamily - font family name
  • return - None
  • description - Load a given font. It checks whether it is already loaded or not. If not loaded already, it gets the configuration from the repository, create the css and inject to the page.

unbind

  • arguments - None
  • return - None
  • description - Unbind the jquery webfonts extension from an element

list

  • arguments - Optional string langCode
  • return - Array of font names
  • description - Returns a list of font names supported by the current repository. If language is passed as argument, fonts for that language is returned

languages

  • arguments - None
  • return - Array of language codes
  • description - Returns a list of languages supported by the current font repository

getCSS

  • arguments -
    a) fontFamily The font-family name b) variant Optional font variant
  • return - String -The @font-face css rule for the arguments
  • description - For the given font family and optional variant, return @font-face css style

setRepository

  • arguments - Object repository
  • return - None
  • description - set a font repository to work with the extension. See the Font repository documentation for the details
Something went wrong with that request. Please try again.