コード例 #1
0
        /// <summary>
        /// Gets a PdfFont from an XFont. If no PdfFont already exists, a new one is created.
        /// </summary>
        public PdfFont GetFont(XFont font)
        {
            string selector = font.Selector;

            if (selector == null)
            {
                selector      = ComputeKey(font); //new FontSelector(font);
                font.Selector = selector;
            }
            PdfFont pdfFont;

            if (!_fonts.TryGetValue(selector, out pdfFont))
            {
                if (font.Unicode)
                {
                    pdfFont = new PdfType0Font(Owner, font, font.IsVertical);
                }
                else
                {
                    pdfFont = new PdfTrueTypeFont(Owner, font);
                }
                //pdfFont.Document = _document;
                Debug.Assert(pdfFont.Owner == Owner);
                _fonts[selector] = pdfFont;
            }
            return(pdfFont);
        }
コード例 #2
0
        /// <summary>
        /// Gets a PdfFont from a font program. If no PdfFont already exists, a new one is created.
        /// </summary>
        public PdfFont GetFont(string idName, byte[] fontData)
        {
            Debug.Assert(false);
            //FontSelector selector = new FontSelector(idName);
            string  selector = null; // ComputeKey(font); //new FontSelector(font);
            PdfFont pdfFont;

            if (!_fonts.TryGetValue(selector, out pdfFont))
            {
                //if (font.Unicode)
                pdfFont = new PdfType0Font(Owner, idName, fontData, false);
                //else
                //  pdfFont = new PdfTrueTypeFont(_owner, font);
                //pdfFont.Document = _document;
                Debug.Assert(pdfFont.Owner == Owner);
                _fonts[selector] = pdfFont;
            }
            return(pdfFont);
        }