package fontforge-of-ocaml

  1. Overview
  2. Docs

FontForge module

TODO

  • getPrefs: ~name:string -> ??
  • setPrefs: ~name:string -> ~value:?? -> unit
val savePrefs : unit -> unit

Saves the current preference settings.

val loadPrefs : unit -> unit

Saves the current preference settings.

Loads the user's default preference settings. Not done automatically in a script.

val hasSpiro : unit -> bool

Returns a boolean, True if Raph Levien's spiro package is available for use in FontForge.

val defaultOtherSubrs : unit -> unit

Returns a boolean, True if Raph Levien's spiro package is available for use in FontForge.

Sets the type1 PostScript OtherSubrs to the default value.

val readOtherSubrsFile : filename:string -> unit

Sets the type1 PostScript OtherSubrs to the default value.

Sets the type1 PostScript OtherSubrs to the stuff found in the file.

val loadEncodingFile : filename:string -> string option

Loads an encoding file, returns the name of the encoding or None.

val loadNamelist : filename:string -> unit

Loads an encoding file, returns the name of the encoding or None.

Loads a namelist.

val loadNamelistDir : dirname:string -> unit

Loads a namelist.

Loads all namelist files in the directory.

val loadPlugin : filename:string -> unit

Loads all namelist files in the directory.

Loads a fontforge plugin.

val loadPluginDir : dirname:string -> unit

Loads a fontforge plugin.

Loads all fontforge plugins in the directory.

val preloadCidmap : filename:string -> registry:string -> order:string -> supplement:int -> unit

Loads all fontforge plugins in the directory.

Loads a fontforge cidmap file.

TODO: From fontforge/python.c file, it seems that the second argument is not used for pdf-file and ps-file! print method = { "lp", "lpr", "ghostview", "ps-file", "command", "pdf-file", 5 }.

  • printSetup: ?? -> unit
val nameFromUnicode : ?namelist:string -> int -> string

Finds the glyph name associated with a given unicode codepoint. If a namelist is specified the name will be taken from that.

val unicodeFromName : glyphname:string -> int

Finds the glyph name associated with a given unicode codepoint. If a namelist is specified the name will be taken from that.

Looks up glyph name in its dictionary and if it is associated with a unicode code point returns that number. Otherwise it returns -1.

val version : unit -> string

Looks up glyph name in its dictionary and if it is associated with a unicode code point returns that number. Otherwise it returns -1.

Returns fontforge's version number as a string. This will be a large number like 20070406.

val fonts : unit -> Font.t list

Returns fontforge's version number as a string. This will be a large number like 20070406.

Returns a list of all fonts currently loaded into fontforge for editing.

val activeFont : unit -> Font.t option

Returns a list of all fonts currently loaded into fontforge for editing.

If the script were invoked from the File->Execute Script... dialog, or invoked by a menu item in the font view, this returns the font that was active at the time. Otherwise it returns None.

val activeGlyph : unit -> Glyph.t option

If the script were invoked from the File->Execute Script... dialog, or invoked by a menu item in the font view, this returns the font that was active at the time. Otherwise it returns None.

If the script were invoked from the File->Execute Script... dialog or a menu item from an outline glyph window or a glyph import/export command this returns the glyph that was active at the time. Otherwise it returns None.

val activeLayer : unit -> int

If the script were invoked from the File->Execute Script... dialog or a menu item from an outline glyph window or a glyph import/export command this returns the glyph that was active at the time. Otherwise it returns None.

This returns the currently active layer as an integer between 0 (inclusive) and the font/glyph's layer count (exclusive). It may also be set to -1 if the current glyph window is displaying the font's guidline layer.

val fontsInFile : filename:string -> string list

This returns the currently active layer as an integer between 0 (inclusive) and the font/glyph's layer count (exclusive). It may also be set to -1 if the current glyph window is displaying the font's guidline layer.

Returns the list of all fontnames found in the specified file. The list may be empty if fontforge couldn't find any.

val openFont : filename:string -> Font.t

Returns the list of all fontnames found in the specified file. The list may be empty if fontforge couldn't find any.

Opens a filename and returns the font it contains. If it does. If the flags argument is 4, then FontForge will load all glyphs in the 'glyf' table of a ttc file (rather than just the glyphs used in the font picked). This will not load all 'glyf' tables though. Not implemented: flags argument (So, the defaut Python value is used.). Note the original Python name is open, but it is an Ocaml keyword.

val parseTTInstr : string -> string

Opens a filename and returns the font it contains. If it does. If the flags argument is 4, then FontForge will load all glyphs in the 'glyf' table of a ttc file (rather than just the glyphs used in the font picked). This will not load all 'glyf' tables though. Not implemented: flags argument (So, the defaut Python value is used.). Note the original Python name is open, but it is an Ocaml keyword.

Returns a binary string each byte of which corresponds to a truetype instruction. The input string should contain a set of instruction names as "SRP0\nMIRPmin,rnd,black".

val unParseTTInstr : string -> string

Returns a binary string each byte of which corresponds to a truetype instruction. The input string should contain a set of instruction names as "SRP0\nMIRPmin,rnd,black".

Reverse of the above. Converts a binary string into a human (sort of) readable string.

TODO

  • unitShape: int -> ??
  • registerGlyphSeparationHook

TODO - User Interface Methods

val contour : unit -> Contour.t

Creates a new contour.

val font : unit -> Font.t

Creates a new contour.

Creates a new font.

val layer : unit -> Layer.t

Creates a new font.

Creates a new layer.

val point : ?oncurve:bool -> ?y:float -> float -> Point.t

Creates a new layer.

Creates a new point. Optionally specifying its location.

val pointCoord : ?oncurve:bool -> coord -> Point.t

Creates a new point. Optionally specifying its location.

Idem point with float coords.

val initialize : unit -> unit
val finalize : unit -> unit