[]
        
(Showing Draft Content)

GrapeCity.Documents.Text.TextFormat

Class TextFormat

Namespace
GrapeCity.Documents.Text
Assembly
GcDocs.Imaging.dll

Represents text formatting attributes such as font, language, colors, decorations and so on.

public class TextFormat
Inheritance
object
TextFormat
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Constructors

TextFormat()

Initializes a new instance of TextFormat.

public TextFormat()

TextFormat(TextFormat)

Creates a copy of a TextFormat object.

public TextFormat(TextFormat source)

Parameters

source TextFormat

Properties

AllowFallbackToEudcFonts

Gets or sets a value indicating whether EUDC fonts should be searched for missing user-defined characters.

The default is true.

public bool AllowFallbackToEudcFonts { get; set; }

Property Value

bool

AllowFontSbits

Gets or sets a value indicating if the embedded bitmaps from the EBDT font table can be used.

The default is true.

This property affects text drawing on GcBitmapGraphics only. Also, it has no effect if UseBitmapCache is set to false.

public bool AllowFontSbits { get; set; }

Property Value

bool

BackColor

Gets or sets the text background color. The default is transparent.

public Color BackColor { get; set; }

Property Value

System.Drawing.Color

CharWidthFactor

Gets or sets the character width scale factor (or height scale factor for vertical text).

Valid values are between 0.1 and 10.0. The default is 1.0.

public float CharWidthFactor { get; set; }

Property Value

float

DoubleUnderline

Gets or sets a value indicating if the text is double underlined.

public bool DoubleUnderline { get; set; }

Property Value

bool

EnableFontHinting

Gets or sets a value indicating whether font hinting should be enabled for TrueType fonts.

The default is true.

This property affects text drawing on GcBitmapGraphics only.

public bool EnableFontHinting { get; set; }

Property Value

bool

FillBrush

Gets or sets the Brush to fill the glyphs.

The FillBrush property has a priority over the ForeColor.

public Brush FillBrush { get; set; }

Property Value

Brush

Font

Gets or sets a Font used by this format.

If not null, this value overrides the FontName property.

public Font Font { get; set; }

Property Value

Font

FontBold

Gets or sets a value indicating whether the font should be bolded.

public bool FontBold { get; set; }

Property Value

bool

FontFeatures

Provides access to a set of Microsoft OpenType typography properties.

public FontFeature[] FontFeatures { get; set; }

Property Value

FontFeature[]

FontItalic

Gets or sets whether the font should be italicized.

public bool FontItalic { get; set; }

Property Value

bool

FontName

Gets or sets a font family name.

This value is used only if the Font property is null.

This value is case insensitive.

public string FontName { get; set; }

Property Value

string

FontSize

Gets or sets the logical font size, in points or in graphic units.

The default value is 12.

See also the description of the FontSizeInGraphicUnits property.

public float FontSize { get; set; }

Property Value

float

FontSizeInGraphicUnits

Gets or sets a value indicating whether FontSize specifies the font size in graphic units or in points.

public bool FontSizeInGraphicUnits { get; set; }

Property Value

bool

FontStyle

Gets or sets the flags indicating the desired or emulated style of the font.

public FontStyle FontStyle { get; set; }

Property Value

FontStyle

ForeColor

Gets or sets the text foreground color. The default is black.

The FillBrush property has a priority over the ForeColor.

public Color ForeColor { get; set; }

Property Value

System.Drawing.Color

GlyphAdvanceFactor

Gets or sets the scaling factor for the glyph advance value relative to font's Average Character Width.

Valid values are from 0.5 up. The default is 1.

public float GlyphAdvanceFactor { get; set; }

Property Value

float

GlyphAdvanceOffset

Gets or sets the absolute increment (delta) for the glyph advance value, in graphic units.

public float GlyphAdvanceOffset { get; set; }

Property Value

float

GlyphWidths

Gets or sets the preferred glyph widths (generally used in CJKV fonts).

public GlyphWidths GlyphWidths { get; set; }

Property Value

GlyphWidths

Hollow

Gets or sets a value indicating if the glyphs are hollow (outlined), otherwise they are solid.

The StrokePen property must be set in order to draw outlined glyphs.

public bool Hollow { get; set; }

Property Value

bool

Language

Gets or sets a value identifying the language system.

public Language Language { get; set; }

Property Value

Language

LineGap

Gets or sets a value specifying the explicit line gap (if not null), in graphic units.

public float? LineGap { get; set; }

Property Value

float?

Palette

Gets or sets a palette used for drawing color fonts.

public CpalPalette Palette { get; set; }

Property Value

CpalPalette
See Also

RecalcFontSizeForFallbackFonts

Gets or sets a value indicating whether the size of fallback font should be coerced to the size of original font (true by default).

This property does not affect behavior of linked fonts with specified scale factor.

public bool RecalcFontSizeForFallbackFonts { get; set; }

Property Value

bool

Script

Gets or sets an OpenType script tag.

public ScriptTag Script { get; set; }

Property Value

ScriptTag

SidewaysInVerticalText

Gets or sets a value indicating if all characters should appear as rotated 90 or -90 degrees in vertical text.

public bool SidewaysInVerticalText { get; set; }

Property Value

bool

SkipNormalization

Gets or sets a value indicating whether the canonical decomposition, reordering, and composition stages should be omitted.

public bool SkipNormalization { get; set; }

Property Value

bool

StrictCanonicalDecomposition

Gets or sets a value indicating whether to apply normalization to Singleton Decompositions and Post Composition Version precomposed characters.

By default this property is false. If set to true, CJK compatibility ideographs can be changed to CJK unified ideographs during the normalization process.

