Example usage for com.lowagie.text ElementTags FONT

List of usage examples for com.lowagie.text ElementTags FONT

Introduction

In this page you can find the example usage for com.lowagie.text ElementTags FONT.

Prototype

String FONT

To view the source code for com.lowagie.text ElementTags FONT.

Click Source Link

Document

the possible value of an alignment attribute

Usage

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void body() {
    if (writeStart) {
        writeStartElement(ElementTags.ITEXT);
        writeAddAttribute(ElementTags.TITLE, header.getTitle());
        writeAddAttribute(ElementTags.AUTHOR, header.getAuthors());
        writeAddAttribute(ElementTags.CREATIONDATE, header.getDate());
        writeAddAttribute(ElementTags.SUBJECT, header.getTitle());
        writeAddAttribute(ElementTags.KEYWORDS, "");
        writeAddAttribute(ElementTags.PRODUCER, "Generated with Doxia by " + System.getProperty("user.name"));
        writeAddAttribute(ElementTags.PAGE_SIZE, ITextUtil.getPageSize(ITextUtil.getDefaultPageSize()));

        writeStartElement(ElementTags.CHAPTER);
        writeAddAttribute(ElementTags.NUMBERDEPTH, numberDepth);
        writeAddAttribute(ElementTags.DEPTH, depth);
        writeAddAttribute(ElementTags.INDENT, "0.0");

        writeStartElement(ElementTags.TITLE);
        writeAddAttribute(ElementTags.LEADING, DEFAULT_CHAPTER_TITLE_LEADING);
        writeAddAttribute(ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME);
        writeAddAttribute(ElementTags.SIZE, ITextFont.getSectionFontSize(0));
        writeAddAttribute(ElementTags.STYLE, ITextFont.BOLD);
        writeAddAttribute(ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE);
        writeAddAttribute(ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN);
        writeAddAttribute(ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED);
        writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_CENTER);

        //            startChunk( ITextFont.DEFAULT_FONT_NAME, ITextFont.getSectionFontSize( 0 ),
        //                    ITextFont.BOLD, ITextFont.DEFAULT_FONT_COLOR_BLUE, ITextFont.DEFAULT_FONT_COLOR_GREEN,
        //                    ITextFont.DEFAULT_FONT_COLOR_RED, "top" );

        writeStartElement(ElementTags.CHUNK);
        writeAddAttribute(ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME);
        writeAddAttribute(ElementTags.SIZE, ITextFont.getSectionFontSize(0));
        writeAddAttribute(ElementTags.STYLE, ITextFont.BOLD);
        writeAddAttribute(ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE);
        writeAddAttribute(ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN);
        writeAddAttribute(ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED);
        //            writeAddAttribute( ElementTags.LOCALDESTINATION, "top" );

        write(header.getTitle());/*from   www  .j a  va 2s  .  co m*/

        writeEndElement(); // ElementTags.CHUNK

        writeEndElement(); // ElementTags.TITLE
    }

    actionContext.setAction(SinkActionContext.BODY);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void sectionTitle1() {
    font.setSize(ITextFont.getSectionFontSize(1));
    font.setColor(Color.BLACK);//from w  w w  .  j av a 2  s . co m
    bold();

    writeStartElement(ElementTags.TITLE);
    writeAddAttribute(ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());
    //        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve

    actionContext.setAction(SinkActionContext.SECTION_TITLE_1);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void sectionTitle2() {
    font.setSize(ITextFont.getSectionFontSize(2));
    font.setColor(Color.BLACK);// w ww  . j  av a 2 s.c  o m
    bold();

    writeStartElement(ElementTags.TITLE);
    writeAddAttribute(ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());
    //        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve

    actionContext.setAction(SinkActionContext.SECTION_TITLE_2);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void sectionTitle3() {
    font.setSize(ITextFont.getSectionFontSize(3));
    font.setColor(Color.BLACK);//from w w  w. j av  a 2 s  .  c om
    bold();

    writeStartElement(ElementTags.TITLE);
    writeAddAttribute(ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());
    //        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve

    actionContext.setAction(SinkActionContext.SECTION_TITLE_3);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void sectionTitle4() {
    font.setSize(ITextFont.getSectionFontSize(4));
    font.setColor(Color.BLACK);/*w w  w  .ja va 2s  .  c o  m*/
    bold();

    writeStartElement(ElementTags.TITLE);
    writeAddAttribute(ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());
    //        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve

    actionContext.setAction(SinkActionContext.SECTION_TITLE_4);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void sectionTitle5() {
    font.setSize(ITextFont.getSectionFontSize(5));
    font.setColor(Color.BLACK);/*w  w  w  . j a  v a2  s. co m*/
    bold();

    writeStartElement(ElementTags.TITLE);
    writeAddAttribute(ElementTags.LEADING, DEFAULT_SECTION_TITLE_LEADING);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());
    //        writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); // trygve

    actionContext.setAction(SinkActionContext.SECTION_TITLE_5);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void list() {
    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    writeStartElement(ElementTags.LIST);
    writeAddAttribute(ElementTags.NUMBERED, Boolean.FALSE.toString());
    writeAddAttribute(ElementTags.SYMBOLINDENT, "15");

    actionContext.setAction(SinkActionContext.LIST);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void numberedList(int numbering) {
    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    writeStartElement(ElementTags.LIST);
    writeAddAttribute(ElementTags.NUMBERED, Boolean.TRUE.toString());
    writeAddAttribute(ElementTags.SYMBOLINDENT, "20");

    switch (numbering) {
    case Sink.NUMBERING_UPPER_ALPHA:
        writeAddAttribute(ElementTags.LETTERED, Boolean.TRUE.toString());
        writeAddAttribute(ElementTags.FIRST, 'A');
        break;// w  ww.j  a va 2 s .c  om

    case Sink.NUMBERING_LOWER_ALPHA:
        writeAddAttribute(ElementTags.LETTERED, Boolean.TRUE.toString());
        writeAddAttribute(ElementTags.FIRST, 'a');
        break;

    // TODO Doesn't work
    case Sink.NUMBERING_UPPER_ROMAN:
        writeAddAttribute(ElementTags.LETTERED, Boolean.TRUE.toString());
        writeAddAttribute(ElementTags.FIRST, 'I');
        break;

    case Sink.NUMBERING_LOWER_ROMAN:
        writeAddAttribute(ElementTags.LETTERED, Boolean.TRUE.toString());
        writeAddAttribute(ElementTags.FIRST, 'i');
        break;

    case Sink.NUMBERING_DECIMAL:
    default:
        writeAddAttribute(ElementTags.LETTERED, Boolean.FALSE.toString());
    }

    actionContext.setAction(SinkActionContext.NUMBERED_LIST);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void definedTerm() {
    font.setSize(ITextFont.DEFAULT_FONT_SIZE + 2);
    bold();//w  ww. ja  v a2  s.c o  m

    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    actionContext.setAction(SinkActionContext.DEFINED_TERM);
}

From source file:org.apache.maven.doxia.module.itext.ITextSink.java

License:Apache License

/** {@inheritDoc} */
public void definition() {
    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    writeStartElement(ElementTags.CHUNK);
    writeAddAttribute(ElementTags.FONT, font.getFontName());
    writeAddAttribute(ElementTags.SIZE, font.getFontSize());
    writeAddAttribute(ElementTags.STYLE, font.getFontStyle());
    writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue());
    writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen());
    writeAddAttribute(ElementTags.RED, font.getFontColorRed());

    // We need to add a non break space first to display empty string
    write("\u00A0" + StringUtils.repeat(" ", 16), false, false);

    writeEndElement(); // ElementTags.CHUNK

    actionContext.setAction(SinkActionContext.DEFINITION);
}