Examples of BaseFont


Examples of com.itextpdf.text.pdf.BaseFont

        Font font = label.getFont();

        setFillColor(label.getColor());

        try {
            BaseFont bf = genBaseFont(font);
            float ascent = bf.getAscentPoint(label.getValue(), font.getSize());
            float descent = bf.getDescentPoint(label.getValue(), font.getSize());
            float textHeight = (ascent - descent) / 2f;

            cb.beginText();
            cb.setFontAndSize(bf, font.getSize());
            cb.showTextAligned(PdfContentByte.ALIGN_CENTER, label.getValue(), p.getX(), -p.getY() - textHeight, 0);
View Full Code Here

Examples of com.itextpdf.text.pdf.BaseFont

        Font font = label.getFont();

        setFillColor(label.getColor());

        try {
            BaseFont bf = genBaseFont(font);

            cb.beginText();
            cb.setFontAndSize(bf, font.getSize());
            cb.showTextAligned(PdfContentByte.ALIGN_CENTER, label.getValue(), p.getX(), -p.getY(), (float) (Math.toDegrees(-label.getAngle())));
            cb.endText();
View Full Code Here

Examples of com.itextpdf.text.pdf.BaseFont

        Font font = miniLabel.getFont();

        setFillColor(miniLabel.getColor());

        try {
            BaseFont bf = genBaseFont(font);

            cb.beginText();
            cb.setFontAndSize(bf, font.getSize());
            cb.showTextAligned(miniLabel.getHAlign().toIText(), miniLabel.getValue(), p.getX(), -p.getY(), (float) (Math.toDegrees(-miniLabel.getAngle())));
            cb.endText();
View Full Code Here

Examples of com.itextpdf.text.pdf.BaseFont

  private void prepareContent() {
    Document document = null;

    try {
      BaseFont bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1250,
          BaseFont.EMBEDDED);
      Font f = new Font(bf, 12, Font.NORMAL);

      document = new Document(PageSize.A4, 10, 10, 50, 50);
      PdfWriter instance = PdfWriter.getInstance(document, os);
View Full Code Here

Examples of com.itextpdf.text.pdf.BaseFont

        }
        boolean italic = fs.isFontItalic();
        if (italicToggle) {
            italic = !italic;
        }
        BaseFont bf = italic ? (bold ? ff.getBoldItalicFont() : ff.getItalicFont()) : (bold ? ff.getBoldFont() : ff.getRegularFont());
        return bf;
    }
View Full Code Here

Examples of com.itextpdf.text.pdf.BaseFont

    }

    public Font getFont()
            throws FB2toPDFException {

        BaseFont bf = getBaseFont();
        float points = getFontSize();
        if (halfSizeToggle) {
            points = points / 2;
        }
        final Font font = new Font(bf, points);
View Full Code Here

Examples of com.itextpdf.text.pdf.BaseFont

    }

    public Font getTinyFont()
            throws FB2toPDFException {
        FontFamily ff = getFontFamily();
        BaseFont bf = ff.getRegularFont();

        return new Font(bf, 0.01f);
    }
View Full Code Here

Examples of com.itextpdf.text.pdf.BaseFont

        baseFont = getCachedBaseFont(f);
    }

    private BaseFont getCachedBaseFont(Font f) {
        synchronized (baseFonts) {
            BaseFont bf = baseFonts.get(f.getFontName());
            if (bf == null) {
                bf = fontMapper.awtToPdf(f);
                baseFonts.put(f.getFontName(), bf);
            }
            return bf;
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

    {
      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();

    if (baseFontRecord.isTrueTypeFont() && textSpec.isBold())
    {
      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())
    {
      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
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.