VegaRise.NET
HomeAPI Reference
Back to DOM

DocumentGridClass

Definition

Namespace
DOM.Elements
Assembly
DOM.dll

Represents grid settings used by a section or document to align characters and lines.

Remarks

The document grid controls typographic alignment and snapping behavior. It is used by layout engines to determine character spacing, line pitch and how content snaps to a grid. This class derives from and implements . BaseElement IDocumentGrid The grid is typically used in East Asian typography to align CJK characters and to enforce a consistent baseline pitch across paragraphs. It can also be used in mixed scripts to align Latin text with an underlying pitch.

Examples

csharp
1// 1. Lines-and-characters grid
2var grid = new DocumentGrid
3{
4 CharacterSpace = new DocumentUnit { MM = 5 },
5 LinePitch = new DocumentUnit { Point = 20 },
6 Type = DocGridValues.linesAndChars
7};
8doc.DocumentGrid = grid;
9
csharp
1// 2. Line-only grid for vertical rhythm
2var grid = new DocumentGrid
3{
4 LinePitch = new DocumentUnit { Point = 18 },
5 Type = DocGridValues.lines
6};
7
csharp
1// 3. Snap characters only
2var grid = new DocumentGrid
3{
4 CharacterSpace = new DocumentUnit { MM = 4 },
5 Type = DocGridValues.snapToChars
6};
7
csharp
1// 4. Configure grid per section
2var section = doc.AddSection();
3section.DocumentGrid = new DocumentGrid
4{
5 CharacterSpace = new DocumentUnit { MM = 5 },
6 LinePitch = new DocumentUnit { Point = 20 },
7 Type = DocGridValues.linesAndChars
8};
9

Properties

CharacterSpaceDocumentUnit

Gets or sets the horizontal space reserved per character when character-based grid modes are used.

LinePitchDocumentUnit

Gets or sets the vertical distance between baselines of consecutive lines.

Gets or sets the document grid type which defines grid behaviour.