Re: How do you smooth fonts?

2011-08-26 Thread Chris Bowditch

On 22/08/2011 21:57, Eric Douglas wrote:

Hi Eric,

When I transform XSLFO with FOP I can send the output to PDF or AWT 
and text looks sharp.
I'm trying to use the same fonts to generate graphics directly since 
I'm programmatically generating the input to my FOP process and I 
don't actually need the XSLFO process.




If you know the position of all your text in advance and don't need 
XSL-FO, then FOP seems like the wrong tool for the job. Why not use 
iText, which has an API for creating PDF?


I know exactly what text I want to print, what size I want it, and 
exactly where I want it on the page.
I tried putting the text on an image and putting the image on a Swing 
panel and it always comes out fuzzy.  It's even fuzzier if I try to 
save that image to a file or send it to a printer.


I tried using the FOP classes for loading the font, using the 
Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to 
generate the text.  It's always rendered blurry.  What could I be missing?




Chris


RE: How do you smooth fonts?

2011-08-26 Thread Eric Douglas
An independent contractor recommended FOP so that was the project I
looked at first.
I have used FOP so I know it works, though I'm sure no one else uses it
the same way.
I just create XML with data including tags to tell it specifically what
goes where on each page.
I've had 2 problems with FOP.
1) It takes too much memory to generate a really large PDF.  I've had to
break up my data and generate multiple PDFs using the initial page
sequence tag, then I used pdfbox to piece them together.
2) The AWT viewer was very inefficient, so I wrote my own.

I'm not familiar with iText so I don't know if it can generate the PDFs
like FOP with the custom embedded fonts, SVG graphics, etc.
I saw some messages recently on the pdfbox list that people were
switching from iText, something about licensing issues.


-Original Message-
From: Chris Bowditch [mailto:bowditch_ch...@hotmail.com] 
Sent: Friday, August 26, 2011 5:52 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How do you smooth fonts?

On 22/08/2011 21:57, Eric Douglas wrote:

Hi Eric,

 When I transform XSLFO with FOP I can send the output to PDF or AWT 
 and text looks sharp.
 I'm trying to use the same fonts to generate graphics directly since 
 I'm programmatically generating the input to my FOP process and I 
 don't actually need the XSLFO process.


If you know the position of all your text in advance and don't need
XSL-FO, then FOP seems like the wrong tool for the job. Why not use
iText, which has an API for creating PDF?

 I know exactly what text I want to print, what size I want it, and 
 exactly where I want it on the page.
 I tried putting the text on an image and putting the image on a Swing 
 panel and it always comes out fuzzy.  It's even fuzzier if I try to 
 save that image to a file or send it to a printer.

 I tried using the FOP classes for loading the font, using the 
 Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to 
 generate the text.  It's always rendered blurry.  What could I be
missing?


Chris


Re: How do you smooth fonts?

2011-08-26 Thread Chris Bowditch

On 26/08/2011 13:49, Eric Douglas wrote:

Hi Eric,


An independent contractor recommended FOP so that was the project I
looked at first.
I have used FOP so I know it works, though I'm sure no one else uses it
the same way.
I just create XML with data including tags to tell it specifically what
goes where on each page.
I've had 2 problems with FOP.
1) It takes too much memory to generate a really large PDF.  I've had to
break up my data and generate multiple PDFs using the initial page
sequence tag, then I used pdfbox to piece them together.
2) The AWT viewer was very inefficient, so I wrote my own.

I'm not familiar with iText so I don't know if it can generate the PDFs
like FOP with the custom embedded fonts, SVG graphics, etc.
I saw some messages recently on the pdfbox list that people were
switching from iText, something about licensing issues.


It could be that PDF Box is more suitable for you. iText and PDFBox are 
similar libraries both targetted at creating PDFs. What is clear to me 
is that FOP doesn't seem like a good fit for your requirements.


Regards,

Chris



-Original Message-
From: Chris Bowditch [mailto:bowditch_ch...@hotmail.com]
Sent: Friday, August 26, 2011 5:52 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How do you smooth fonts?

On 22/08/2011 21:57, Eric Douglas wrote:

Hi Eric,


When I transform XSLFO with FOP I can send the output to PDF or AWT
and text looks sharp.
I'm trying to use the same fonts to generate graphics directly since
I'm programmatically generating the input to my FOP process and I
don't actually need the XSLFO process.


If you know the position of all your text in advance and don't need
XSL-FO, then FOP seems like the wrong tool for the job. Why not use
iText, which has an API for creating PDF?

