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; } }
/** * Copy constructor. * @param source another GraphicsState object */ public GraphicsState(GraphicsState source) { // note: all of the following are immutable, with the possible exception of font // so it is safe to copy them as-is ctm = source.ctm; characterSpacing = source.characterSpacing; wordSpacing = source.wordSpacing; horizontalScaling = source.horizontalScaling; leading = source.leading; font = source.font; fontSize = source.fontSize; renderMode = source.renderMode; rise = source.rise; knockout = source.knockout; colorSpaceFill = source.colorSpaceFill; colorSpaceStroke = source.colorSpaceStroke; fillColor = source.fillColor; strokeColor = source.strokeColor; lineWidth = source.lineWidth; lineCapStyle = source.lineCapStyle; lineJoinStyle = source.lineJoinStyle; miterLimit = source.miterLimit; if (source.lineDashPattern != null) { lineDashPattern = new LineDashPattern(source.lineDashPattern.DashArray, source.lineDashPattern.DashPhase); } }
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; }
/** * Gets the font pointed to by the indirect reference. The font may have been cached. * @param ind the indirect reference ponting to the font * @return the font * @since 5.0.6 */ private CMapAwareDocumentFont GetFont(PRIndirectReference ind) { CMapAwareDocumentFont font; cachedFonts.TryGetValue(ind.Number, out font); if (font == null) { font = new CMapAwareDocumentFont(ind); cachedFonts[ind.Number] = font; } return(font); }
/** * Constructs a new Graphics State object with the default values. */ public GraphicsState() { ctm = new Matrix(); characterSpacing = 0; wordSpacing = 0; horizontalScaling = 1.0f; leading = 0; font = null; fontSize = 0; renderMode = 0; rise = 0; knockout = true; }
/** * Copy constructor. * @param source another GraphicsState object */ public GraphicsState(GraphicsState source) { // note: all of the following are immutable, with the possible exception of font // so it is safe to copy them as-is ctm = source.ctm; characterSpacing = source.characterSpacing; wordSpacing = source.wordSpacing; horizontalScaling = source.horizontalScaling; leading = source.leading; font = source.font; fontSize = source.fontSize; renderMode = source.renderMode; rise = source.rise; knockout = source.knockout; }
virtual public void TestWidths() { PdfReader pdfReader = TestResourceUtils.GetResourceAsPdfReader(TEST_RESOURCES_PATH, "fontwithwidthissue.pdf"); try { PdfDictionary fontsDic = pdfReader.GetPageN(1).GetAsDict(PdfName.RESOURCES).GetAsDict(PdfName.FONT); PRIndirectReference fontDicIndirect = (PRIndirectReference)fontsDic.Get(new PdfName("F1")); CMapAwareDocumentFont f = new CMapAwareDocumentFont(fontDicIndirect); Assert.IsTrue(f.GetWidth('h') != 0, "Width should not be 0"); } finally { pdfReader.Close(); } }
/** * Constructs a new Graphics State object with the default values. */ public GraphicsState() { ctm = new Matrix(); characterSpacing = 0; wordSpacing = 0; horizontalScaling = 1.0f; leading = 0; font = null; fontSize = 0; renderMode = 0; rise = 0; knockout = true; colorSpaceFill = null; colorSpaceStroke = null; fillColor = null; strokeColor = null; }
/** * Constructs a new Graphics State object with the default values. */ public GraphicsState(){ ctm = new Matrix(); characterSpacing = 0; wordSpacing = 0; horizontalScaling = 1.0f; leading = 0; font = null; fontSize = 0; renderMode = 0; rise = 0; knockout = true; colorSpaceFill = null; colorSpaceStroke = null; fillColor = null; strokeColor = null; lineWidth = 1.0f; lineCapStyle = PdfContentByte.LINE_CAP_BUTT; lineJoinStyle = PdfContentByte.LINE_JOIN_MITER; miterLimit = 10.0f; }
/** * Gets the font pointed to by the indirect reference. The font may have been cached. * @param ind the indirect reference ponting to the font * @return the font * @since 5.0.6 */ private CMapAwareDocumentFont GetFont(PRIndirectReference ind) { CMapAwareDocumentFont font; cachedFonts.TryGetValue(ind.Number, out font); if (font == null) { font = new CMapAwareDocumentFont(ind); cachedFonts[ind.Number] = font; } return font; }
/** * Copy constructor. * @param source another GraphicsState object */ public GraphicsState(GraphicsState source){ // note: all of the following are immutable, with the possible exception of font // so it is safe to copy them as-is ctm = source.ctm; characterSpacing = source.characterSpacing; wordSpacing = source.wordSpacing; horizontalScaling = source.horizontalScaling; leading = source.leading; font = source.font; fontSize = source.fontSize; renderMode = source.renderMode; rise = source.rise; knockout = source.knockout; colorSpaceFill = source.colorSpaceFill; colorSpaceStroke = source.colorSpaceStroke; fillColor = source.fillColor; strokeColor = source.strokeColor; lineWidth = source.lineWidth; lineCapStyle = source.lineCapStyle; lineJoinStyle = source.lineJoinStyle; miterLimit = source.miterLimit; if (source.lineDashPattern != null) { lineDashPattern = new LineDashPattern(source.lineDashPattern.DashArray, source.lineDashPattern.DashPhase); } }
/** * Copy constructor. * @param source another GraphicsState object */ public GraphicsState(GraphicsState source){ // note: all of the following are immutable, with the possible exception of font // so it is safe to copy them as-is ctm = source.ctm; characterSpacing = source.characterSpacing; wordSpacing = source.wordSpacing; horizontalScaling = source.horizontalScaling; leading = source.leading; font = source.font; fontSize = source.fontSize; renderMode = source.renderMode; rise = source.rise; knockout = source.knockout; colorSpaceFill = source.colorSpaceFill; colorSpaceStroke = source.colorSpaceStroke; fillColor = source.fillColor; strokeColor = source.strokeColor; }
/** * Constructs a new Graphics State object with the default values. */ public GraphicsState(){ ctm = new Matrix(); characterSpacing = 0; wordSpacing = 0; horizontalScaling = 1.0f; leading = 0; font = null; fontSize = 0; renderMode = 0; rise = 0; knockout = true; colorSpaceFill = null; colorSpaceStroke = null; fillColor = null; strokeColor = null; }