package camlimages

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

Module FreetypeSource

Sourcetype t

type for Freetype library

Sourceval init : unit -> t

init () initializes the Freetype library. The returned library is required to load fonts.

Sourcetype face

Type for face

Sourcetype face_info = {
  1. num_faces : int;
  2. num_glyphs : int;
  3. family_name : string;
  4. style_name : string;
  5. has_horizontal : bool;
  6. has_vertical : bool;
  7. has_kerning : bool;
  8. is_scalable : bool;
  9. is_sfnt : bool;
  10. is_fixed_width : bool;
  11. has_fixed_sizes : bool;
  12. has_fast_glyphs : bool;
  13. has_glyph_names : bool;
  14. has_multiple_masters : bool;
}
Sourceval new_face : t -> string -> int -> face * face_info

new_face library fontfile n loads n-th font stored in the font file fontfile, and returns its face and face information.

Sourceval get_num_glyphs : face -> int

Returns number of glyphs stored in the face. Equivalent to face_info.num_glyphs

Sourceval set_char_size : face -> float -> float -> int -> int -> unit

set_char_size face charw charh resh resv sets the character size of face. charw and charh are the points of the characters in width and height. resh and resv are the horizontal and vertical resolution (in dpi)

Sourceval set_pixel_sizes : face -> int -> int -> unit

set_pixel_sizes face pixw pixh also sets the character size of face. pixw and pixh are standard width and height of characters in pixels.

Sourcetype charmap = {
  1. platform_id : int;
  2. encoding_id : int;
}
Sourcetype char_index
Sourceval int_of_char_index : char_index -> int
Sourceval char_index_of_int : int -> char_index
Sourceval get_charmaps : face -> charmap list
Sourceval set_charmap : face -> charmap -> unit
Sourceval get_char_index : face -> int -> char_index
Sourcetype render_mode =
  1. | Render_Normal
  2. | Render_Mono
Sourcetype load_flag =
  1. | Load_no_scale
  2. | Load_no_hinting
    (*

    if you give , freetype loads glyphs with scaling and hinting

    *)
Sourceval load_glyph : face -> char_index -> load_flag list -> float * float
Sourceval load_char : face -> int -> load_flag list -> float * float
Sourceval render_glyph_of_face : face -> render_mode -> unit
Sourceval render_glyph : face -> char_index -> load_flag list -> render_mode -> float * float
Sourceval render_char : face -> int -> load_flag list -> render_mode -> float * float
Sourcetype matrix = {
  1. ft_xx : float;
  2. ft_xy : float;
  3. ft_yx : float;
  4. ft_yy : float;
}

matrix and vector

Sourcetype vector = {
  1. ft_x : float;
  2. ft_y : float;
}
Sourceval set_transform : face -> matrix -> vector -> unit
Sourceval matrix_rotate : float -> matrix
Sourcetype bitmap_info = {
  1. bitmap_left : int;
  2. bitmap_top : int;
  3. bitmap_width : int;
  4. bitmap_height : int;
}

bitmap ops

Sourceval get_bitmap_info : face -> bitmap_info
Sourceval read_bitmap : face -> int -> int -> int

glyph metrics

Sourcetype bbox = {
  1. xmin : float;
  2. ymin : float;
  3. xmax : float;
  4. ymax : float;
}
Sourcetype bearing_advance = {
  1. bearingx : float;
  2. bearingy : float;
  3. advance : float;
}
Sourcetype glyph_metrics = {
  1. gm_width : float;
  2. gm_height : float;
  3. gm_hori : bearing_advance;
  4. gm_vert : bearing_advance;
}
Sourceval get_glyph_metrics : face -> glyph_metrics

size metrics

Sourcetype size_metrics = {
  1. x_ppem : int;
  2. y_ppem : int;
  3. x_scale : float;
  4. y_scale : float;
}
Sourceval get_size_metrics : face -> size_metrics
Sourcetype outline_tag =
  1. | On_point
  2. | Off_point_conic
  3. | Off_point_cubic

outline info

Sourcetype outline_contents = {
  1. n_contours : int;
  2. n_points : int;
  3. points : (float * float) array;
  4. tags : outline_tag array;
  5. contours : int array;
}
Sourceval get_outline_contents : face -> outline_contents
OCaml

Innovation. Community. Security.