// ReSharper disable RedundantDefaultMemberInitializer
namespace UglyToad.PdfPig.Graphics
{
using Core;
using Operations.SpecialGraphicsState;
using PdfPig.Core;
using Tokens;
///
/// The current state of text related parameters for a content stream.
///
public class CurrentFontState : IDeepCloneable
{
///
/// Whether the font comes from the extended graphics state via the operator.
///
public bool FromExtendedGraphicsState { get; set; } = false;
///
/// A value in unscaled text space units which is added to the horizontal (or vertical if in vertical writing mode)
/// glyph displacement.
///
///
/// In horizontal writing mode a positive value will expand the distance between letters/glyphs.
/// Default value 0.
///
public decimal CharacterSpacing { get; set; } = 0;
///
/// As for but applies only for the space character (32).
///
///
/// Default value 0.
///
public decimal WordSpacing { get; set; } = 0;
///
/// Adjusts the width of glyphs/letters by stretching (or compressing) them horizontally.
/// Value is a percentage of the normal width.
///
public decimal HorizontalScaling { get; set; } = 100;
///
/// The vertical distance in unscaled text space units between the baselines of lines of text.
///
public decimal Leading { get; set; }
///
/// The name of the currently active font.
///
public NameToken FontName { get; set; }
///
/// The current font size.
///
public decimal FontSize { get; set; }
///
/// The for glyph outlines.
///
///
/// When the rendering mode requires filling the current non-stroking color in the state is used.
/// When the rendering mode requires stroking the current stroking color in the state is used.
/// The rendering mode has no impact on Type 3 fonts.
///
public TextRenderingMode TextRenderingMode { get; set; } = TextRenderingMode.Fill;
///
/// The distance in unscaled text space units to move the default baseline either up or down.
///
///
/// Always applies to the vertical coordinate irrespective or writing mode.
///
public decimal Rise { get; set; }
///
/// Are all glyphs in a text object treated as a single elementary object for the purpose of the transparent imaging model?
///
public bool Knockout { get; set; }
///
public CurrentFontState DeepClone()
{
return new CurrentFontState
{
CharacterSpacing = CharacterSpacing,
TextRenderingMode = TextRenderingMode,
Rise = Rise,
Leading = Leading,
WordSpacing = WordSpacing,
FontName = FontName,
FontSize = FontSize,
HorizontalScaling = HorizontalScaling,
Knockout = Knockout
};
}
}
}