Package com.itextpdf.text

Examples of com.itextpdf.text.Font


      if (pageEmpty) return;
      if (currentHeight + line.height() + leading > indentTop() - indentBottom()) return;
        leading = extraspace;
        carriageReturn();
        if (f.isUnderlined() || f.isStrikethru()) {
            f = new Font(f);
            int style = f.getStyle();
            style &= ~Font.UNDERLINE;
            style &= ~Font.STRIKETHRU;
            f.setStyle(style);
        }
View Full Code Here


      float[] relSize = {3, 2};
      PdfPTable table = new PdfPTable(relSize);
      table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
      table.setWidthPercentage(100);
     
      Font adressFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL);
     
      table.addCell("");
      table.addCell("");
      table.addCell("");
      table.addCell(new Phrase("Matthias M�ller Computerservice", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
      table.addCell("");
      table.addCell(new Phrase("Rheingoldstr. 38a", adressFont));
      table.addCell(anrede);
      table.addCell(new Phrase("56329 St. Goar", adressFont));
      table.addCell(vorname+" "+nachname);
      table.addCell("");
      table.addCell(strasse);
      table.addCell(new Phrase("Telefon:  0 67 41 / 20 74 06", adressFont));
      table.addCell(plz+" "+ort);
      table.addCell(new Phrase("Mobil:     01 52 / 09 80 91 92", adressFont));
      table.addCell("");
       
        //Mail
        Phrase adressPh = new Phrase();
 
        adressPh.add(new Chunk("E-Mail:   ", adressFont));
          Anchor emailLink = new Anchor("kontakt@muellerpc.de", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.UNDERLINE, new BaseColor(Color.BLUE)));
          emailLink.setReference("mailto:kontakt@muellerpc.de");
        adressPh.add(emailLink);
     
      table.addCell(adressPh);
      table.addCell("");
      table.addCell("");
      table.addCell("");
      table.addCell(new Phrase("Datum:   "+adressDate.format(date)+"", adressFont));
     
      adresse.add(table);
     
      Paragraph main = new Paragraph();
     
      main.add(new Paragraph(" "));
      main.add(new Paragraph("Gehaltsabrechnung "+monat.format(date), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)));
     
      //anfang main
     
      float[] relSizeMain = {1,1,1,1,1};
      PdfPTable tableMain = new PdfPTable(relSizeMain);
View Full Code Here

    }
   
    public BaseFont getFont() {
        if (font != null)
            return font;
        Font ff2 = FontFactory.getFont(faceName, BaseFont.CP1252, true, 10, ((italic != 0) ? Font.ITALIC : 0) | ((bold != 0) ? Font.BOLD : 0));
        font = ff2.getBaseFont();
        if (font != null)
            return font;
        String fontName;
        if (faceName.indexOf("courier") != -1 || faceName.indexOf("terminal") != -1
            || faceName.indexOf("fixedsys") != -1) {
View Full Code Here

      if (pageEmpty) return;
      if (currentHeight + line.height() + leading > indentTop() - indentBottom()) return;
        leading = extraspace;
        carriageReturn();
        if (f.isUnderlined() || f.isStrikethru()) {
            f = new Font(f);
            int style = f.getStyle();
            style &= ~Font.UNDERLINE;
            style &= ~Font.STRIKETHRU;
            f.setStyle(style);
        }
View Full Code Here

        if (font.getBaseFont() != null) {
            fonts.add(font);
            return;
        }
        BaseFont bf = font.getCalculatedBaseFont(true);
        Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor());
        fonts.add(f2);
    }
