I am not sure what you might mean by "no longer" and
I don't know what new problems Linux might introduce but I
have 2 comments on your code snippet.

1) You appear to have plucked the font "Arial" out of thin air.
   When using anything apart from the logical fonts you need to ensure
   its one of the fonts listed via "getAvailableFontFamilyNames()"

2) You are drawing the string at (0,0). Since the y position is used as
   the baseline you are drawing off the top off the printable area and
   none of the characters you are printing have any descenders.

-phil.

> X-Accept-Language: en
> Date: Mon, 13 Mar 2000 10:45:15 -0600
> From: Nicolas Thiessen <[EMAIL PROTECTED]>
> Subject: [JAVA2D] Urgent help printing
> To: [EMAIL PROTECTED]
>
> Hi, i've been wrestling with java 1.2 printing api for a while now, and
> i can no longer print Text using a Graphics2D context under Linux
> (RedHat 6.1).   I can print everything but text, i can print images and
> other graphics...   i must be missing something simple, but i've checked
> tons of docs and i can't find anything...
>
> here's what i've been using..   can someone please tell me what i'm
> doing wrong?
>
> thanks,
> nic
>
>   public int print(Graphics g, PageFormat pf, int pi) throws
> PrinterException
>   {
>   if (pi>=1) {
>      return Printable.NO_SUCH_PAGE;
>     }
>     Graphics2D g2 = (Graphics2D)g;
>
>     g2.translate(pf.getImageableX(),pf.getImageableY());
>     g2.setColor(Color.black);
>     g2.setFont(new Font("Arial",Font.PLAIN,24));
>     System.out.println(g2.getFont());
>     g2.setPaint(Color.black);
>     g2.drawString("Please Print",0,0);
>
>     return Printable.PAGE_EXISTS;
>   }
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to