Exemple #1
0
        private void parseFont(List <IPDFPageOperation> operations)
        {
            for (int i = operations.Count - 1; i >= 0; --i)
            {
                if (operations[i] is TextFont)
                {
                    PDFDictionary fontDict = Owner.GetAcroFormFont(((TextFont)operations[i]).FontName.Substring(1));
                    float         fontSize = ((TextFont)operations[i]).FontSize;
                    if (fontDict != null)
                    {
                        _font = new Font(FontBase.Instance(fontDict));
                    }
                    else
                    {
                        _font = new Font(StandardFonts.Helvetica, 8);
                    }

                    _font.Size = fontSize;
                    break;
                }
            }

            if (_font == null)
            {
                _font = new Font(StandardFonts.Helvetica, 12);
            }
            _font.ChangedFontSize += changedFontSize;
        }
Exemple #2
0
        private static void changeFont(ref TextState currentTextState, Resources resources, TextFont textFont)
        {
            IPDFObject obj = resources.GetResource(textFont.FontName, ResourceType.Font);

            if (obj is PDFDictionary)
            {
                currentTextState.FontBase = FontBase.Instance(obj as PDFDictionary);
            }
            currentTextState.FontSize = textFont.FontSize;
        }