Measures text using the metrics of the standard PDF fonts.
Measurements are returned in PDF points.
Summary
Functions
Calculates the final X coordinate for horizontally aligned text.
Returns the width of one line of text in PDF points.
Returns the width of a text string in PDF points.
Types
Functions
Calculates the final X coordinate for horizontally aligned text.
The provided x and container_width define the horizontal box.
Examples
PaperForge.TextMetrics.aligned_x(
"Centered",
72,
450,
align: :center,
font: :helvetica,
size: 18
)
Returns the width of one line of text in PDF points.
Returns the width of a text string in PDF points.
When the string contains multiple lines, the width of the longest line is returned.
Examples
PaperForge.TextMetrics.width(
"Hello",
font: :helvetica,
size: 12
)