Groups | Blog | Home
all groups > dotnet drawing api > september 2005 >

dotnet drawing api : ScriptTextOut & printing (&preview)


Lloyd Dupont
9/9/2005 12:00:00 AM
I have a C# application with RichText formatting.
Because it's a graphical application I have to do the text rendering myself
on our main canvas.
I used Uniscribe to do all the formatting (I wrote a ManagedC++ component
taking care of that).

Uniscribe glyphs are painted with ScriptTextOut (not with TextOutput and
such).

Now I've got 2 problems.

1st:
printing: all my GDI Text rendering (with ScripTextOut) is shrinked into the
corner compare to GDI+ rendering.
I had to call SetWorldTransform() with all the matrix element (coming from
the GDI+ Graphics.Transform object) multiplied by 3 to draw correctly.
What's even weirder: 3 is the correct value, not 300.0 / 96.0 = ~3.xx (which
is the DPI ration printer/screen).

2nd:
preview: no text at all is displayed in my
System.Windows.Forms.PrintPreviewDialog
no clue....

Any thoughts?

--
If you're in a war, instead of throwing a hand grenade at the enemy, throw
one of those small pumpkins. Maybe it'll make everyone think how stupid war
is, and while they are thinking, you can throw a real grenade at them.
Jack Handey.

Lloyd Dupont
9/9/2005 12:00:00 AM
Hi!

Thanks for your answer.
Anyway my problems are:
1. printing text, it's shrinked, I had to multiply the world transform
matrix by 3 to get correct printing?!?!
(3 being the integer division of printer DPI by screen DPI, I don't know if
it's a relevant relation, but I noticed it)
2. preview doesn't work! no text on the preview at all!

--
If you're in a war, instead of throwing a hand grenade at the enemy, throw
one of those small pumpkins. Maybe it'll make everyone think how stupid war
is, and while they are thinking, you can throw a real grenade at them.
Jack Handey.
[quoted text, click to view]

DotNetBBK
9/9/2005 9:31:07 AM
Lloyd,

Are you using a network printer ?
You should try the same by setting your default to a different printer.
I had the similar problem with XEROX Document Center 555 PS3.
But, when I set my default printer to HP LaserJet 55i, the problem went
away. Texts are one of the most basic rendering objects and if it
is not getting rendered, then its most probably a printer issue.

-Brajesh


[quoted text, click to view]
DotNetBBK
9/11/2005 7:56:01 PM
For first problem, I also had to multiply the World Transform by 3 to
get the image to the correct size, which makes sense, as screen and
printer have different DPI. However, my drawing was being rendered
in MFC, so I used StretchBlt and stretched the image with this
scaling factor and it worked fine, in case of float value also.

For the second problem, if you are using a network printer, which is
being driven by a print server, then you have to see, whether
this print server has XP and latest drivers installed. When I
tried to do print preview on one of my office's network printer,
text rendering didn't work, but it worked fine for other printer.
Later on, I found out that it didn't work for the print server,
which had nt/2000 drivers.
Hope it helps,

-Brajesh
[quoted text, click to view]
Lloyd Dupont
9/12/2005 12:00:00 AM
Allright, thanks DotNetBBQ, I'll guess it's just the way it is!!
So they made a pretty good job with GDI+, it's just... that I can't use it
in this particular case :-(

--
If you're in a war, instead of throwing a hand grenade at the enemy, throw
one of those small pumpkins. Maybe it'll make everyone think how stupid war
is, and while they are thinking, you can throw a real grenade at them.
Jack Handey.
[quoted text, click to view]

AddThis Social Bookmark Button