jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven Doxia
  • DOXIA-158

doxia book with APT verbatim text not monospaced in PDF

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.0-alpha-9
  • Fix Version/s: None
  • Component/s: Module - Itext
  • Labels:
    None
  • Environment:
    Java 5 on WinXP

Description

I'm using doxia-maven-plugin 1.0-alpha-9 with APT as an imput source. When I generate xhtml then the verbatim text comes out fine as a pre tag. When I generate PDF the verbatim text is rendered with a variable width font, thus my code examples are all over the place.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. PDF File
    after.pdf
    08/Oct/07 5:32 PM
    20 kB
    David Roussel
  2. PDF File
    before.pdf
    08/Oct/07 5:32 PM
    20 kB
    David Roussel
  3. Text File
    doxia-modules-itext-updgrade.1.4.8.patch
    08/Oct/07 5:32 PM
    5 kB
    David Roussel
  4. Hide
    Zip Archive
    doxia-test.zip
    05/Oct/07 6:43 AM
    3 kB
    David Roussel
    1. XML File
      doxia-test/pom.xml 2 kB
    2. File
      doxia-test/src/.../code-example.apt 1 kB
    3. XML File
      doxia-test/src/docs/release-notes.xml 0.3 kB
    4. Java Source File
      doxia-test/src/main/.../doxia-test/App.java 0.2 kB
    5. Java Source File
      doxia-test/src/.../doxia-test/AppTest.java 0.6 kB
    Download Zip
    Show
    Zip Archive
    doxia-test.zip
    05/Oct/07 6:43 AM
    3 kB
    David Roussel
  5. Text File
    verbatim_font_change.patch
    07/Oct/07 6:20 PM
    0.6 kB
    David Roussel

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Vincent Siveton added a comment - 05/Oct/07 5:55 AM

David, could you attach a simple test case? Thanks.

Show
Vincent Siveton added a comment - 05/Oct/07 5:55 AM David, could you attach a simple test case? Thanks.
Hide
Permalink
David Roussel added a comment - 05/Oct/07 6:31 AM

Using the file https://svn.apache.org/repos/asf/maven/doxia/doxia/trunk/doxia-book/src/site/apt/usage.apt as input causes the problem.

I don't know how to make a test case that takes in APT and outputs PDF via the itext module. Perhaps there needs to some integration tests in some other module for this purpose.

Show
David Roussel added a comment - 05/Oct/07 6:31 AM Using the file https://svn.apache.org/repos/asf/maven/doxia/doxia/trunk/doxia-book/src/site/apt/usage.apt as input causes the problem. I don't know how to make a test case that takes in APT and outputs PDF via the itext module. Perhaps there needs to some integration tests in some other module for this purpose.
Hide
Permalink
David Roussel added a comment - 05/Oct/07 6:43 AM

Ok, here is a project I generated with archetype:create and then added the doxia-books plugin and an example APT with a verbatim block.

To build it:

mvn org.apache.maven.doxia:doxia-maven-plugin:render-books

Then look at the PDF in target and see that it does not used a fixed-width font.

Show
David Roussel added a comment - 05/Oct/07 6:43 AM Ok, here is a project I generated with archetype:create and then added the doxia-books plugin and an example APT with a verbatim block. To build it:
mvn org.apache.maven.doxia:doxia-maven-plugin:render-books
Then look at the PDF in target and see that it does not used a fixed-width font.
Hide
Permalink
Vincent Siveton added a comment - 06/Oct/07 6:19 AM

The normal iText's behaviour for monospaced font is to use Courier font [1]. So this issue sounds like a font limitation in iText.

[1] http://www.koders.com/java/fid0F5FF00C3DD7D92F1C08A527FCF3E837D13F13B8.aspx?s=mdef%3Ainsert#L114

Show
Vincent Siveton added a comment - 06/Oct/07 6:19 AM The normal iText's behaviour for monospaced font is to use Courier font [1]. So this issue sounds like a font limitation in iText. [1] http://www.koders.com/java/fid0F5FF00C3DD7D92F1C08A527FCF3E837D13F13B8.aspx?s=mdef%3Ainsert#L114
Hide
Permalink
David Roussel added a comment - 07/Oct/07 6:18 PM

Vincent,

The iText code you link to looks fine. But if I look in org.apache.maven.doxia.module.itext.ITextSink the verbatim() method doesn't seem to mention monospaced fonts, even though there is an ITextFont.getMonoSpacedFont() method. Infact getMonoSpacedFont() is never called.

