Module ep_box

License: MIT File: ep_box.erl Description:.

Copyright © 2018 Lloyd R. Prentice

Version: .01

Authors: Lloyd R. Prentice.

Description

License: MIT File: ep_box.erl Description:

Boxes "contain" content elements--- text, images, and PDF elements.

Boxes are composed on "page grids" to organize content and direct "eye path."

All box functions assume that the top left coordinate is at X, Y and Y coordinates increment downward. This conceit makes it easier to layout page grids, since we read pages top down rather than bottom up.

PDF, on the other hand, assumes that X, Y is at the bottom of the box and Y increments upward. Thus, when rendered by PDF, Y coordinate must be flipped; e.g. X, Y at the bottom left of the box and Y incrementing upward.

Y coordinates can be flipped with the function ep_lib:v_flip/2 which takes the vertical dimension of the paper stock on which the box will be printed as a parameter; e.g. when flipped, the top of the box will be relative to the top of the paper stock.

{X, Y} = position of box where X = upper left X coordinate of box in points Y = upper left Y coordinate of box in points Measure | Width = width of box in points Height = height of box in pnts

Data Types

ep_box()

ep_box() = #{id => string(), x => points(), y => points(), width => points(), height => points(), gutter => points(), leading => points(), filled => integer(), y_ptr => points(), available => points(), bg_flag => boolean(), border => points(), border_type => atom(), border_color => color(), text_margin => points(), text_color => color(), background_color => color(), stroke => stroke(), stroke_color => color(), fill_color => color(), indent => points(), continue => term()}

Function Index

available/1Return space available for content.
available_lines/2
background/1Return panel background parameters.
background_color/1Return background color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
bg_flag/1Return state of background flag; if true, print background.
border/1Return width of border.
border_color/1Return border color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
border_type/1Return border type; solid, dashed, beveled.
box_spec/1Return position and dimensions of box.
clip/3Clip box top, right, bottom, or left.
continue/1Return text overflow rule.
corners/1return corner coordiates of box.
create/4Create a new box; all parameters in points.
default_gutter/0Return default gutter width of box; e.g.
default_leading/0Return default leading under box; e.g.
dimensions/1Return width and height of box.
end_x/1Return right edge of box.
end_y/1Return bottom edge of box.
fill_color/1Return fill color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
filled/1Return vertical space at top of box occupied by content.
gutter/1Return gutter width of box; e.g.
height/1Return height of box.
here/1Return position and dimensions of box.
hide_border/1Clear border flag.
id/1Return id of box.
if_background/1Alias for bg_blg/1.
if_border/1Return true if box configured to show border and background.
indent/1Return text indent.
inner_box/1Return position and dimensions of text area in panel.
leading/1Return leading under box; e.g.
max_lines/2max_2 and n_lines/2 get leading from TypeSpec See: ep_typespec:new/3.
measure/1Type setter speak; alias of width;.
n_lines/2max_2 and n_lines/2 get leading from TypeSpec See: ep_typespec:new/3.
outer_box/1Return position and dimensions ofBox.
position/1Return upper-left xy coordinates of box.
reset_bg_flag/1
set_bg_flag/1
shift/3Shift box up, down, right, or left.
show_border/1Set border flag.
stroke/1return stroke type; close, stroke, close_stroke, fill, fill_even_odd, fill_stroke, fill_then_stroke, fill_stroke_even_odd, close_fill_stroke, close_fill_stroke_even_odd, endpath SEE eg_pdf_op:path/1.
stroke_color/1Return stroke color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
text_box/1return text box dimensions.
text_color/1Return text color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
text_margin/1Return order.
total_height/1Return height + leading in points.
total_width/1Return width + gutter in points.
update_available/2
update_background_color/2Update background color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
update_border/2Update width of border (points).
update_border_color/2Update border color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
update_border_type/2Update border type:.
update_continue/2Update text overflow rule.
update_fill_color/2Update fill color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
update_filled/2Update filled.
update_gutter/2Update gutter; e.g.
update_height/2Update height (points).
update_id/2Update id.
update_indent/2Update text indent (points).
update_leading/2Update leading; e.g.
update_margin/2
update_stroke/2Update stroke type; close, stroke, close_stroke, fill, fill_even_odd, fill_stroke, fill_then_stroke, fill_stroke_even_odd, close_fill_stroke, close_fill_stroke_even_odd, endpath SEE eg_pdf_op:path/1.
update_stroke_color/2Update stroke color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
update_text_color/2Update text color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua.
update_text_margin/2Update text margine; e.g.space between border and text (points).
update_width/2Update width (points).
update_x/2Update horizontal position; e.g.
update_y/2Update vertical position; e.g.
update_y_ptr/2Update pointer to y position of next content.
v_flip_box/2
width/1Return width of box.
will_fit/3Given leading, returns true if lines will fit in box.
x/1Return X coordinate of upper left corner of box.
y/1Return Y coordinate of upper left corner of box.
y_ptr/1Return y position for new content.

