module Box: Box
type box =
Elementary box in a paragraph
type paragraph = box array
A paragraph is an array of elementary boxes. The line breaking
algorithm produces lines (given by the type
Box.line) by selecting
chunks in a paragraph array.
type drawingBox = {
|
drawing_min_width : float; |
|
drawing_nominal_width : float; |
|
drawing_max_width : float; |
|
drawing_width_fixed : bool; |
|
drawing_adjust_before : bool; |
|
drawing_y0 : float; |
|
drawing_y1 : float; |
|
drawing_badness : float -> float; |
|
drawing_break_badness : float; |
|
drawing_states : int list; |
|
drawing_contents : float -> RawContent.raw list; |
}
type hyphenBox = {
|
hyphen_normal : box array; |
|
hyphenated : (box array * box array) array; |
}
type kind =
| |
Extern of string |
| |
Intern of string |
| |
Button of RawContent.button_kind * string |
type marker =
| |
Label of string |
| |
FigureRef of int |
| |
of string |
| |
Structure of int list |
| |
BeginLink of kind |
| |
EndLink |
| |
AlignmentMark |
type line = {
|
paragraph : int; |
|
lastFigure : int; |
|
lineStart : int; |
|
lineEnd : int; |
|
hyphenStart : int; |
|
hyphenEnd : int; |
|
isFigure : bool; |
|
layout : frame_zipper; |
|
height : float; |
|
paragraph_height : int; |
|
page_line : int; |
|
min_width : float; |
|
nom_width : float; |
|
max_width : float; |
|
line_y0 : float; |
|
line_y1 : float; |
}
Description of a line, which should be produced by the line breaking
algorithm. A line is merely described as the index of its first box and
the index of its last box inside the paragraph (which itself is an
array of boxes).
type parameters = {
|
measure : float; |
|
left_margin : float; |
|
local_optimization : int; |
|
min_height_before : float; |
|
min_height_after : float; |
|
min_page_before : int; |
|
min_page_after : int; |
|
not_last_line : bool; |
|
not_first_line : bool; |
|
min_lines_before : int; |
|
min_lines_after : int; |
|
absolute : bool; |
}
type placed_line = {
}
type frame_content =
| |
Placed_line of placed_line |
| |
Raw of RawContent.raw list |
type frame = {
|
frame_children : frame Extra.IntMap.t; |
|
frame_tags : string list; |
|
frame_x0 : float; |
|
frame_y0 : float; |
|
frame_x1 : float; |
|
frame_y1 : float; |
|
frame_content : frame_content list; |
}
type frame_zipper = frame * (int * frame) list
module MarkerMap: Map.Make(sig
end)
val is_glyph : box -> bool
Helpful test functions.
val is_glue : box -> bool
val is_hyphen : box -> bool
val glyphCache : Fonts.font -> FTypes.glyph_id -> Color.color -> float -> box
Build a box containing one glyph, with a cache.
val glyph_of_uchar : Fonts.font -> UChar.t -> FTypes.glyph_id
Build a glyph id from a font and a unicode character.
val glyph_of_string : (FTypes.glyph_id list -> FTypes.glyph_id list) ->
(FTypes.glyph_ids list -> FTypes.glyph_ids list) ->
Fonts.font -> float -> Color.color -> string -> box list
Build a list of boxes from a string, using stuff from kerning.
val hyphenate : (string -> (string * string) array) ->
(FTypes.glyph_id list -> FTypes.glyph_id list) ->
(FTypes.glyph_ids list -> FTypes.glyph_ids list) ->
Fonts.font -> float -> Color.color -> string -> box list
Build a list of boxes representing a word, while taking care of building
an array of possible hyphenations for the word (if any).
Helper functions for layouts
val frame_up : frame * (Extra.IntMap.key * frame) list ->
frame * (Extra.IntMap.key * frame) list
val frame_down : Extra.IntMap.key ->
frame * (Extra.IntMap.key * frame) list ->
frame * (Extra.IntMap.key * frame) list
val frame_down_last : frame * (Extra.IntMap.key * frame) list ->
frame * (Extra.IntMap.key * frame) list
val frame_top : frame * (Extra.IntMap.key * frame) list ->
frame * (Extra.IntMap.key * frame) list
val empty_frame : frame
val frame : ?contents:frame_content list ->
float ->
float ->
float ->
float ->
frame * (int * frame) list -> frame * (int * frame) list
Creates a new frame with the given top-left and bottom-right
corners, appends this frame as a child of the current frame, and
moves down to this new frame.
val make_page : float * float ->
frame * (int * frame) list -> frame * (int * frame) list
val twocols : frame * 'a -> frame * 'a
val next_zipper : frame * (Extra.IntMap.key * frame) list ->
(frame * (Extra.IntMap.key * frame) list) option
val doc_frame : frame
val frame_page : 'a * (Extra.IntMap.key * frame) list -> int
val layout_page : line -> int
val all_contents : frame -> frame_content list
Helper functions for lines
val uselessLine : line
val default_params : parameters
val lines_eq : line -> line -> bool
val empty_drawing_box : drawingBox
val drawing : ?adjust_before:bool ->
?vcenter:bool ->
?hcenter:bool ->
?offset:float ->
?width_fixed:bool ->
?states:int list -> RawContent.raw list -> drawingBox
val drawing_blit : drawingBox -> float -> float -> drawingBox -> drawingBox
val box_width : float -> box -> float
val box_size : box -> float
val box_interval : box -> float * float * float
val boxes_interval : box array -> float * float * float
val lower_y : box -> float
val upper_y : box -> float
val knuth_h_badness : float -> float -> float
val glue : float -> float -> float -> box
val resize_drawing : float -> drawingBox -> drawingBox
val resize : float -> box -> box
val translate : float -> float -> box -> box
val vkern_percent_under' : ('a -> 'b -> box list) -> float -> 'a -> 'b -> float * box list
val vkern_percent_under : ('a -> 'b -> box list) -> float -> 'a -> 'b -> box list
val vkern_center : ('a -> 'b -> box list) -> float -> 'a -> 'b -> box list
val vkern_translate : ('a -> 'b -> box list) -> float -> 'a -> 'b -> box list
val vkern_as : ('a -> 'b -> box list) ->
('a -> 'b -> box list) -> 'a -> 'b -> box list
val fold_left_line : box array array -> ('a -> box -> 'a) -> 'a -> line -> 'a
Calling fold_left_line paragraphs f x0 line computes
f (... (f (f (f x0 box0) box1) box2) ...) boxn
where box0, box1, box2, … boxn are the boxes which belong to
line in its corresponding paragraph paragraphs.(line.paragraph).
val line_layout : box array array -> line -> frame_zipper -> frame_zipper
val fold_left : ('a -> box -> 'a) -> 'a -> box list -> 'a
val first_line : box array array -> line -> box
val last_line : box array array -> line -> box
val line_height : box array array -> drawingBox array -> line -> float * float
val comp : box array array -> float -> int -> int -> int -> int -> int -> float
val compression : box array array -> parameters -> line -> float
val box_to_string : box -> string
val text_line : box array array -> line -> string