L
Lloyd Dupont
I have some Control/Canvas which renders its shape with GDI+, but render
(styled, international) text with
Uniscribe/ScriptTextOut/GDI.
To be sure everyting was right I also underlined the text with a GDI red
line (MoveToEx + LineTo)
Everything run well in the application.
The problem arise when I try to print.
- 1st problem, in print preview:
There is no text at all! coordinate are allright as I could see the red
line, but no text :-/
Out of curiosity I tryed to write a X with TextOut() and it displayed
allright (i.
But I can't used TextOut(), I'm using Uniscribe and all I've got at the
drawing stage is some glyphs.
Any ideas?
Also, 2nd problem in both print & print preview:
I set the coordinate with SetWorldTransform(), using the matrix coming from
e.Graphics.Transform.
But that's not quite right.
I have
- screen: e.Graphics.DpiX = 96, GetDeviceCaps(screenHdc, LOGPIXELSX) = 96
- printer: e.Graphics.DpiX = 300, GetDeviceCaps(screenHdc, LOGPIXELSX) = 300
And I should scale the coordinate by "3" to have the right result.
Exactly 3, not (300.0 / 96.0) = 3.125
I tried something like that while printing & print previewing:
::SetMapMode(hdc, MM_ANISOTROPIC);
::SetWindowExtEx(hdc, 96, 96, NULL);
::SetViewportExtEx(hdc, 300, 300, NULL);
====
And it was not right, I had to write instead someting like:
int val = (300 / 96) * 96; (integer multiple)
::SetMapMode(hdc, MM_ANISOTROPIC);
::SetWindowExtEx(hdc, 96, 96, NULL);
::SetViewportExtEx(hdc, val, val, NULL);
Any idea what's going on?
(styled, international) text with
Uniscribe/ScriptTextOut/GDI.
To be sure everyting was right I also underlined the text with a GDI red
line (MoveToEx + LineTo)
Everything run well in the application.
The problem arise when I try to print.
- 1st problem, in print preview:
There is no text at all! coordinate are allright as I could see the red
line, but no text :-/
Out of curiosity I tryed to write a X with TextOut() and it displayed
allright (i.
But I can't used TextOut(), I'm using Uniscribe and all I've got at the
drawing stage is some glyphs.
Any ideas?
Also, 2nd problem in both print & print preview:
I set the coordinate with SetWorldTransform(), using the matrix coming from
e.Graphics.Transform.
But that's not quite right.
I have
- screen: e.Graphics.DpiX = 96, GetDeviceCaps(screenHdc, LOGPIXELSX) = 96
- printer: e.Graphics.DpiX = 300, GetDeviceCaps(screenHdc, LOGPIXELSX) = 300
And I should scale the coordinate by "3" to have the right result.
Exactly 3, not (300.0 / 96.0) = 3.125
I tried something like that while printing & print previewing:
::SetMapMode(hdc, MM_ANISOTROPIC);
::SetWindowExtEx(hdc, 96, 96, NULL);
::SetViewportExtEx(hdc, 300, 300, NULL);
====
And it was not right, I had to write instead someting like:
int val = (300 / 96) * 96; (integer multiple)
::SetMapMode(hdc, MM_ANISOTROPIC);
::SetWindowExtEx(hdc, 96, 96, NULL);
::SetViewportExtEx(hdc, val, val, NULL);
Any idea what's going on?