Function Details

available/1

available(Box::ep_box()) -> term()

Return space available for content

available_lines/2

available_lines(Box::ep_box(), Leading::points()) -> points()

background/1

background(Box::ep_box()) -> {points(), color(), color(), color()}

Return panel background parameters

background_color/1

background_color(Box::ep_box()) -> atom()

Return background color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

bg_flag/1

bg_flag(Box::ep_box()) -> boolean()

Return state of background flag; if true, print background

border/1

border(Box::ep_box()) -> integer()

Return width of border

border_color/1

border_color(Box::ep_box()) -> atom()

Return border color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

border_type/1

border_type(Box::ep_box()) -> atom()

Return border type; solid, dashed, beveled

box_spec/1

box_spec(Box::ep_box()) -> xywh()

Return position and dimensions of box

clip/3

clip(Box::ep_box(), X2::edge(), N::integer()) -> ep_box()

Clip box top, right, bottom, or left

continue/1

continue(X1) -> any()

Return text overflow rule

corners/1

corners(Box::ep_box()) -> {xy(), xy(), xy(), xy()}

return corner coordiates of box

create/4

create(X::points(), Y::points(), Width::points(), Height::points()) -> ep_box()

Create a new box; all parameters in points

default_gutter/0

default_gutter() -> points()

Return default gutter width of box; e.g. margin outside right edge

default_leading/0

default_leading() -> points()

Return default leading under box; e.g. margin below bottom edge

dimensions/1

dimensions(Box::ep_box()) -> xy()

Return width and height of box

end_x/1

end_x(Box::ep_box()) -> points()

Return right edge of box

end_y/1

end_y(Box::ep_box()) -> points()

Return bottom edge of box

fill_color/1

fill_color(Box::ep_box()) -> color()

Return fill color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

filled/1

filled(Box::ep_box()) -> term()

Return vertical space at top of box occupied by content

gutter/1

gutter(Box::ep_box()) -> points()

Return gutter width of box; e.g. margin outside right edge

height/1

height(Box::ep_box()) -> points()

Return height of box

here/1

here(Box::ep_box()) -> xy()

Return position and dimensions of box

hide_border/1

hide_border(Box::ep_box()) -> ep_box()

Clear border flag

id/1

id(Box::ep_box()) -> string()

Return id of box

if_background/1

if_background(Box) -> any()

Alias for bg_blg/1

if_border/1

if_border(Box::ep_box()) -> boolean()

Return true if box configured to show border and background

indent/1

indent(Box::ep_box()) -> integer()

Return text indent

inner_box/1

inner_box(Box::ep_box()) -> xywh()

Return position and dimensions of text area in panel

leading/1

leading(Box::ep_box()) -> points()

Return leading under box; e.g. margin below bottom edge

max_lines/2

max_lines(Box, TypeSpec) -> any()

max_2 and n_lines/2 get leading from TypeSpec See: ep_typespec:new/3

measure/1

measure(Box::ep_box()) -> points()

Type setter speak; alias of width;

n_lines/2

n_lines(Box, TypeSpec) -> any()

max_2 and n_lines/2 get leading from TypeSpec See: ep_typespec:new/3

outer_box/1

outer_box(Box::ep_box()) -> xywh()

Return position and dimensions ofBox

position/1

position(Box::ep_box()) -> xy()

Return upper-left xy coordinates of box

reset_bg_flag/1

reset_bg_flag(Box::ep_box()) -> ep_box()

set_bg_flag/1

set_bg_flag(Box::ep_box()) -> ep_box()

shift/3

shift(Box::ep_box(), X2::direction(), N::integer()) -> ep_box()

Shift box up, down, right, or left

show_border/1

show_border(Box::ep_box()) -> ep_box()

