package vg

  1. Overview
  2. Docs

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 = [
  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.

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

The type for font slants.

type 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

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.

Formatters

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

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

val to_string : t -> string
  • deprecated

    use pp instead.

OCaml

Innovation. Community. Security.