public bool StrictCanonicalDecomposition { get; set; }

Property Value

bool

Strikethrough

Gets or sets a value indicating if the strikethrough style is applied to the text.

public bool Strikethrough { get; set; }

Property Value

bool

StrokePen

Gets or sets the Pen to draw glyph outlines.

public Pen StrokePen { get; set; }

Property Value

Pen

Subscript

Gets or sets a value indicating if the glyphs should be displayed as subscript.

Setting this property to true also sets the Superscript property to false.

public bool Subscript { get; set; }

Property Value

bool
See Also

Superscript

Gets or sets a value indicating whether the glyphs should be displayed as superscript.

Setting this property to true also sets the Subscript property to false.

public bool Superscript { get; set; }

Property Value

bool
See Also

Tag

Gets or sets an arbitrary custom data associated with this TextFormat.

public object Tag { get; set; }

Property Value

object

TextDecorations

Gets or sets the flags indicating which decorations are applied to the text.

public TextDecorations TextDecorations { get; set; }

Property Value

TextDecorations

TextRunAsCluster

Gets or sets a value indicating whether the whole TextRun should be considered as a single Grapheme Cluster.

It allows displaying several characters side-by-side horizontally in a vertical text.

public bool TextRunAsCluster { get; set; }

Property Value

bool

TransformToFullWidth

Gets or sets a value indicating if ASCII characters should be transformed into fullwidth characters.

public bool TransformToFullWidth { get; set; }

Property Value

bool

TransverseOffset

Gets or sets the offset of the text in the orthogonal direction, in graphic units.

The default is 0.

public float TransverseOffset { get; set; }

Property Value

float

TreatHyphenMinusAsHyphen

Gets or sets a value indicating whether the character 'HYPHEN-MINUS' (U+002D) is treated as the character 'HYPHEN' (U+2010) by the Unicode line breaking algorithm.

public bool TreatHyphenMinusAsHyphen { get; set; }

Property Value

bool

Underline

Gets or sets a value indicating if the text is underlined.

public bool Underline { get; set; }

Property Value

bool

UnderlineOrDoubleUnderline

Gets a value indicating if the text is underlined or double underlined.

public bool UnderlineOrDoubleUnderline { get; }

Property Value

bool

UprightInVerticalText

Gets or sets a value indicating if the normally sideways characters should be drawn upright in vertical text.

public bool UprightInVerticalText { get; set; }

Property Value

bool

UseBitmapCache

Gets or sets a value indicating if the Bitmap Glyph Cache is allowed.

The default is true.

This property affects text drawing on GcBitmapGraphics only.

public bool UseBitmapCache { get; set; }

Property Value

bool

UseHorizontalMetricsForVerticalText

Gets or sets a value indicating if the horizontal ascending, descending, and line gap settings should be applied to vertical text. The special vertical metrics are used by default.

public bool UseHorizontalMetricsForVerticalText { get; set; }

Property Value

bool

UseTypoMetrics

Gets or sets a value indicating whether the typographical font metrics should be applied instead of Windows-specific and Apple-specific font metrics.

Font Ascender, Descender, and Line Gap are affected.

public bool UseTypoMetrics { get; set; }

Property Value

bool

UseVerticalLineGapForSideways

Gets or sets a value indicating that for sideways text in vertical flow (see FlowDirection, line gap will be set according to VerticalLineGap.

If false (the default), line gap for lines containing sideways text is set according to HorizontalLineGap or GrapeCity.Documents.Text.Font.TypoLineGap, which can lead to different gaps between columns that contain sideways text runs and those that do not.

public bool UseVerticalLineGapForSideways { get; set; }

Property Value

bool

Methods

CopyTo(TextFormat)

Copies the current text format settings to another TextFormat object.

public void CopyTo(TextFormat destination)

Parameters

destination TextFormat

The destination TextFormat object.

CultureToLanguage(CultureInfo)

Returns the Language value corresponding to a given System.Globalization.CultureInfo.

public static Language CultureToLanguage(CultureInfo culture)

Parameters

culture System.Globalization.CultureInfo

Returns

Language

The corresponding value, or Default if a specific value could not be found.

ResolveFontName(IFontCollection, bool, Font)

Returns the Font object for the current settings in the FontName, FontBold, FontItalic properties. Note that if the FontName is specified (not empty), this method will return the same font that would be used by a TextLayout given the same settings.

public Font ResolveFontName(IFontCollection fontCollection = null, bool restrictedFontLookup = false, Font defaultFont = null)

Parameters

fontCollection IFontCollection

The IFontCollection to search the font from. If this parameter is omitted the font is searched in SystemFonts only.

restrictedFontLookup bool

Indicates whether or not the font should be searched in the given fontCollection only. If False, the font is also searched in SystemFonts.

defaultFont Font

The default font returned if font with specified name not found, if this parameter is null then fontCollection.DefaultFont or FontCollection.SystemFonts.DefaultFont is used.

Returns

Font

The Font object corresponding to FontName and font style in the current instance of TextFormat.

ScriptCodeToTag(ScriptCode, bool)

Converts a ScriptCode value to the corresponding ScriptTag.

public static ScriptTag ScriptCodeToTag(ScriptCode scriptCode, bool useOldTags = false)

Parameters

scriptCode ScriptCode

A ScriptCode value to convert.

useOldTags bool

Indicates whether the following scripts should be converted to old tags: Bengali, Devanagari, Gujarati, Gurmukhi, Kannada, Malayalam, Myanmar, Odia, Tamil, Telugu.

Returns

ScriptTag

The converted ScriptTag value.