Ejemplo n.º 1
0
 /**
 * 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);
     }
 }
Ejemplo n.º 2
0
        /**
        * 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);
            }
        }