TeXCache

References
public sealed class TeXCache
A cached collection of TeX boxes properly laid out.

Constructors

TeXCache

#
public TeXCache(TeXBreak breaks, PointF anchor, TeXLayout layout, bool justify = true)
Cache the boxes as implied by a TeX break sequence.
breaks (TeXBreak)Break sequence to cache.
anchor (PointF)Top left corner of the first line.
layout (TeXLayout)Layout settings.
justify (bool = true)If true, glue is stretched so that lines fill the entire line width. If false, glue keeps its ideal width and the right hand edge comes out ragged. Note that the line breaking itself always optimises for the justified case.

TeXCache

#
public TeXCache(TeXBreak breaks, PointF anchor, TeXLayout layout, TeXAlignment alignment)
Cache the boxes as implied by a TeX break sequence.
breaks (TeXBreak)Break sequence to cache.
anchor (PointF)Top left corner of the first line.
layout (TeXLayout)Layout settings.
alignment (TeXAlignment)How lines are placed within the line width. Note that the line breaking itself always optimises for the justified case.

Properties

Anchor

#
public PointF Anchor { get; }
Gets the anchor for the layout.

Bounds

#
public RectangleF Bounds { get; }
Gets the bounds of the entire text block.

Count

#
public int Count { get; }
Gets the total number of boxes cached.

Lines

#
public RectangleF[] Lines { get; }
Gets the extent of every line, in order from top to bottom. A line without any visible content has zero width but still occupies its height.

Indexers

this[]

#
public (TeXBox Box, PointF Point) this[int index] { get; }
Gets the box and insertion point for a specific cached box.
index (int)

Methods

CreateFromPlainText

#
public static TeXCache CreateFromPlainText(string text, RectangleF frame, Font font, Color colour, TeXSpacing spacing = null, TeXLayout layout = null, TeXDemerits demerits = null, bool justify = true)
Create a layout cache directly from plain text.
text (string)Text to layout.
frame (RectangleF)Frame for layout. If the LAYOUT override is specified, the width of the frame is ignored.
font (Font)Font to use.
colour (Color)Colour to use.
spacing (TeXSpacing = null)Optional spacing overrides.
layout (TeXLayout = null)Optional layout overrides.
demerits (TeXDemerits = null)Optional demerits override.
justify (bool = true)If true, lines are stretched to fill the line width.
Cached layout.

CreateFromTeXText

#
public static TeXCache CreateFromTeXText(string text, RectangleF frame, TeXFonts fonts, TeXSpacing spacing = null, TeXLayout layout = null, TeXDemerits demerits = null, bool justify = true)
Create a layout cache directly from TeX formatted text. Only a few TeX commands are supported.
text (string)Text to layout.
frame (RectangleF)Frame for layout. If the LAYOUT override is specified, the width of the frame is ignored.
fonts (TeXFonts)Fonts to use.
spacing (TeXSpacing = null)Optional spacing overrides.
layout (TeXLayout = null)Optional layout overrides.
demerits (TeXDemerits = null)Optional demerits override.
justify (bool = true)If true, lines are stretched to fill the line width.
Cached layout.

Move

#
public TeXCache Move(float dx, float dy)
Move all boxes by a fixed amount.
dx (float)
dy (float)

RenderEmptyBoxes

#
public void RenderEmptyBoxes(Context context, Action<Context, TeXBox, RectangleF> method)
Render all empty boxes.
context (Context)Graphics context.
method (Action<Context, TeXBox, RectangleF>)Drawing method.

RenderTextBoxes

#
public void RenderTextBoxes(Context context, SizeF offset)
Render all text boxes.
context (Context)Graphics context.
offset (SizeF)MOtion offset.

RenderTextBoxes

#
public void RenderTextBoxes(Context context)
Render all text boxes.
context (Context)Graphics context.