I know exactly what text I want to print, what size I want it, and
exactly where I want it on the page.
I tried putting the text on an image and putting the image on a Swing
panel and it always comes out fuzzy.  It's even fuzzier if I try to
save that image to a file or send it to a printer.

I tried using the FOP classes for loading the font, using the
Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to
generate the text.  It's always rendered blurry.  What could I be

missing?
Chris






RE: How do you smooth fonts?

2011-08-26 Thread Eric Douglas
I am using pdfbox to merge and print PDFs.
Either there's a lot I don't understand about creating PDFs with pdfbox
or FOP does a lot more than pdfbox can do.
 

-Original Message-
From: Chris Bowditch [mailto:bowditch_ch...@hotmail.com] 
Sent: Friday, August 26, 2011 11:28 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How do you smooth fonts?

On 26/08/2011 13:49, Eric Douglas wrote:

Hi Eric,

 An independent contractor recommended FOP so that was the project I 
 looked at first.
 I have used FOP so I know it works, though I'm sure no one else uses 
 it the same way.
 I just create XML with data including tags to tell it specifically 
 what goes where on each page.
 I've had 2 problems with FOP.
 1) It takes too much memory to generate a really large PDF.  I've had 
 to break up my data and generate multiple PDFs using the initial page 
 sequence tag, then I used pdfbox to piece them together.
 2) The AWT viewer was very inefficient, so I wrote my own.

 I'm not familiar with iText so I don't know if it can generate the 
 PDFs like FOP with the custom embedded fonts, SVG graphics, etc.
 I saw some messages recently on the pdfbox list that people were 
 switching from iText, something about licensing issues.

It could be that PDF Box is more suitable for you. iText and PDFBox are
similar libraries both targetted at creating PDFs. What is clear to me
is that FOP doesn't seem like a good fit for your requirements.

Regards,

Chris


 -Original Message-
 From: Chris Bowditch [mailto:bowditch_ch...@hotmail.com]
 Sent: Friday, August 26, 2011 5:52 AM
 To: fop-dev@xmlgraphics.apache.org
 Subject: Re: How do you smooth fonts?

 On 22/08/2011 21:57, Eric Douglas wrote:

 Hi Eric,

 When I transform XSLFO with FOP I can send the output to PDF or AWT 
 and text looks sharp.
 I'm trying to use the same fonts to generate graphics directly since 
 I'm programmatically generating the input to my FOP process and I 
 don't actually need the XSLFO process.

 If you know the position of all your text in advance and don't need 
 XSL-FO, then FOP seems like the wrong tool for the job. Why not use 
 iText, which has an API for creating PDF?
 I know exactly what text I want to print, what size I want it, and 
 exactly where I want it on the page.
 I tried putting the text on an image and putting the image on a Swing

 panel and it always comes out fuzzy.  It's even fuzzier if I try to 
 save that image to a file or send it to a printer.

 I tried using the FOP classes for loading the font, using the 
 Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to 
 generate the text.  It's always rendered blurry.  What could I be
 missing?
 Chris





RE: How do you smooth fonts?

2011-08-25 Thread Marquart, Joshua D
Attempt to increase your outgoing resolution (dots per inch).


It may create a larger file and take slightly longer, but the resulting
text may be smoother.

 

-Josh

 

From: Eric Douglas [mailto:edoug...@blockhouse.com] 
Sent: Tuesday, August 23, 2011 7:59 AM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: How do you smooth fonts?

 

I did all those rendering hints.  It still looks like it has a shadow.

 



From: Glenn Adams [mailto:gl...@skynav.com] 
Sent: Tuesday, August 23, 2011 1:55 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How do you smooth fonts?

enable font aliasing in whatever layer you are using for rendering

On Mon, Aug 22, 2011 at 2:57 PM, Eric Douglas edoug...@blockhouse.com
wrote:

When I transform XSLFO with FOP I can send the output to PDF or AWT and
text looks sharp. 
I'm trying to use the same fonts to generate graphics directly since I'm
programmatically generating the input to my FOP process and I don't
actually need the XSLFO process.

I know exactly what text I want to print, what size I want it, and
exactly where I want it on the page. 
I tried putting the text on an image and putting the image on a Swing
panel and it always comes out fuzzy.  It's even fuzzier if I try to save
that image to a file or send it to a printer.

I tried using the FOP classes for loading the font, using the
Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to generate
the text.  It's always rendered blurry.  What could I be missing?

 




-
The information in this message may be proprietary and/or
confidential, and protected from disclosure.  If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify First Data
immediately by replying to this message and deleting it from your
computer. 

RE: How do you smooth fonts?

