Examples of BaseFont


Examples of com.lowagie.text.pdf.BaseFont

        style |= Font.UNDERLINE;
      }

      final BaseFontFontMetrics fontMetrics = metaData.getBaseFontFontMetrics
          (fontName, fontSize, bold, italic, "utf-8", false, false);
      final BaseFont baseFont = fontMetrics.getBaseFont();
      final Font font = new Font(baseFont, (float) fontSize, style, textColor);
      final Chunk c = new Chunk(text, font);
      if (backgroundColor != null)
      {
        c.setBackground(backgroundColor);
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

    {
      cb = textSpec.getContentByte();
    }

    final BaseFontFontMetrics baseFontRecord = textSpec.getFontMetrics();
    final BaseFont baseFont = baseFontRecord.getBaseFont();
    final float ascent = baseFont.getFontDescriptor(BaseFont.BBOXURY, textSpec.getFontSize());
    final float y2 = (float) (StrictGeomUtility.toExternalValue(posY) + ascent);
    final float y = globalHeight - y2;

    final AffineTransform affineTransform = textSpec.getGraphics().getTransform();
    final float translateX = (float) affineTransform.getTranslateX();

    final FontNativeContext nativeContext = baseFontRecord.getNativeContext();
    if (baseFontRecord.isTrueTypeFont() && textSpec.isBold() && nativeContext.isNativeBold() == false)
    {
      final float strokeWidth = textSpec.getFontSize() / 30.0f; // right from iText ...
      if (strokeWidth == 1)
      {
        cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
      }
      else
      {
        cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
        cb.setLineWidth(strokeWidth);
      }
    }
    else
    {
      cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
    }

    // if the font does not declare to be italics already, emulate it ..
    if (baseFontRecord.isTrueTypeFont() && textSpec.isItalics() && nativeContext.isNativeItalics() == false)
    {
      final float italicAngle =
          baseFont.getFontDescriptor(BaseFont.ITALICANGLE, textSpec.getFontSize());
      if (italicAngle == 0)
      {
        // italics requested, but the font itself does not supply italics gylphs.
        cb.setTextMatrix(1, 0, PdfLogicalPageDrawable.ITALIC_ANGLE, 1, x1 + translateX, y);
      }
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

      final PdfTextSpec pdfTextSpec = computeFont(c);
      final int style = computeStyle(attributes, pdfTextSpec);

      final Color paint = (Color) c.getStyleSheet().getStyleProperty(ElementStyleKeys.PAINT);
      // add chunks
      BaseFont baseFont = pdfTextSpec.getFontMetrics().getBaseFont();
      Font font = new Font(baseFont, size.floatValue(), style, paint);

      if (c.getOriginatingTextNode() instanceof RenderableReplacedContentBox)
      {
        RenderableReplacedContentBox content = (RenderableReplacedContentBox) c.getOriginatingTextNode();
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

      }
    }

    try
    {
      final BaseFont baseFont = BaseFont.createFont
          (fontType, encoding, embedded, false, ttfAfm, pfb);
      return new CompoundResource(key, dc, baseFont, getFactoryType());
    }
    catch (Exception e)
    {
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

                throw new InstantiationException(
                        "You need to add a text for the watermark");
            }
            int fontsize = Integer.parseInt((String) getValue("fontsize"));
            float opacity = Float.parseFloat((String) getValue("opacity"));
            BaseFont bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI,
                                              false);
            PdfReader reader = new PdfReader(((File) getValue("srcfile"))
                                             .getAbsolutePath());
            int pagecount = reader.getNumberOfPages();
            PdfGState gs1 = new PdfGState();
            gs1.setFillOpacity(opacity);
            String text = (String) getValue("watermark");
            PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(
                    (File) getValue("destfile")));
            float txtwidth = bf.getWidthPoint(text, fontsize);
            for (int i = 1; i <= pagecount; i++) {
                PdfContentByte seitex = stamp.getOverContent(i);
                LwgRectangle recc = reader.getCropBox(i);
                float winkel = (float) Math.atan(recc.getHeight() /
                                                 recc.getWidth());
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

                        document.open();
                    }
                    img.setAbsolutePosition(0, 0);
                    document.add(img);

                    BaseFont bf = BaseFont.createFont("Helvetica",
                            BaseFont.WINANSI,
                            false);
                    PdfGState gs1 = new PdfGState();
                    gs1.setBlendMode(PdfGState.BM_OVERLAY);
                    PdfContentByte cb = writer.getDirectContent();
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

      float fltRed = ((float) colForeground.getRed()) / 256f;
      float fltGreen = ((float) colForeground.getGreen()) / 256f;
      float fltBlue = ((float) colForeground.getBlue()) / 256f;

      PdfTemplate template = writer.getDirectContent().createTemplate(20, 20);
      BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false);
      String text = strWhat;
      float size = 8;
      float width = bf.getWidthPoint(text, size);
      template.beginText();
      template.setRGBColorFillF(fltRed, fltGreen, fltBlue);
      template.setFontAndSize(bf, size);
      template.setTextMatrix(0, 2);
      template.showText(text);
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

            }

            img.setAbsolutePosition(0, 0);
            document.add(img);

            BaseFont bf = BaseFont.createFont("Helvetica",
                     BaseFont.WINANSI,
                     false);

            PdfGState gs1 = new PdfGState();
            gs1.setBlendMode(PdfGState.BM_OVERLAY);
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

    if (style == UNDEFINED) {
      style = NORMAL;
    }
    String fontName = BaseFont.HELVETICA;
    String encoding = BaseFont.WINANSI;
    BaseFont cfont = null;
    switch (family) {
    case COURIER:
      switch (style & BOLDITALIC) {
      case BOLD:
        fontName = BaseFont.COURIER_BOLD;
View Full Code Here

Examples of com.lowagie.text.pdf.BaseFont

            if (font.getColor() != null) {
                writeCssProperty(Markup.CSS_KEY_COLOR, HtmlEncoder.encode(font.getColor()));
            }
           
            int fontstyle = font.getStyle();
            BaseFont bf = font.getBaseFont();
            if (bf != null) {
                String ps = bf.getPostscriptFontName().toLowerCase();
                if (ps.indexOf("bold") >= 0) {
                    if (fontstyle == LwgFont.UNDEFINED)
                        fontstyle = 0;
                    fontstyle |= LwgFont.BOLD;
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.