Home » U++ Library support » RichText,QTF,RTF... » Bad text quality problem in Qtf
Bad text quality problem in Qtf [message #24509] |
Thu, 21 January 2010 17:36 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
I have found some strange behaviour. This is the code labelled "Case B" in picture. The text "(Hello)" looks well.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
void MyFunc() {
ImageDraw idw(1200, 600);
idw.DrawRect(0, 0, 1200, 600, White);
idw.DrawText(0, 0, "(Hello)", Serif(400));
DrawingDraw dw(350, 250);
dw.DrawImage(0, 0, 350, 250, idw);
QtfRichObject pict(CreateDrawingObject(dw.GetResult(), Size(350, 250), Size(350, 250)));
String qtf;
qtf << "[A6 This is some drawing in QTF: " << pict << "&";
qtf << "[C3*@B And now in the table: {{1:1 " << pict << ":: Another cell " << pict << "}}";
PromptOK(qtf);
}
GUI_APP_MAIN {
MyFunc();
}
If It is called MyFunc() in a bigger program it is got "Case A", where text is bad rendered
Is there any parameter in RichEdit to do a good os bad quality rendering ?
Best regards
Koldo
-
Attachment: dib.PNG
(Size: 31.18KB, Downloaded 799 times)
Best regards
Iñaki
|
|
|
Re: Bad text quality problem in Qtf [message #24510 is a reply to message #24509] |
Thu, 21 January 2010 17:43 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
koldo wrote on Thu, 21 January 2010 17:36 | Hello all
I have found some strange behaviour. This is the code labelled "Case B" in picture. The text "(Hello)" looks well.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
void MyFunc() {
ImageDraw idw(1200, 600);
idw.DrawRect(0, 0, 1200, 600, White);
idw.DrawText(0, 0, "(Hello)", Serif(400));
DrawingDraw dw(350, 250);
dw.DrawImage(0, 0, 350, 250, idw);
QtfRichObject pict(CreateDrawingObject(dw.GetResult(), Size(350, 250), Size(350, 250)));
String qtf;
qtf << "[A6 This is some drawing in QTF: " << pict << "&";
qtf << "[C3*@B And now in the table: {{1:1 " << pict << ":: Another cell " << pict << "}}";
PromptOK(qtf);
}
GUI_APP_MAIN {
MyFunc();
}
If It is called MyFunc() in a bigger program it is got "Case A", where text is bad rendered
Is there any parameter in RichEdit to do a good os bad quality rendering ?
Best regards
Koldo
|
Oh !
If MyFunc() is called in a package without Painter, it works well.
If we add Painter to the package (and we do not call any Painter function), the bad render is got
Best regards
Koldo
Best regards
Iñaki
|
|
|
Re: Bad text quality problem in Qtf [message #24522 is a reply to message #24509] |
Fri, 22 January 2010 09:32 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
I have included the simplest sample of the problem.
If you run it it gets the text bad rendered.
If you just remove Painter package, it renders the text right.
Best regards
Koldo
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
ImageDraw idw(1200, 600);
idw.DrawRect(0, 0, 1200, 600, White);
idw.DrawText(0, 0, "(Hello)", Serif(400));
DrawingDraw dw(350, 250);
dw.DrawImage(0, 0, 350, 250, idw);
QtfRichObject pict(CreateDrawingObject(dw.GetResult(), Size(350, 250), Size(350, 250)));
PromptOK(String("[A5 Rendering problem: ") + pict.ToString());
}
Best regards
Iñaki
|
|
|
|
|
|
Re: Bad text quality problem in Qtf [message #24545 is a reply to message #24541] |
Sat, 23 January 2010 20:25 |
|
koldo wrote on Sat, 23 January 2010 19:45 | I have tried to find the source of the problem but I cannot find how Painter affects Qtf painting if Painter is not used explicitly.
|
Hi Koldo!
If I remember correctly, the trick is that both Draw and Painter define their DrawTextOp, DrawRectOp etc... Look for that if you want to see the connection to Painter.
But I don't now how to set the quality without BufferPainter, so I'm not really helping... sorry.
Best regards,
Honza
|
|
|
|
Re: Bad text quality problem in Qtf [message #24549 is a reply to message #24548] |
Sat, 23 January 2010 21:45 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
andrei_natanael wrote on Sat, 23 January 2010 20:45 | Hi Koldo,
I know what your problem is related to. When you add Painter package and compile with it, it put at program initialization two pointers in Draw package for it to use Painter initialization functions for ImageAnyDraw. Your problem is related to line 233 in Painter/DrawOp.cpp
INITBLOCK {
ImageAnyDrawPainter(sCP, sEP);
}
Sorry for delayed response.
Andrei
|
Yes, it is there (thank you Honza too )
The problem is in sCP:
void ImageAnyDrawPainter(Draw *(*f)(Size sz), Image (*e)(Draw *w))
{
//sCreateImageDraw = f;
sExtractImageDraw = e;
}
With this comment, there is no problem.
sCP is:
static Draw *sCP(Size sz)
{
return new ImagePainter(sz);
}
and ImagePainter is:
class ImagePainter : private ImageBuffer__, public BufferPainter {
public:
ImagePainter(Size sz, int mode = MODE_ANTIALIASED);
...
ImagePainter::ImagePainter(Size sz, int mode)
: ImageBuffer__(sz), BufferPainter(ImageBuffer__::ib, mode)
{}
So ImagePainter is MODE_ANTIALIASED...
but it does not work like this.
Best regards
Koldo
Best regards
Iñaki
|
|
|
|
Re: Bad text quality problem in Qtf [message #24584 is a reply to message #24569] |
Mon, 25 January 2010 09:59 |
|
koldo
Messages: 3394 Registered: August 2008
|
Senior Veteran |
|
|
Hello Mirek
It seems not a problem of RichEdit itself.
Just before PromptOK there are now two lines to save the image and it looks perfect.
GUI_APP_MAIN
{
ImageDraw idw(1200, 600);
idw.DrawRect(0, 0, 1200, 600, White);
idw.DrawText(0, 0, "(Hello)", Serif(400));
DrawingDraw dw(350, 250);
dw.DrawImage(0, 0, 350, 250, idw);
QtfRichObject pict(CreateDrawingObject(dw.GetResult(), Size(350, 250), Size(350, 250)));
/**/ PNGEncoder png;
/**/ png.SaveFile("c:\\kk.png", pict.obj.ToImage(Size(350, 250)));
PromptOK(String("[A5 Rendering problem: ") + pict.ToString());
}
Best regards
Koldo
Best regards
Iñaki
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 03:31:53 CEST 2024
Total time taken to generate the page: 0.03591 seconds
|