Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
Two-dimensional blocks of UTF-8 text. This module makes a naive assumption that each Unicode scalar value has a display width of 1. If this is not the case, the width calculations will be incorrect. See String.Utf8.length_in_uchars for details.
val fill_uchar : Core.Uchar.t->width:int ->height:int ->t
Fill a space with a Unicode scalar value
type valign = [
| `Top
| `Bottom
| `Center
]
Vertical and horizontal alignment specifications
type halign = [
| `Left
| `Right
| `Center
]
val text : ?align:halign->?max_width:int ->string ->t
A basic block of UTF-8 text, split on newlines and horizontally aligned as specified.
If max_width is provided, split each line of the input on whitespace and wrap words to respect the request. So long as no words are longer than max_width, the resulting text block will be no wider than max_width.
val textf :
?align:halign->?max_width:int ->('r, unit, string, t)Core.format4->'r
Vertical and horizontal sequence alignment. Both valign and halign return a list of the same length as the input, with the corresponding elements padded to the appropriate alignment.
If you have a list of a statically known length, using With_static_lengths.valign or With_static_lengths.halign below will let the type checker know that the length of the returned list is equal to the length of the input list.
Empty blocks with either horizontal or vertical extent -- useful for specifying a minimum width or height in conjunction with valign or halign, respectively
val table :
?sep_width:int ->[ `Cols of (t list * halign) list ]->[ `Rows of t list ]
Alignment of a 2D grid of blocks
val compress_table_header :
?sep_width:int ->[ `Cols of (t * t list * halign) list ]->[ `Header of t ] * [ `Rows of t list ]
Compress table header according to column widths.
Input: a list of columns of the form (title, values, column alignment). Output: one header block and row sequence. Raises: if the values lists are not the same length in each column. Example:
first name
age first name last name age | last name
| | | ==> | | |
30 sue smith 30 sue smith
18 bill rodriguez 18 bill rodriguez
76 rick jones 76 rick jones