2011-08-25 Thread Eric Douglas
I'm using Java's print.  I thought a printer only has one resolution.
If you print something at a resolution which doesn't match the printer
resolution it just resizes.
I set the resolution on a printout once and it did that, like if the
printout says 300 dpi and the printer says 600 dpi it shrinks it.
 
First, I wrote a report writer.  The report writer object has methods
(print text, draw image, etc) which create report objects specifying
what I'm printing and where on the page it prints.
I use dynamic printing.  I specify how many columns of text to print
across the page.  Then I measure my (fixed width) font (Lucida Sans
Typewriter) to calculate the x/y in point measurement.
Then I wrote a print preview.  My preview panel extends JScrollPane.
On that pane I draw an image using it's paintComponent method.
I create an image with it's createImage method, set the size equal to a
piece of paper and draw that image on the pane's graphics (from the
paint method) with the drawImage method.
Then I just overrode it's print method to pass the printer graphics into
the paintComponent method to print the image (is there another way I
should/could do that?).
I just pass my preview panel directly into print with this generic
method:
 
(printComponent is the preview panel passed in)
 
  PrinterJob myPrinterJob = PrinterJob.getPrinterJob();
  // Possible Exception
  myPrintService = BBsPrinter.getPrintService(myPrinterName);
  PageFormat pf = myPrinterJob.defaultPage();
  Paper paper = new Paper();
  double margin = 36; // half inch
  margin = 0;
  paper.setImageableArea(margin, margin, paper.getWidth() -
margin * 2, paper.getHeight() - margin * 2);
  pf.setPaper(paper);
  try {
   myPrinterJob.setPrintable((Printable)printComponent, pf);
   BBsString.printLogMessage(Printing Printable
Component);
  } catch (Exception e) {
   myPrinterJob.setPrintable(new
PrintComponent(printComponent), pf);
   BBsString.printLogMessage(Printing NonPrintable
Component);
  }
  // Possible PrinterException
  myPrinterJob.setPrintService(myPrintService);
  myPrintRequestAttributeSet = new
HashPrintRequestAttributeSet();
  if (myCopies != null) {
   myPrintRequestAttributeSet.add(myCopies);
  }
  if (myJobName != null) {
   myPrintRequestAttributeSet.add(myJobName);
  }
  if (myPrinterResolution != null) {
   myPrintRequestAttributeSet.add(myPrinterResolution);
  }
  BBsString.printLogMessage(Printing Graphics Page);
  // Possible PrinterException
  myPrinterJob.print(myPrintRequestAttributeSet);


 public static PrintService getPrintService(String printerName)
throws Exception {
  HashPrintServiceAttributeSet myPrintServiceAttributeSet = new
HashPrintServiceAttributeSet();
  myPrintServiceAttributeSet.add(new
PrinterName(printerName,null));
  // returns sun.print.Win32PrintService implements
java.print.PrintService
  PrintService[] printServiceArray =
PrintServiceLookup.lookupPrintServices(myDocFlavor,myPrintServiceAttribu
teSet);
  if (printServiceArray.length == 1) {
   return printServiceArray[0];
  }
  throw new Exception(Printer \ + printerName + \ not
found);
 }




From: Marquart, Joshua D [mailto:joshua.marqu...@firstdata.com] 
Sent: Thursday, August 25, 2011 9:53 AM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: How do you smooth fonts?



Attempt to increase your outgoing resolution (dots per inch).


It may create a larger file and take slightly longer, but the resulting
text may be smoother.

 

-Josh

 

From: Eric Douglas [mailto:edoug...@blockhouse.com] 
Sent: Tuesday, August 23, 2011 7:59 AM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: How do you smooth fonts?

 

I did all those rendering hints.  It still looks like it has a shadow.

 



From: Glenn Adams [mailto:gl...@skynav.com] 
Sent: Tuesday, August 23, 2011 1:55 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How do you smooth fonts?

enable font aliasing in whatever layer you are using for rendering

On Mon, Aug 22, 2011 at 2:57 PM, Eric Douglas edoug...@blockhouse.com
wrote:

When I transform XSLFO with FOP I can send the output to PDF or AWT and
text looks sharp. 
I'm trying to use the same fonts to generate graphics directly since I'm
programmatically generating the input to my FOP process and I don't
actually need the XSLFO process.

I know exactly what text I want to print, what size I want it, and
exactly where I want it on the page. 
I tried putting the text on an image and putting the image on a Swing
panel and it always comes out fuzzy.  It's even fuzzier if I try to save
that image to a file or send it to a printer.

I tried using the FOP

RE: How do you smooth fonts?