View Full Code Here

        Chunk newChunk = null;
        char c = cc[k];
        if (c == '\n' || c == '\r') {
            sb.append(c);
        } else {
            Font font = null;
            if (Utilities.isSurrogatePair(cc, k)) {
                int u = Utilities.convertToUtf32(cc, k);
                for (int f = 0; f < fonts.size(); ++f) {
                    font = fonts.get(f);
                    if (font.getBaseFont().charExists(u) || Character.getType(u) == Character.FORMAT) {
                        if (currentFont != font) {
                            if (sb.length() > 0 && currentFont != null) {
                                newChunk = new Chunk(sb.toString(), currentFont);
                                sb.setLength(0);
                            }
                            currentFont = font;
                        }
                        sb.append(c);
                        sb.append(cc[++k]);
                        break;
                    }
                }
            } else {
                for (int f = 0; f < fonts.size(); ++f) {
                    font = fonts.get(f);
                    if (font.getBaseFont().charExists(c) || Character.getType(c) == Character.FORMAT) {
                        if (currentFont != font) {
                            if (sb.length() > 0 && currentFont != null) {
                                newChunk = new Chunk(sb.toString(), currentFont);
                                sb.setLength(0);
                            }
View Full Code Here

      if (pageEmpty) return;
      if (currentHeight + line.height() + leading > indentTop() - indentBottom()) return;
        leading = extraspace;
        carriageReturn();
        if (f.isUnderlined() || f.isStrikethru()) {
            f = new Font(f);
            int style = f.getStyle();
            style &= ~Font.UNDERLINE;
            style &= ~Font.STRIKETHRU;
            f.setStyle(style);
        }
View Full Code Here

    }
   
    public BaseFont getFont() {
        if (font != null)
            return font;
        Font ff2 = FontFactory.getFont(faceName, BaseFont.CP1252, true, 10, ((italic != 0) ? Font.ITALIC : 0) | ((bold != 0) ? Font.BOLD : 0));
        font = ff2.getBaseFont();
        if (font != null)
            return font;
        String fontName;
        if (faceName.indexOf("courier") != -1 || faceName.indexOf("terminal") != -1
            || faceName.indexOf("fixedsys") != -1) {
View Full Code Here

    PdfChunk(Chunk chunk, PdfAction action) {
        thisChunk[0] = this;
        value = chunk.getContent();

        Font f = chunk.getFont();
        float size = f.getSize();
        if (size == Font.UNDEFINED)
            size = 12;
        baseFont = f.getBaseFont();
        int style = f.getStyle();
        if (style == Font.UNDEFINED) {
            style = Font.NORMAL;
        }
        if (baseFont == null) {
            // translation of the font-family to a PDF font-family
            baseFont = f.getCalculatedBaseFont(false);
        }
        else {
            // bold simulation
            if ((style & Font.BOLD) != 0)
                attributes.put(Chunk.TEXTRENDERMODE, new Object[]{new Integer(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE), new Float(size / 30f), null});
            // italic simulation
            if ((style & Font.ITALIC) != 0)
                attributes.put(Chunk.SKEW, new float[]{0, ITALIC_ANGLE});
        }
        font = new PdfFont(baseFont, size);
        // other style possibilities
        HashMap<String, Object> attr = chunk.getAttributes();
        if (attr != null) {
            for (Map.Entry<String, Object>entry: attr.entrySet()) {
                String name = entry.getKey();
                if (keysAttributes.contains(name)) {
                    attributes.put(name, entry.getValue());
                }
                else if (keysNoStroke.contains(name)) {
                    noStroke.put(name, entry.getValue());
                }
            }
            if ("".equals(attr.get(Chunk.GENERICTAG))) {
                attributes.put(Chunk.GENERICTAG, chunk.getContent());
            }
        }
        if (f.isUnderlined()) {
            Object obj[] = {null, new float[]{0, 1f / 15, 0, -1f / 3, 0}};
            Object unders[][] = Utilities.addToArray((Object[][])attributes.get(Chunk.UNDERLINE), obj);
            attributes.put(Chunk.UNDERLINE, unders);
        }
        if (f.isStrikethru()) {
            Object obj[] = {null, new float[]{0, 1f / 15, 0, 1f / 3, 0}};
            Object unders[][] = Utilities.addToArray((Object[][])attributes.get(Chunk.UNDERLINE), obj);
            attributes.put(Chunk.UNDERLINE, unders);
        }
        if (action != null)
            attributes.put(Chunk.ACTION, action);
        // the color can't be stored in a PdfFont
        noStroke.put(Chunk.COLOR, f.getColor());
        noStroke.put(Chunk.ENCODING, font.getFont().getEncoding());
        Object obj[] = (Object[])attributes.get(Chunk.IMAGE);
        if (obj == null) {
            image = null;
        }
View Full Code Here

        if (font.getBaseFont() != null) {
            fonts.add(font);
            return;
        }
        BaseFont bf = font.getCalculatedBaseFont(true);
        Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor());
        fonts.add(f2);
    }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Font

Copyright © 2018 www.massapicom. 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.