GetFont() private method

private GetFont ( PRIndirectReference ind ) : CMapAwareDocumentFont
ind PRIndirectReference
return CMapAwareDocumentFont
            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List <PdfObject> operands)
            {
                PdfName       dictionaryName = (PdfName)operands[0];
                PdfDictionary extGState      = processor.resources.GetAsDict(PdfName.EXTGSTATE);

                if (extGState == null)
                {
                    throw new ArgumentException(MessageLocalization.GetComposedMessage("resources.do.not.contain.extgstate.entry.unable.to.process.oper.1", oper));
                }
                PdfDictionary gsDic = extGState.GetAsDict(dictionaryName);

                if (gsDic == null)
                {
                    throw new ArgumentException(MessageLocalization.GetComposedMessage("1.is.an.unknown.graphics.state.dictionary", dictionaryName));
                }

                // at this point, all we care about is the FONT entry in the GS dictionary
                PdfArray fontParameter = gsDic.GetAsArray(PdfName.FONT);

                if (fontParameter != null)
                {
                    CMapAwareDocumentFont font = processor.GetFont((PRIndirectReference)fontParameter[0]);
                    float size = fontParameter.GetAsNumber(1).FloatValue;

                    processor.Gs().font     = font;
                    processor.Gs().fontSize = size;
                }
            }
Ejemplo n.º 2
0
            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List <PdfObject> operands)
            {
                PdfName fontResourceName = (PdfName)operands[0];
                float   size             = ((PdfNumber)operands[1]).FloatValue;

                PdfDictionary         fontsDictionary = processor.resources.GetAsDict(PdfName.FONT);
                CMapAwareDocumentFont font            = processor.GetFont((PRIndirectReference)fontsDictionary.Get(fontResourceName));

                processor.Gs().font     = font;
                processor.Gs().fontSize = size;
            }
Ejemplo n.º 3
0
            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List<PdfObject> operands) {

                PdfName dictionaryName = (PdfName)operands[0];
                PdfDictionary extGState = processor.resources.GetAsDict(PdfName.EXTGSTATE);
                if (extGState == null)
                    throw new ArgumentException(MessageLocalization.GetComposedMessage("resources.do.not.contain.extgstate.entry.unable.to.process.oper.1", oper));
                PdfDictionary gsDic = extGState.GetAsDict(dictionaryName);
                if (gsDic == null)
                    throw new ArgumentException(MessageLocalization.GetComposedMessage("1.is.an.unknown.graphics.state.dictionary", dictionaryName));

                // at this point, all we care about is the FONT entry in the GS dictionary
                PdfArray fontParameter = gsDic.GetAsArray(PdfName.FONT);
                if (fontParameter != null){
                    CMapAwareDocumentFont font = processor.GetFont((PRIndirectReference)fontParameter[0]);
                    float size = fontParameter.GetAsNumber(1).FloatValue;

                    processor.Gs().font = font;
                    processor.Gs().fontSize = size;
                }
            }
Ejemplo n.º 4
0
            public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List<PdfObject> operands) {
                PdfName fontResourceName = (PdfName)operands[0];
                float size = ((PdfNumber)operands[1]).FloatValue;

                PdfDictionary fontsDictionary = processor.resources.GetAsDict(PdfName.FONT);
                CMapAwareDocumentFont font;
                PdfObject fontObject = fontsDictionary.Get(fontResourceName);
                if (fontObject is PdfDictionary)
                    font = processor.GetFont((PdfDictionary)fontObject);
                else
                    font = processor.GetFont((PRIndirectReference)fontObject);

                processor.Gs().font = font;
                processor.Gs().fontSize = size;

            }