public PdfTextOptions(PdfFont font, double fontSize, PdfColor inkColor, int leftRotationDegrees, PdfTextRenderingMode renderingMode = PdfTextRenderingMode.Fill, PdfColor outlineColor = null, double? outlineWidth = null, PdfLineDashPattern lineDashPattern = null, PdfLineCapStyle? lineCapStyle = null) { this.InkColor = inkColor ?? PdfColor.Black; this.Font = font; this.FontSize = fontSize; this.LeftRotationDegrees = leftRotationDegrees; this.RenderingMode = renderingMode; this.OutlineColor = outlineColor; this.LineDashPattern = lineDashPattern; this.LineCapStyle = LineCapStyle; this.OutlineWidth = outlineWidth; }
/// <summary> /// Begins a block of text with the given start position, rotation and font (convenience method). /// </summary> public void BeginText(double x, double y, double leftRotationDegrees, PdfFont font, double size) { BeginText(x, y, leftRotationDegrees); SetFont(font, size); }
/// <summary> /// Begins a block of text with the given start position and font (convenience method). /// </summary> public void BeginText(double x, double y, PdfFont font, double size) { BeginText(x, y); SetFont(font, size); }
/// <summary> /// Sets the font type and size. /// </summary> public void SetFont(PdfFont font, double size) { if (!isInTextBlock) throw new InvalidOperationException("Must call BeginText() before this operation."); this.Write(font.Name); this.Write(" "); this.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.##} Tf", size)); this.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0:0.##} TL", size)); this.RegisterFont(font); }
/// <summary> /// Registers a font as referenced. /// </summary> protected void RegisterFont(PdfFont font) { if (!this.ReferencedFonts.Contains(font)) ((List<PdfFont>)this.ReferencedFonts).Add(font); }
/// <summary> /// Registers a font for use in this PDF document. /// </summary> public PdfObjectRef RegisterFont(PdfFont font) { PdfObjectRef fontRef; if (this.Fonts.TryGetValue(font.Name, out fontRef)) { return fontRef; } else { fontRef = this.Fonts[font.Name] = this.WriteObject(font); return fontRef; } }