L
Lloyd Dupont
I'm trying to print some of my document.
The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text.
Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something else?)
I will investigate that.....
Anyway if any of you had similar experience and could shed some light?
Here is how I initialize my HDC (Managed C++):
====================
struct HDCInfo
{
HDC hdc;
// to be restored
HGDIOBJ font0;
HGDIOBJ brush0;
HGDIOBJ pen0;
XFORM transform0;
};
void NText::ScriptAnalysis::GetHDC(Graphics^ g, struct HDCInfo& info)
{
array<float>^ matrix = g->Transform->Elements;
pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true);
info.font0 = ::GetCurrentObject(info.hdc, OBJ_FONT);
info.brush0 = ::GetCurrentObject(info.hdc, OBJ_BRUSH);
info.pen0 = ::GetCurrentObject(info.hdc, OBJ_PEN);
::GetWorldTransform(info.hdc, &info.transform0);
::SetGraphicsMode(info.hdc, GM_ADVANCED);
::SetBkMode(info.hdc, TRANSPARENT);
::SetWorldTransform(info.hdc, (XFORM*) p_transform);
}
====================
The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text.
Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something else?)
I will investigate that.....
Anyway if any of you had similar experience and could shed some light?
Here is how I initialize my HDC (Managed C++):
====================
struct HDCInfo
{
HDC hdc;
// to be restored
HGDIOBJ font0;
HGDIOBJ brush0;
HGDIOBJ pen0;
XFORM transform0;
};
void NText::ScriptAnalysis::GetHDC(Graphics^ g, struct HDCInfo& info)
{
array<float>^ matrix = g->Transform->Elements;
pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true);
info.font0 = ::GetCurrentObject(info.hdc, OBJ_FONT);
info.brush0 = ::GetCurrentObject(info.hdc, OBJ_BRUSH);
info.pen0 = ::GetCurrentObject(info.hdc, OBJ_PEN);
::GetWorldTransform(info.hdc, &info.transform0);
::SetGraphicsMode(info.hdc, GM_ADVANCED);
::SetBkMode(info.hdc, TRANSPARENT);
::SetWorldTransform(info.hdc, (XFORM*) p_transform);
}
====================