Module Vg.Font

Fonts.

Font handling in Vg happens in renderers and text layout and text to glyph translations are expected to be carried out by an external library. Values of type Vg.font just represent a font specification to be resolved by the concrete renderer.

Fonts

type weight = [
| `W100
| `W200
| `W300
| `W400
| `W500
| `W600
| `W700
| `W800
| `W900
]

The type for font weights. Usually `W400 denotes a normal weight and `W700, a bold weight.

type slant = [
| `Normal
| `Italic
| `Oblique
]

The type for font slants.

type t = {
name : string;
slant : slant;
weight : weight;
size : float;
}

The type for fonts. The size is expressed in Vg's coordinate space, the em unit of the font is scaled to that size.

Predicates and comparisons

val equal : t -> t -> bool

equal font font' is font = font'.

val equal_f : (float -> float -> bool) -> t -> t -> bool

equal_f eq font font' is like equal but uses eq to test floating point values.

val compare : t -> t -> int

compare font font' is Stdlib.compare font font'

val compare_f : (float -> float -> int) -> t -> t -> int

compare_f cmp font font' is like compare but uses cmp to compare floating point values.

Printers

val to_string : t -> string

to_string font is a textual representation of font.

val pp : Format.formatter -> t -> unit

pp ppf font is a textual representation of font on ppf.