Prawn's layout behaviour for MoonBit on moonbitlang/pagelayout: the document cursor and bounds, formatted text, font metrics, prawn-svg and prawn-table sizing
Dependencies
| package | what it is |
|---|---|
| bobzhang/prawn | the document cursor, bounds, columns and pages (Flow), formatted text (Fragment, Style) and its line wrapping (typeset_lines, Flow::typeset, Flow::typeset_box), font metrics of TrueType and the standard AFM fonts (FontCatalog, Face) with fallback fonts and icon fonts |
| bobzhang/prawn/svg | a port of prawn-svg 0.34.2: SVG documents rendered into pagelayout graphic operations |
| bobzhang/prawn/table | prawn-table 0.2.2's sizing: column widths and row heights |
let catalog = FontCatalog::load(files)
let flow = Flow::new(catalog, setup, hooks={ ..Hooks::new(), base_family: "Noto Serif" })
flow.start_new_page()
flow.typeset(fragments, line_metrics(1.15, flow.font(style), style.size), style)pub(all) struct Columns {
count : Int
stride : Double
current : Int
}pub(all) struct Face {
metrics : FaceMetrics
ascender : Int
descender : Int
line_gap : Int
kern : Map[Int, Double]
standard : Bool
}pub(all) struct Flow {
catalog : FontCatalog
setup : PageSetup
hooks : Hooks
model : PageModel
scratch : Bool
page_top : Double
top : Double
bottom : Double
page : Int
y : Double
left : Double
right : Double
columns : Columns?
last_line : (Line, Int, Double)?
last_line_first : Bool
taring : Int
inked : Bool
first_break_empty : Bool?
page_margins : (Int) -> (Double, Double)?
margin_left : Double
margin_right : Double
page_width_now : Double
page_height_now : Double
}pub struct FontCatalog {
faces : Map[String, Face]
registry : FontRegistry
legacy_icons : Map[String, String]
// private fields
}fn FontCatalog::load(files : Array[(String, Bool, Bool, Bytes)], icon_sets? : Array[IconSet], legacy_icon_mapping? : String, fallbacks? : Array[String]) -> FontCatalog raisepub(all) struct IconSet {
name : String
font : Bytes
legend : String
}pub(all) struct Item {
unit : Int
fragment : Int
fit : Double
draw : Double
kern : Double
hard_break : Bool
anchor : String?
offset : Int
}pub(all) struct LineMetrics {
leading : Double
padding_top : Double
padding_bottom : Double
}pub(all) struct Mark {
page : Int
y : Double
item : Int
}pub(all) struct PageSetup {
width : Double
height : Double
margin_top : Double
margin_right : Double
margin_bottom : Double
margin_left : Double
}pub(all) struct Style {
family : String
size : Double
bold : Bool
italic : Bool
color : Color
link : LinkTarget?
background : Color?
script : Int
border_offset : Double
underline : Bool
strike : Bool
wj : Bool
image : Int
callback : Int
doc_bold : Bool
doc_italic : Bool
font_set : Bool
text_transform : String?
code_background : CodeBackground?
linenum : Bool
line_mark : Bool
wrap_break : Bool
} derive(Eq)fn pdf_anchor_name(id : String) -> StringInstall
Download zipPrawn's layout behaviour for MoonBit on moonbitlang/pagelayout: the document cursor and bounds, formatted text, font metrics, prawn-svg and prawn-table sizing
Dependencies