Table of Contents

Class TypeStyle

Namespace
Rustaveli.Pdf
Assembly
Rustaveli.Pdf.dll

The complete set of attributes governing how a run of text is measured and drawn.

public sealed record TypeStyle : IEquatable<TypeStyle>
Inheritance
TypeStyle
Implements
Inherited Members

Remarks

Instances are immutable; the fluent mutators return modified copies. This lets a style be shared safely as a default across a document while individual spans derive their own variants from it.

Properties

BaselineOffset

How far the baseline shifts for this run, positive downwards.

public float BaselineOffset { get; }

Property Value

float

BreaksAnywhere

Whether a line may break between any two characters of this type, not only between words, so a long identifier or address fills each line rather than leaving it short.

public bool BreaksAnywhere { get; init; }

Property Value

bool

Default

public static TypeStyle Default { get; }

Property Value

TypeStyle

Direction

The direction the type reads in, set apart from the text around it: a right-to-left name in an English sentence keeps its own word order and carries its punctuation with it. Null leaves the type to the paragraph, where each character takes the direction its script gives it.

public ReadingDirection? Direction { get; init; }

Property Value

ReadingDirection?

EffectivePointSize

The font size actually rendered, shrunk for sub- and superscript runs.

public float EffectivePointSize { get; }

Property Value

float

Fallbacks

The typefaces tried, in order, for characters Typeface lacks.

public IReadOnlyList<string> Fallbacks { get; }

Property Value

IReadOnlyList<string>

HasOverline

public bool HasOverline { get; init; }

Property Value

bool

HasStrikeThrough

public bool HasStrikeThrough { get; init; }

Property Value

bool

HasUnderline

public bool HasUnderline { get; init; }

Property Value

bool

Highlight

public Ink Highlight { get; init; }

Property Value

Ink

Ink

public Ink Ink { get; init; }

Property Value

Ink

IsItalic

public bool IsItalic { get; init; }

Property Value

bool

Leading

Multiplier applied to the font's natural line height: zero or more.

public float Leading { get; init; }

Property Value

float

PointSize

The size text is set at, in points: zero or more.

public float PointSize { get; init; }

Property Value

float

Script

public ScriptPosition Script { get; init; }

Property Value

ScriptPosition

StrokeInk

The ink of underlines, strike-throughs and overlines; the text's own ink when not set.

public Ink? StrokeInk { get; init; }

Property Value

Ink?

StrokeStyle

How underlines, strike-throughs and overlines are drawn.

public StrokeStyle StrokeStyle { get; init; }

Property Value

StrokeStyle

StrokeWeight

The weight of underlines, strike-throughs and overlines, in points; the font's own when not set.

public float? StrokeWeight { get; init; }

Property Value

float?

Tracking

Additional space inserted between characters, in points; negative tightens.

public float Tracking { get; init; }

Property Value

float

Typeface

The typeface text is set in, Noto Sans unless named: the package carries it, so a document that names none is set the same on every machine, and the Noto faces other scripts fall back to share its design.

public string Typeface { get; init; }

Property Value

string

Weight

public TypeWeight Weight { get; init; }

Property Value

TypeWeight

WordSpacing

Additional space added to each space between words, in points; negative tightens.

public float WordSpacing { get; init; }

Property Value

float

Methods

Bold()

public TypeStyle Bold()

Returns

TypeStyle

BreakAnywhere(bool)

public TypeStyle BreakAnywhere(bool value = true)

Parameters

value bool

Returns

TypeStyle

Italic(bool)

public TypeStyle Italic(bool value = true)

Parameters

value bool

Returns

TypeStyle

Ligatures(bool)

A copy with ligatures such as "fi" and "ffl" set, or not: the standard and contextual ones.

public TypeStyle Ligatures(bool value = true)

Parameters

value bool

Returns

TypeStyle

OldstyleFigures(bool)

A copy with old-style figures, which rise and descend like lowercase letters, where the face has them.

public TypeStyle OldstyleFigures(bool value = true)

Parameters

value bool

Returns

TypeStyle

Overline(bool)

public TypeStyle Overline(bool value = true)

Parameters

value bool

Returns

TypeStyle

SmallCapitals(bool)

A copy with lowercase letters set as small capitals, where the face has them.

public TypeStyle SmallCapitals(bool value = true)

Parameters

value bool

Returns

TypeStyle

StrikeThrough(bool)

public TypeStyle StrikeThrough(bool value = true)

Parameters

value bool

Returns

TypeStyle

Subscript()

public TypeStyle Subscript()

Returns

TypeStyle

Superscript()

public TypeStyle Superscript()

Returns

TypeStyle

TabularFigures(bool)

A copy with figures all one width, so columns of numbers align, where the face has them.

public TypeStyle TabularFigures(bool value = true)

Parameters

value bool

Returns

TypeStyle

Underline(bool)

public TypeStyle Underline(bool value = true)

Parameters

value bool

Returns

TypeStyle

WithDirection(ReadingDirection?)

A copy that reads in direction, set apart from the text around it; null to follow it.

public TypeStyle WithDirection(ReadingDirection? direction)

Parameters

direction ReadingDirection?

Returns

TypeStyle

WithFeature(string, int)

A copy with the OpenType feature tag — "smcp", "onum", "ss01" — set to value: 0 turns it off, 1 on, and a higher value chooses among a feature's alternates.

public TypeStyle WithFeature(string tag, int value = 1)

Parameters

tag string
value int

Returns

TypeStyle

Remarks

Every face is set with composition, localized forms, contextual alternates and standard, contextual and required ligatures; a feature the face does not have does nothing.

Exceptions

ArgumentException

tag is not four printable ASCII characters.

ArgumentOutOfRangeException

value is negative.

WithHighlight(Ink)

public TypeStyle WithHighlight(Ink ink)

Parameters

ink Ink

Returns

TypeStyle

WithInk(Ink)

public TypeStyle WithInk(Ink ink)

Parameters

ink Ink

Returns

TypeStyle

WithLeading(float)

public TypeStyle WithLeading(float multiplier)

Parameters

multiplier float

Returns

TypeStyle

WithPointSize(float)

public TypeStyle WithPointSize(float size)

Parameters

size float

Returns

TypeStyle

WithStrokeInk(Ink)

public TypeStyle WithStrokeInk(Ink ink)

Parameters

ink Ink

Returns

TypeStyle

WithStrokeStyle(StrokeStyle)

public TypeStyle WithStrokeStyle(StrokeStyle style)

Parameters

style StrokeStyle

Returns

TypeStyle

WithStrokeWeight(float)

public TypeStyle WithStrokeWeight(float weight)

Parameters

weight float

Returns

TypeStyle

WithTracking(float)

public TypeStyle WithTracking(float spacing)

Parameters

spacing float

Returns

TypeStyle

WithTypeface(string, params string[])

A copy set in fontFamily, falling back to fallbacks, in order, for any character it lacks — before the library's own fallbacks, and before any installed face that has it.

public TypeStyle WithTypeface(string fontFamily, params string[] fallbacks)

Parameters

fontFamily string
fallbacks string[]

Returns

TypeStyle

Remarks

Naming the typeface again replaces the fallbacks too: with none given, the style has none.

WithWeight(TypeWeight)

public TypeStyle WithWeight(TypeWeight weight)

Parameters

weight TypeWeight

Returns

TypeStyle

WithWordSpacing(float)

public TypeStyle WithWordSpacing(float spacing)

Parameters

spacing float

Returns

TypeStyle