public PdfFont(string typeface, bool bold = false, bool italic = false) { Typeface = typeface; Bold = bold; Italic = italic; _metrics = PdfFontDatabase.GetFont(typeface, bold, italic); }
public virtual void Refresh() { if (_abs_rectangle == null) { // quebrar linhas e calcular posição de cada linha de texto if (TextLines.Count() > 0) { (_lines_out, _text_width, _text_height) = PdfFontMetrics.TextCoordinates( width: CalcMaxTextWidth(), lines: TextLines.Select(x => new PdfTextIn( metrics: x.Font.FontMetrics, font_name: x.Font.ElementName, codepage: x.Font.CodePage, text_scale: x.TextScale, text: x.TextLine, h_align: x.HAlign, color: x.Color, kerning: x.Font.Kerning))); } else { _lines_out = null; _text_width = 0; _text_height = 0; } // calcular dimensões do box _abs_rectangle = CalcRectangle(_text_width, _text_height); } }
/** * @see Graphics#getFontMetrics(Font) */ public FontMetrics getFontMetrics(Font f) { if (onlyShapes) { return(dg2.getFontMetrics(f)); } if (f == font) { if (fontMetrics == null) { fontMetrics = new PdfFontMetrics(f, getCachedBaseFont(f)); } return(fontMetrics); } return(new PdfFontMetrics(f, getCachedBaseFont(f))); }
/** * @see Graphics#setFont(Font) */ /** * Sets the current font. */ public void setFont(Font f) { if (onlyShapes) { font = f; return; } if (f == font) { return; } fontMetrics = null; font = f; fontSize = f.getSize2D(); baseFont = getCachedBaseFont(f); }