/** * Constructs a RtfFont from a com.lowagie.text.Font * @param doc The RtfDocument this font appears in * @param font The Font to use as a base */ public RtfFont(RtfDocument doc, Font font) { this.document = doc; if (font != null) { if (font is RtfFont) { this.fontName = ((RtfFont) font).GetFontName(); this.charset = ((RtfFont) font).GetCharset(); } else { SetToDefaultFamily(font.Familyname); } if (font.BaseFont != null) { String[][] fontNames = font.BaseFont.FullFontName; for (int i = 0; i < fontNames.Length; i++) { if (fontNames[i][2].Equals("0")) { this.fontName = fontNames[i][3]; break; } else if (fontNames[i][2].Equals("1033") || fontNames[i][2].Equals("")) { this.fontName = fontNames[i][3]; } } } Size = font.Size; SetStyle(font.Style); Color = font.Color; if(document != null) { this.fontNumber = document.GetDocumentHeader().GetFontNumber(this); } } if (Util.EqualsIgnoreCase(this.fontName, "unknown")) { return; } if (document != null) { SetRtfDocument(document); } }
/** * Sets the RtfDocument this RtfFont belongs to * * @param doc The RtfDocument to use */ public void SetRtfDocument(RtfDocument doc) { this.document = doc; if (document != null) { this.fontNumber = document.GetDocumentHeader().GetFontNumber(this); } if (this.color != null) { this.color.SetRtfDocument(this.document); } }
/// <summary> /// Registers the RtfParagraphStyle for further use in the document. This does not need to be /// done for the default styles in the RtfParagraphStyle object. Those are added automatically. /// </summary> /// <param name="rtfParagraphStyle">The RtfParagraphStyle to register.</param> public void RegisterParagraphStyle(RtfParagraphStyle rtfParagraphStyle) { _document.GetDocumentHeader().RegisterParagraphStyle(rtfParagraphStyle); }