🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8662

JAVA2D: TEXT LENGHTS TOO WIDE WHEN BEING PRINTED

#8662
From: Mads Pultz
Date: Fri, 28 Jul 2000 00:00
70 lines
3456 bytes
This is a multi-part message in MIME format.

------=_NextPart_000_0008_01BFF8BA.515AE4A0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi.=20
My application has printing and preview (WYSIWYG) facility. I'm printing =
text in rectangles and my application has determined the font size to be =
used so the text can be printed inside the rectangle.=20

I have a problem because there is inconsistency between the preview and =
print. I use the same calculations. In paintComponent() I do the =
following, from the Graphics object I use getFontMetrics() to get a =
FontMetrics object and on that I use stringWidth to calculate how many =
characters I can have on one line. The text which is printed on paper =
goes outside the rectangle but the preview looks fine, the text is =
printed inside the rectangle.

Can anyone help me, I use JDK 1.3 on NT4 SP5? Can it be a bug, I can see =
from the bug archieve that there are many bugs related to printing and =
fonts? Please send your reply to mp@newcon.dk besides from posting it =
here.

Mads


------=_NextPart_000_0008_01BFF8BA.515AE4A0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY>
<DIV>Hi.=20
<P>My application has printing and preview (WYSIWYG) facility. I'm =
printing text=20
in rectangles and my application has determined the font size to be used =
so the=20
text can be printed inside the rectangle.=20
<P>I have a problem because there is inconsistency between the preview =
and=20
print. I use the same calculations. In paintComponent() I do the =
following,=20
f<FONT color=3D#000000>rom the Graphics object I use getFontMetrics() to =
get a=20
FontMetrics object and on that I use stringWidth to calculate how many=20
characters I can have on one line. </FONT>The text which is printed on =
paper=20
goes outside the rectangle but the preview looks fine, the text is =
printed=20
inside the rectangle.
<P>Can anyone help me, I use JDK 1.3 on NT4 SP5? Can it be a bug, I can =
see from=20
the bug archieve that there are many bugs related to printing and fonts? =
Please=20
send your reply to <A href=3D"mailto:mp@newcon.dk">mp@newcon.dk</A> =
besides from=20
posting it here.</P>
<P>Mads</P></DIV></BODY></HTML>

------=_NextPart_000_0008_01BFF8BA.515AE4A0--
Technical Details
Message-ID: <MGhg5.6275$e3.87069@news010.worldonline.dk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,29a729e2cc768f73,start
X-Google-Attributes: gid111d45,public
X-Google-Thread: 10fd6d,29a729e2cc768f73,start
X-Google-Attributes: gid10fd6d,public
From: "Mads Pultz" <mp@newcon.dk>
Subject: JAVA2D: TEXT LENGHTS TOO WIDE WHEN BEING PRINTED
Date: 2000/07/28
Message-ID: <MGhg5.6275$e3.87069@news010.worldonline.dk>
X-Deja-AN: 651846055
Content-Type: multipart/alternative; boundary="----=_NextPart_000_0008_01BFF8BA.515AE4A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-Complaints-To: news-abuse@wol.dk
X-Trace: news010.worldonline.dk 964798252 212.54.74.91 (Fri, 28 Jul 2000 17:30:52 MET DST)
Organization: Customer of World Online
MIME-Version: 1.0
NNTP-Posting-Date: Fri, 28 Jul 2000 17:30:52 MET DST
Newsgroups: borland.public.jbuilder.java.swing,comp.lang.java.gui