package patoline

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

To understand this interface, one must understand the difference between a glyph and a character. While most UTF8 characters can have corresponding glyphs, a glyph may not represent exactly one character. Sometimes it will represent more than one character (as in the case of ligatures) and sometimes none (as in the case of ornaments). To ease the manipulation of glyphs, this modules allows to manipulate integers representing their indices in the font, for instance to write glyph substitutions more easily, and also to load informations such as their outlines.

type font
val uniqueName : font -> string
val fontName : ?index:int -> font -> FTypes.name
val loadFont : ?offset:int -> ?size:int option -> string -> font

Loads a font in the memory from a file name. Actual implementations may keep the file open

val cardinal : font -> int
val glyph_of_uchar : font -> Unicodelib.UChar.t -> int

Computes the index of a glyph corresponding to a given character in the font, but loses the link between the character and the glyph. It is your responsibility to maintain this link with the glyph_id type

val glyph_of_char : font -> char -> int
type glyph
val loadGlyph : font -> ?index:int -> FTypes.glyph_id -> glyph

Load the actual glyph, which gives more precise knownledge about the glyph : its width and outlines, for instance

val outlines : glyph -> (float array * float array) list list

Outlines of the glyph as a list of Bezier curves, each given by two arrays of coefficients of Bernstein polynomials. The degree of the polynomial is the length of the array minus one.

val glyphFont : glyph -> font
val glyphNumber : glyph -> FTypes.glyph_id
val glyphWidth : glyph -> float
val glyphContents : glyph -> string
val glyph_y0 : glyph -> float
val glyph_y1 : glyph -> float
val glyph_x0 : glyph -> float
val glyph_x1 : glyph -> float
val glyphName : glyph -> string
val font_features : font -> string list

Lists all the available features of the font

type feature_set
val select_features : font -> string list -> feature_set

Converts a given list of features into a list of corresponding substitutions

val apply_features : font -> feature_set -> FTypes.glyph_id list -> FTypes.glyph_id list
val positioning : font -> FTypes.glyph_ids list -> FTypes.glyph_ids list

Appiles the available positioning information to a glyph list. This can be used for kerning, but not only

type fontInfo
val fontInfo : font -> fontInfo
val subset : font -> fontInfo -> int Patutil.Extra.IntMap.t -> FTypes.glyph_id array -> Stdlib.Buffer.t
val setName : fontInfo -> FTypes.name -> unit
val add_kerning : fontInfo -> (Patutil.Extra.IntMap.key * int * 'a FTypes.kerningBox * 'b FTypes.kerningBox) list -> unit
val cff_only : font -> CFF.font
val is_cff : font -> bool
OCaml

Innovation. Community. Security.