2011-08-25 Thread Eric Douglas
Ok, your resolution hint helped me fix the problem though I don't
particularly like the answer.
The printer doesn't render text all that well at 100% resolution.
What I did, in my panel's print method I call my paint method with a
zoom x 4, then I let the graphics engine scale it back down and it looks
sharper.
myGraphics2D.scale(.25, .25);




From: Marquart, Joshua D [mailto:joshua.marqu...@firstdata.com] 
Sent: Thursday, August 25, 2011 9:53 AM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: How do you smooth fonts?



Attempt to increase your outgoing resolution (dots per inch).


It may create a larger file and take slightly longer, but the resulting
text may be smoother.

 

-Josh

 

From: Eric Douglas [mailto:edoug...@blockhouse.com] 
Sent: Tuesday, August 23, 2011 7:59 AM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: How do you smooth fonts?

 

I did all those rendering hints.  It still looks like it has a shadow.

 



From: Glenn Adams [mailto:gl...@skynav.com] 
Sent: Tuesday, August 23, 2011 1:55 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How do you smooth fonts?

enable font aliasing in whatever layer you are using for rendering

On Mon, Aug 22, 2011 at 2:57 PM, Eric Douglas edoug...@blockhouse.com
wrote:

When I transform XSLFO with FOP I can send the output to PDF or AWT and
text looks sharp. 
I'm trying to use the same fonts to generate graphics directly since I'm
programmatically generating the input to my FOP process and I don't
actually need the XSLFO process.

I know exactly what text I want to print, what size I want it, and
exactly where I want it on the page. 
I tried putting the text on an image and putting the image on a Swing
panel and it always comes out fuzzy.  It's even fuzzier if I try to save
that image to a file or send it to a printer.

I tried using the FOP classes for loading the font, using the
Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to generate
the text.  It's always rendered blurry.  What could I be missing?

 



The information in this message may be proprietary and/or confidential,
and protected from disclosure. If the reader of this message is not the
intended recipient, or an employee or agent responsible for delivering
this message to the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, please
notify First Data immediately by replying to this message and deleting
it from your computer. 



RE: How do you smooth fonts?

2011-08-23 Thread Eric Douglas
I did all those rendering hints.  It still looks like it has a shadow.



From: Glenn Adams [mailto:gl...@skynav.com] 
Sent: Tuesday, August 23, 2011 1:55 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How do you smooth fonts?


enable font aliasing in whatever layer you are using for rendering


On Mon, Aug 22, 2011 at 2:57 PM, Eric Douglas edoug...@blockhouse.com
wrote:




When I transform XSLFO with FOP I can send the output to PDF or
AWT and text looks sharp. 
I'm trying to use the same fonts to generate graphics directly
since I'm programmatically generating the input to my FOP process and I
don't actually need the XSLFO process.

I know exactly what text I want to print, what size I want it,
and exactly where I want it on the page. 
I tried putting the text on an image and putting the image on a
Swing panel and it always comes out fuzzy.  It's even fuzzier if I try
to save that image to a file or send it to a printer.

I tried using the FOP classes for loading the font, using the
Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to generate
the text.  It's always rendered blurry.  What could I be missing?




How do you smooth fonts?

2011-08-22 Thread Eric Douglas
When I transform XSLFO with FOP I can send the output to PDF or AWT and
text looks sharp.
I'm trying to use the same fonts to generate graphics directly since I'm
programmatically generating the input to my FOP process and I don't
actually need the XSLFO process.
I know exactly what text I want to print, what size I want it, and
exactly where I want it on the page.
I tried putting the text on an image and putting the image on a Swing
panel and it always comes out fuzzy.  It's even fuzzier if I try to save
that image to a file or send it to a printer.
I tried using the FOP classes for loading the font, using the
Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to generate
the text.  It's always rendered blurry.  What could I be missing?


Re: How do you smooth fonts?

2011-08-22 Thread Glenn Adams
enable font aliasing in whatever layer you are using for rendering

On Mon, Aug 22, 2011 at 2:57 PM, Eric Douglas edoug...@blockhouse.comwrote:

 **

 When I transform XSLFO with FOP I can send the output to PDF or AWT and
 text looks sharp.
 I'm trying to use the same fonts to generate graphics directly since I'm
 programmatically generating the input to my FOP process and I don't actually
 need the XSLFO process.

 I know exactly what text I want to print, what size I want it, and exactly
 where I want it on the page.
 I tried putting the text on an image and putting the image on a Swing panel
 and it always comes out fuzzy.  It's even fuzzier if I try to save that
 image to a file or send it to a printer.

 I tried using the FOP classes for loading the font, using the
 Java2DGraphicsState, FontInfo, and FontMetricsMapper objects to generate
 the text.  It's always rendered blurry.  What could I be missing?