Struct Extent
- Namespace
- Rustaveli.Pdf
- Assembly
- Rustaveli.Pdf.dll
A width and a height in PDF points: the size of a page, the room a block is offered, or the room it takes.
public readonly record struct Extent : IEquatable<Extent>
- Implements
- Inherited Members
- Extension Methods
Remarks
Layout adds and subtracts these sizes many times over on the way down a document tree, and single-precision arithmetic drifts as it goes: a column three times a third of the page can come out a hair wider than the page. Comparisons that decide whether content fits therefore allow Epsilon either way, so that drift never pushes content onto another page.
Constructors
Extent(float, float)
A width and a height in PDF points: the size of a page, the room a block is offered, or the room it takes.
public Extent(float Width, float Height)
Parameters
Remarks
Layout adds and subtracts these sizes many times over on the way down a document tree, and single-precision arithmetic drifts as it goes: a column three times a third of the page can come out a hair wider than the page. Comparisons that decide whether content fits therefore allow Epsilon either way, so that drift never pushes content onto another page.
Fields
Epsilon
How far apart two lengths may be and still count as the same, in points: a thousandth of a point, far below anything a reader can see, and far above the drift of single-precision layout arithmetic.
public const float Epsilon = 0.001
Field Value
Properties
Height
public float Height { get; init; }
Property Value
IsNegative
Whether either side is below zero by more than Epsilon: what is left of a room once more was taken from it than it had.
public bool IsNegative { get; }
Property Value
Max
The largest room there is: 14,400 points each way, which is 200 inches. The PDF standard sets that as the largest side a page may have, so no page can be larger, and content measured in this room is measured as if nothing held it back.
public static Extent Max { get; }
Property Value
Width
public float Width { get; init; }
Property Value
Zero
No width and no height.
public static Extent Zero { get; }
Property Value
Methods
FitsIn(Extent)
Whether this size fits in available room: neither side larger by more than
Epsilon.
public bool FitsIn(Extent available)
Parameters
availableExtent
Returns
ToString()
The size as a reader writes it, width by height: 1.5 × 2.25 pt.
public override string ToString()
Returns
WithHeight(float)
public Extent WithHeight(float height)
Parameters
heightfloat
Returns
WithWidth(float)
public Extent WithWidth(float width)
Parameters
widthfloat