Livecode Wiki
Advertisement

Loads a font from a font file into memory.

RevFontLoad

Syntax:

start using font file <fontFile> [globally]

Examples:

start using font file "C:/myFontFolder/myCustomFont.ttf"
start using font file "C:/myFontFolder/myCustomFont.ttf" globally

The start using font command loads a font from a font file into memory. The fontFile is the path to the font file. Use the globally adverb to indicate that the font should be available to all applications on the system rather than private to the current application. The fontNames function will return the name of all available fonts and the fontFilesInUse property will return the fill paths of the loaded font files. To determine the name of the newly loaded font, compare the value of the fontNames before and after loading the font.

On Linux use this code:

create folder "~/.fonts"
revCopyFile "DroidSansMono.ttf", "~/.fonts/DroidSansMono.ttf"
put shell("fc-cache -fv") into temp

Parameters:

  • fontFile: the absolute path of the font file
  • The result: If the font was loaded successfully, the start using font command puts empty into the result. If the font failed to load, the result will contain an error string. This will be 'can't load font file' if the specified file could not be loaded as a font.

See also: result (function), fontNames (function), fontFilesInUse (property),

Advertisement