Beispiel #1
0
        private System.Drawing.Rectangle getFontBBox()
        {
            PDFDictionary fontDescriptor = GetDictionary()["FontDescriptor"] as PDFDictionary;

            if (fontDescriptor != null)
            {
                PDFArray fontBBox = fontDescriptor["FontBBox"] as PDFArray;
                if (fontBBox != null)
                {
                    System.Drawing.Rectangle bbox = new System.Drawing.Rectangle();
                    try
                    {
                        bbox.X      = (int)(fontBBox[0] as PDFNumber).GetValue();
                        bbox.Y      = (int)(fontBBox[1] as PDFNumber).GetValue();
                        bbox.Width  = (int)(fontBBox[2] as PDFNumber).GetValue();
                        bbox.Height = (int)(fontBBox[3] as PDFNumber).GetValue();
                    }
                    catch
                    {
                    }
                    return(bbox);
                }
            }

            StandardFonts bf;

            if (isStandardFont(out bf))
            {
                return(Base14Font.GetFontBBox(bf));
            }
            return(new System.Drawing.Rectangle());
        }
Beispiel #2
0
        public static FontBase AddStandardFont(StandardFonts builtFont, bool underline, bool strikeout)
        {
            for (int i = 0; i < _standard.Count; ++i)
            {
                if (_standard[i].BuiltInFontType == builtFont)
                {
                    return(_standard[i]);
                }
            }

            Base14Font pdfFont = new Base14Font(builtFont);

            _standard.Add(pdfFont);
            return(pdfFont);
        }