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
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
Default
public static TypeStyle Default { get; }
Property Value
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
EffectivePointSize
The font size actually rendered, shrunk for sub- and superscript runs.
public float EffectivePointSize { get; }
Property Value
Fallbacks
The typefaces tried, in order, for characters Typeface lacks.
public IReadOnlyList<string> Fallbacks { get; }
Property Value
HasOverline
public bool HasOverline { get; init; }
Property Value
HasStrikeThrough
public bool HasStrikeThrough { get; init; }
Property Value
HasUnderline
public bool HasUnderline { get; init; }
Property Value
Highlight
public Ink Highlight { get; init; }
Property Value
Ink
public Ink Ink { get; init; }
Property Value
IsItalic
public bool IsItalic { get; init; }
Property Value
Leading
Multiplier applied to the font's natural line height: zero or more.
public float Leading { get; init; }
Property Value
PointSize
The size text is set at, in points: zero or more.
public float PointSize { get; init; }
Property Value
Script
public ScriptPosition Script { get; init; }
Property Value
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
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
Tracking
Additional space inserted between characters, in points; negative tightens.
public float Tracking { get; init; }
Property Value
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
Weight
public TypeWeight Weight { get; init; }
Property Value
WordSpacing
Additional space added to each space between words, in points; negative tightens.
public float WordSpacing { get; init; }
Property Value
Methods
Bold()
public TypeStyle Bold()
Returns
BreakAnywhere(bool)
public TypeStyle BreakAnywhere(bool value = true)
Parameters
valuebool
Returns
Italic(bool)
public TypeStyle Italic(bool value = true)
Parameters
valuebool
Returns
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
valuebool
Returns
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
valuebool
Returns
Overline(bool)
public TypeStyle Overline(bool value = true)
Parameters
valuebool
Returns
SmallCapitals(bool)
A copy with lowercase letters set as small capitals, where the face has them.
public TypeStyle SmallCapitals(bool value = true)
Parameters
valuebool
Returns
StrikeThrough(bool)
public TypeStyle StrikeThrough(bool value = true)
Parameters
valuebool
Returns
Subscript()
public TypeStyle Subscript()
Returns
Superscript()
public TypeStyle Superscript()
Returns
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
valuebool
Returns
Underline(bool)
public TypeStyle Underline(bool value = true)
Parameters
valuebool
Returns
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
directionReadingDirection?
Returns
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
Returns
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
tagis not four printable ASCII characters.- ArgumentOutOfRangeException
valueis negative.
WithHighlight(Ink)
public TypeStyle WithHighlight(Ink ink)
Parameters
inkInk
Returns
WithInk(Ink)
public TypeStyle WithInk(Ink ink)
Parameters
inkInk
Returns
WithLeading(float)
public TypeStyle WithLeading(float multiplier)
Parameters
multiplierfloat
Returns
WithPointSize(float)
public TypeStyle WithPointSize(float size)
Parameters
sizefloat
Returns
WithStrokeInk(Ink)
public TypeStyle WithStrokeInk(Ink ink)
Parameters
inkInk
Returns
WithStrokeStyle(StrokeStyle)
public TypeStyle WithStrokeStyle(StrokeStyle style)
Parameters
styleStrokeStyle
Returns
WithStrokeWeight(float)
public TypeStyle WithStrokeWeight(float weight)
Parameters
weightfloat
Returns
WithTracking(float)
public TypeStyle WithTracking(float spacing)
Parameters
spacingfloat
Returns
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
Returns
Remarks
Naming the typeface again replaces the fallbacks too: with none given, the style has none.
WithWeight(TypeWeight)
public TypeStyle WithWeight(TypeWeight weight)
Parameters
weightTypeWeight
Returns
WithWordSpacing(float)
public TypeStyle WithWordSpacing(float spacing)
Parameters
spacingfloat