Set border flag

stroke/1

stroke(Box::ep_box()) -> stroke()

return stroke type; close, stroke, close_stroke, fill, fill_even_odd, fill_stroke, fill_then_stroke, fill_stroke_even_odd, close_fill_stroke, close_fill_stroke_even_odd, endpath SEE eg_pdf_op:path/1

stroke_color/1

stroke_color(Box::ep_box()) -> color()

Return stroke color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

text_box/1

text_box(Box::ep_box()) -> xywh()

return text box dimensions

text_color/1

text_color(Box::ep_box()) -> atom()

Return text color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

text_margin/1

text_margin(Box::ep_box()) -> integer()

Return order

total_height/1

total_height(Box::ep_box()) -> points()

Return height + leading in points

total_width/1

total_width(Box::ep_box()) -> points()

Return width + gutter in points

update_available/2

update_available(Box::ep_box(), SpaceConsumed::points()) -> ep_box()

update_background_color/2

update_background_color(Color::color(), Box::ep_box()) -> ep_box()

Update background color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

update_border/2

update_border(Border::points(), Box::ep_box()) -> ep_box()

Update width of border (points)

update_border_color/2

update_border_color(Color::color(), Box::ep_box()) -> ep_box()

Update border color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

update_border_type/2

update_border_type(BorderType::atom(), Box::ep_box()) -> ep_box()

Update border type:

update_continue/2

update_continue(Continue, Box) -> any()

Update text overflow rule

update_fill_color/2

update_fill_color(Color::color(), Box::ep_box()) -> ep_box()

Update fill color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

update_filled/2

update_filled(Filled::integer(), Box::ep_box()) -> ep_box()

Update filled

update_gutter/2

update_gutter(Gutter::points(), Box::ep_box()) -> ep_box()

Update gutter; e.g. outside right margin (pints)

update_height/2

update_height(Height::points(), Box::ep_box()) -> ep_box()

Update height (points)

update_id/2

update_id(ID::string(), Box::ep_box()) -> ep_box()

Update id

update_indent/2

update_indent(Indent::points(), Box::ep_box()) -> ep_box()

Update text indent (points)

update_leading/2

update_leading(Leading::points(), Box::ep_box()) -> ep_box()

Update leading; e.g. margin below bottom edge (pints)

update_margin/2

update_margin(Margin::points(), Box::ep_box()) -> ep_box()

update_stroke/2

update_stroke(Stroke::stroke(), Box::ep_box()) -> ep_box()

Update stroke type; close, stroke, close_stroke, fill, fill_even_odd, fill_stroke, fill_then_stroke, fill_stroke_even_odd, close_fill_stroke, close_fill_stroke_even_odd, endpath SEE eg_pdf_op:path/1

update_stroke_color/2

update_stroke_color(Color::color(), Box::ep_box()) -> ep_box()

Update stroke color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

update_text_color/2

update_text_color(Color::color(), Box::ep_box()) -> ep_box()

Update text color; white, silver, gray, black, maroon, red, fuchsia, purple lime, green, olive, yellow, navy, blue, teal, aqua

update_text_margin/2

update_text_margin(Points::points(), Box::ep_box()) -> ep_box()

Update text margine; e.g.space between border and text (points)

update_width/2

update_width(Width::points(), Box::ep_box()) -> ep_box()

Update width (points)

update_x/2

update_x(X::points(), Box::ep_box()) -> ep_box()

Update horizontal position; e.g. X (points)

update_y/2

update_y(Y::points(), Box::ep_box()) -> ep_box()

Update vertical position; e.g. Y (points)

update_y_ptr/2

update_y_ptr(YPtr::points(), Box::ep_box()) -> ep_box()

Update pointer to y position of next content

v_flip_box/2

v_flip_box(Box::ep_box(), PaperStock::paper_stock()) -> ep_box()

width/1

width(Box::ep_box()) -> points()

Return width of box

will_fit/3

will_fit(Box::ep_box(), Lines::integer(), Leading::points()) -> boolean()

Given leading, returns true if lines will fit in box

x/1

x(Box::ep_box()) -> points()

Return X coordinate of upper left corner of box

y/1

y(Box::ep_box()) -> points()

Return Y coordinate of upper left corner of box

y_ptr/1

y_ptr(Box::ep_box()) -> term()

Return y position for new content


Generated by EDoc