Module Freetype
val init : unit -> t
init ()
initializes the Freetype library. The returned library is required to load fonts.
type face_info
=
{
}
val new_face : t -> string -> int -> face * face_info
new_face library fontfile n
loadsn
-th font stored in the font filefontfile
, and returns its face and face information.
val get_num_glyphs : face -> int
Returns number of glyphs stored in the face. Equivalent to face_info.num_glyphs
val set_char_size : face -> float -> float -> int -> int -> unit
set_char_size face charw charh resh resv
sets the character size offace
.charw
andcharh
are the points of the characters in width and height.resh
andresv
are the horizontal and vertical resolution (in dpi)
val set_pixel_sizes : face -> int -> int -> unit
set_pixel_sizes face pixw pixh
also sets the character size offace
.pixw
andpixh
are standard width and height of characters in pixels.
val int_of_char_index : char_index -> int
val char_index_of_int : int -> char_index
val get_charmaps : face -> charmap list
val set_charmap : face -> charmap -> unit
val get_char_index : face -> int -> char_index
type render_mode
=
|
Render_Normal
|
Render_Mono
type load_flag
=
|
Load_no_scale
|
Load_no_hinting
if you give
, freetype loads glyphs with scaling and hinting
val load_glyph : face -> char_index -> load_flag list -> float * float
val load_char : face -> int -> load_flag list -> float * float
val render_glyph_of_face : face -> render_mode -> unit
val render_glyph : face -> char_index -> load_flag list -> render_mode -> float * float
val render_char : face -> int -> load_flag list -> render_mode -> float * float
type bitmap_info
=
{
bitmap_left : int;
bitmap_top : int;
bitmap_width : int;
bitmap_height : int;
}
bitmap ops
val get_bitmap_info : face -> bitmap_info
val read_bitmap : face -> int -> int -> int
type bbox
=
{
xmin : float;
ymin : float;
xmax : float;
ymax : float;
}
type bearing_advance
=
{
bearingx : float;
bearingy : float;
advance : float;
}
type glyph_metrics
=
{
gm_width : float;
gm_height : float;
gm_hori : bearing_advance;
gm_vert : bearing_advance;
}
val get_glyph_metrics : face -> glyph_metrics
val get_size_metrics : face -> size_metrics
type outline_contents
=
{
n_contours : int;
n_points : int;
points : (float * float) array;
tags : outline_tag array;
contours : int array;
}
val get_outline_contents : face -> outline_contents