xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Art Welch <ar...@EASTPOINT.COM>
Subject RE: Question regarding text renderer (commit please)
Date Thu, 15 Mar 2001 19:39:27 GMT
I have added a few local variables to the TXTRenderer to allow some output
options to be set.

lineEnding:
This is a public string variable to set the line ending. I also changed the
default from "\n" to "\r\n". This will be added to the end of every line
except the last line on each page which will end with the string specified
by pageEnding.

pageEnding:
This is a public string variable to set the page ending. Defaults to the
FormFeed character "\f". This will be added to the end of every page except
the last one which will end with lineEnding.

suppressGraphics:
This is a public boolean variable that will cause graphics/decorations to
not be included in the rendered output. Only normal text will be rendered.
For example if this is false and a block has a border, then this may be
rendered as:
     --------------
     |Block Text  |
     --------------

If this is true then it would be rendered as:

      Block Text

This can produce cleaner output, as the non-text elements do not always
render well.

Note that to set these you would need to create a TXTRenderer object and set
desired options. Then set the renderer on Driver. It would probably be a
good idea to use configuration parameters for these, but I have not yet
looked at how to do this. Maybe one of these days... or maybe someone who
already knows about that...

Fotis, can you add the above to the documentation for the Text Renderer.

Diff attached.

Thank You,
Art

-----Original Message-----
From: Art Welch 
Sent: Thursday, March 15, 2001 1:24 PM
To: 'fop-dev@xml.apache.org'
Subject: RE: Question regarding text renderer


This is great to hear!

If someone else has not already done it, I will try to add an option to set
the line endings today. For now I will probably just add a public String
variable that you can use to set the desired line ending. Maybe I will even
change the default to "\r\n".

The -print option is a different option from the -pcl option. The -print
option uses the AWTRenderer to produce printed output. I have never used
this option because my environment (JDK 1.1.8) does not support the
AWTRenderer. If you want to print directly to a PCL printer, you may be able
to still use the PCLRenderer. I have not tried this myself, but you may be
able to use PRN: or LPT1: for the file (I assume that you are using
Windows). This may require the printer to have been set up to be accessible
from DOS. Maybe someone else can elaborate on this. Most of the Java stuff I
do is on the server. I do not have a local printer. When I have printed from
Java on my Windows 2000 workstation (not FOP) I have used something like
\\hostname\printername for the file name and it prints to the network
printer "printername".

I think that I heard a while back that the -print option did not work.
Unless this has been fixed, the PCLRenderer may be the only option for
direct printing. Does someone know for sure about this?

Art

-----Original Message-----
From: Jens Schäfers [mailto:schaefers@adesso.de]
Sent: Thursday, March 15, 2001 6:02 AM
To: fop-dev@xml.apache.org
Subject: Re: Question regarding text renderer


Hi,

I've replaced all occurences of "\n" with "\r\n" in the text renderer class.
Though
it works very well it is just a "find and replace" hack that should be
implemented
with a bit more thought by someone who knows what he/she does ;-).

The problem with the small fonts does occur and will be adressed in the
stylesheets.
Perhaps I will remove all font attributes in my stylesheets for the plain
text
generation.

So far there are no further problems with the text renderer an the
formatting looks
just great.

The pcl renderer also works great. The -print switch now doesn't throw any
null
pointer exception anymore (that was a fo-file problem). Now the following
error
occurs:

setting up fonts
formatting FOs into areas
 [1FATAL ERROR: null

I don't know what to make of that. The pcl renderer has no such problem.

Jens


Jens Schäfers wrote:

> Hi Art,
>
> I'd like to make the changes mentioned by you. But I must admit that I've
yet
> only meager talents in java programming.
>
> I'll try anyway, if it is as simple as exchanging a "\n" for a "\r\n". The
> problem for me is not the printing but the viewing in windows text
editors. The
> Unix style line endings are tearing my line breaks apart.
>
> Certainly I will have to adjust the pdf-generating stylesheets. But that
would
> be only small changes. For me the text renderer is very useful, because it
> provides a way to generate raw text data that can be processed by
applications
> that cannot use xml input yet. Naturally I'll let you how it works for me.
I
> think I can post a problem summary. There were some, but I will try to
verify
> them first.
>
> And thanks for your hints with the fonts. I'll take care about it.
>
> There's another question I didn't ask yesterday:
>
> When I use the PCL renderer to generate a pcl file there is no problem.
But when
> I use the -print switch to send the output directly to a pcl printer, fop
throws
> a null pointer exception when generating the first page.
>
> Is there something I must mind in the stylesheets?
>
> Regards,
>
> Jens
>
> Art Welch wrote:
>
> > As submitted it uses Unix style line endings "\n". It would probably be
a
> > good idea to make this configurable somehow (file, public variable, or
> > setter method). It was in the original plan to do this (as well as
providing
> > an option to turn graphics off/on), but this never got implemented. If
you
> > (or anyone else) does not make this change, maybe I will look into it. I
> > know that some printers prefer DOS style line endings "\r\n". Actually I
> > think that some printers also like a plain "\r". Should be a simple
change.
> >
> > I am really glad that someone may be able to use the text renderer.
Please
> > let me know if it actually works for you.
> >
> > As a pointer, if you use a fixed font (Courier) in a size that closely
> > matches the virtual font size used by the renderer (determined by the
CPI
> > and LPI) then the output can be quite accurate.
> >
> > Be aware that small fonts (in your FOs) tend to cause overwriting in the
> > text output. On the contrary, large fonts tend to be spaced out in the
text
> > output.
> >
> > Good Luck,
> > Art
> >
> > -----Original Message-----
> > From: Jens Schäfers [mailto:schaefers@adesso.de]
> > Sent: Wednesday, March 14, 2001 10:58 AM
> > To: fop-dev@xml.apache.org
> > Subject: Question regarding text renderer
> >
> > Hello,
> >
> > I've got a question regarding the fop text renderer:
> >
> > which kind of line break is generated? unix-style or dos-style?
> >
> > It seems to me that it's unix-style, but I'm not sure. Can I change this
> > easily to dos-style?
> >
> > Thanks!
> >
> > Jens
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> > For additional commands, email: fop-dev-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> > For additional commands, email: fop-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Mime
View raw message