Login  Register

Re: Re: drawing text issue

Posted by Johnson on May 23, 2013; 11:55am
URL: https://forum.librecad.org/drawing-text-issue-tp5708110p5708114.html

Hi Dxli
 
Yeah. It works.    the text could not be stored into DXF file.  I understand that because the "ABCD" could NOT be converted to CAD entities.  (  it's not a rs_entity too )
 
But I am confused why my below code could not work as expected.
 
----
void QC_ApplicationWindow::testFont()
{
    RS_PainterQt painter(getMDIWindow()->getGraphicView()->PixmapLayer2);
    painter.setPen(0,0,255);
    painter.drawText(0,0,"ABCD");
    painter.end();
    getGraphicView()->redraw();
}
----
 
After that, QG_GraphicView::paintEvent  will be called too. .. why the result is not like as your result with your code.
 
My another question is that now it seems even not response to "zoom in" / "zoom out " ,keep the size forever,   can I fix that to response to zoom in /out ?   Thanks.
 
About your "For the time being, let's fix bugs in 2.0 for a stable release. After that, we implement new features in 2.1. ".  do you mean you will fix this issue (still use stick font ) in later release ?
 
 

wingame82
 
From: [hidden email]
Date: 2013-05-23 19:09
To: [hidden email]
Subject: Re: drawing text issue
Hi Johnson,

You can draw text efficiently(see the patch).

CAD uses stick fonts because all fonts are drawn as lines(polylines) and can be converted to CAD entities.

I'm wondering if it's okay to support ordinary fonts, and only revert back to stick fonts when converting is needed. This means efficiency and easy support for all languages.

For the time being, let's fix bugs in 2.0 for a stable release. After that, we implement new features in 2.1.

Thanks,

dxli


diff --git a/librecad/src/lib/gui/rs_graphicview.cpp b/librecad/src/lib/gui/rs_graphicview.cpp
index 726286d..4ee6364 100644
--- a/librecad/src/lib/gui/rs_graphicview.cpp
+++ b/librecad/src/lib/gui/rs_graphicview.cpp
@@ -28,6 +28,7 @@
 #include <limits.h>
 #include "qc_applicationwindow.h"
 #include "rs_graphicview.h"
+#include "rs_painterqt.h"
 
 #include "rs_linetypepattern.h"
 #include "rs_eventhandler.h"
@@ -1094,6 +1095,13 @@ void RS_GraphicView::drawLayer2(RS_Painter *painter)
     // ----------------------------------------------------------
     if (!isPrintPreview())
         drawAbsoluteZero(painter);
+    RS_PainterQt* p0=dynamic_cast<RS_PainterQt*>(painter);
+    if(p0) {
+        DEBUG_HEADER();
+       p0->setPen(0,0,255);
+       p0->setFont(QFont("Times", 20, QFont::Bold));
+       p0->drawText(100, 100, 100, 100, Qt::AlignHCenter, "ABCD");
+    }
 }
 
 



If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/drawing-text-issue-tp5708110p5708111.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML