/// <summary> /// Initializes a new instance of the <see cref="TextLine"/> class. /// </summary> /// <param name="font">The font used to display text in this textline.</param> public TextLine(FontInfo font) : base(Vector2D.Zero, Vector2D.Zero) { this.text = string.Empty; this.font = font; this.color = Color.Black; this.alignment = TextAlignment.Left; }
/// <summary> /// Initializes a new DeadDog.PDF.FontInfo based on a System.Drawing.Font object. /// </summary> /// <param name="font">The System.Drawing.Font object from which to create the new FontInfo.</param> public FontInfo(System.Drawing.Font font) : this(font.Name, font.Size, font.Style, FontInfo.getFont(font)) { }
public static Vector2D CalculateSize(string text, FontInfo font) { var arr = text.Split('\n'); Vector1D w = arr.Max(x => font.MeasureStringWidth(x)); return new Vector2D(w, font.Height * arr.Length); }