package vg

  1. Overview
  2. Docs

Module Vg.FontSource

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

Sourcetype weight = [
  1. | `W100
  2. | `W200
  3. | `W300
  4. | `W400
  5. | `W500
  6. | `W600
  7. | `W700
  8. | `W800
  9. | `W900
]

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

Sourcetype slant = [
  1. | `Normal
  2. | `Italic
  3. | `Oblique
]

The type for font slants.

Sourcetype t = {
  1. name : string;
  2. slant : slant;
  3. weight : weight;
  4. 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

Sourceval equal : t -> t -> bool

equal font font' is font = font'.

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

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

Sourceval compare : t -> t -> int

compare font font' is Stdlib.compare font font'

Sourceval 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

Sourceval to_string : t -> string

to_string font is a textual representation of font.

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

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