Ideally we should have a call to font.setMonospaced(true) in verbatim(), and call font.setMonospaced(false) in _verbatim().

David

Show
David Roussel added a comment - 07/Oct/07 6:18 PM Vincent, The iText code you link to looks fine. But if I look in org.apache.maven.doxia.module.itext.ITextSink the verbatim() method doesn't seem to mention monospaced fonts, even though there is an ITextFont.getMonoSpacedFont() method. Infact getMonoSpacedFont() is never called. Ideally we should have a call to font.setMonospaced(true) in verbatim(), and call font.setMonospaced(false) in _verbatim(). David
Hide
Permalink
David Roussel added a comment - 07/Oct/07 6:20 PM

I tried this patch. But it didn't seem to fix it. Not sure why?

attached: verbatim_font_change.patch

Show
David Roussel added a comment - 07/Oct/07 6:20 PM I tried this patch. But it didn't seem to fix it. Not sure why? attached: verbatim_font_change.patch
Hide
Permalink
Vincent Siveton added a comment - 08/Oct/07 7:58 AM

Should work, but iText 1.4.0 has an issue about XML handler which has been solved with 1.4.1, according the release note [1].

[1] http://www.lowagie.com/iText/history.html

Show
Vincent Siveton added a comment - 08/Oct/07 7:58 AM Should work, but iText 1.4.0 has an issue about XML handler which has been solved with 1.4.1, according the release note [1]. [1] http://www.lowagie.com/iText/history.html
Hide
Permalink
David Roussel added a comment - 08/Oct/07 9:02 AM

I see iText 1.4.8 is released and also in the maven central repo.
http://repo1.maven.org/maven2/com/lowagie/itext/1.4.8/

Show
David Roussel added a comment - 08/Oct/07 9:02 AM I see iText 1.4.8 is released and also in the maven central repo. http://repo1.maven.org/maven2/com/lowagie/itext/1.4.8/
Hide
Permalink
Vincent Siveton added a comment - 08/Oct/07 10:49 AM

iText 1.4.4+ is not backward compatible: see 1.4.4 release note:
"removal of some XmlToXXX classes that weren't used anymore"

So, we need iText < 1.4.4 or could you provide a patch to bump to iText:1.4.8?

Show
Vincent Siveton added a comment - 08/Oct/07 10:49 AM iText 1.4.4+ is not backward compatible: see 1.4.4 release note: "removal of some XmlToXXX classes that weren't used anymore" So, we need iText < 1.4.4 or could you provide a patch to bump to iText:1.4.8?
Hide
Permalink
David Roussel added a comment - 08/Oct/07 5:39 PM

Ask and you shall receive!

I've attached 3 files.

  • doxia-modules-itext-updgrade.1.4.8.patch
  • before.pdf
  • after.pdf

The patch is a first draft, but it does seem to work fine in generating PDF from XML. But this approach seems to be discouraged from the iText guys. We should be firing our events directly into a PdfWriter, not writing an intermediate XML file. Also note that I've broken RTF generation in the process. Should be a similar fix, but using RtfWriter2 instead of PdfWriter.

So until the RTF gets fixed the patch is not ready.

Also see before.pdf and after.pdf. The changes I've noticed (using Apple Preview application to view them) is the headings are slightly more bold. The monospaced fonts work !!!! Wooo!!!! And the table headings are in the after but not before. So that must fix another issue too!

Ok it's getting late. So the RTF fix can wait for another day.

David

Show
David Roussel added a comment - 08/Oct/07 5:39 PM Ask and you shall receive! I've attached 3 files.
  • doxia-modules-itext-updgrade.1.4.8.patch
  • before.pdf
  • after.pdf
The patch is a first draft, but it does seem to work fine in generating PDF from XML. But this approach seems to be discouraged from the iText guys. We should be firing our events directly into a PdfWriter, not writing an intermediate XML file. Also note that I've broken RTF generation in the process. Should be a similar fix, but using RtfWriter2 instead of PdfWriter. So until the RTF gets fixed the patch is not ready. Also see before.pdf and after.pdf. The changes I've noticed (using Apple Preview application to view them) is the headings are slightly more bold. The monospaced fonts work !!!! Wooo!!!! And the table headings are in the after but not before. So that must fix another issue too! Ok it's getting late. So the RTF fix can wait for another day. David

People

  • Assignee:
    Vincent Siveton
    Reporter:
    David Roussel
Vote (0)
Watch (1)

Dates

  • Created:
    04/Oct/07 4:41 PM
    Updated:
    08/Oct/07 5:39 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.