几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】oddbtextgetgeomextents (http://www.dimcax.com/hust/showthread.php?t=17624)

yang686526 2009-05-06 08:18 PM

【转帖】oddbtextgetgeomextents
 
oddbtext::getgeomextents
oddbtext::getgeomextents
we are trying to get the extents of a text whitch begin or end with blank spaces.
is there a method or a function that can give us the extents of a text included blank space ?
we try oddbtext::getgeomextents and oddbtext::getboundingpoints none of them return the text extents included blank spaces.
note: with a ttf blank spaces are included in the extents, but with the standard they aren't
the behavior of oddbtext::getgeomextents method is the same acad (include ttf). now oddbtext entity hasn't function for getting extents of a text included leading and trailing blank space.
--
best regards,
sergey zaitcev
thank for your answer sergey and sorry, you are wright oddbtext::getgeomextents method is the same as acad.
i didn't try in autocad.
i made a mistake, i was thinking of an other function, this function is acgitextstyle::extents.
with this function we can have the width and the height of a text even if it include leading and trailing blank space.
in dwgdirect odgitextstyle::extents doesn't exist.
will you try to add it ?
now you try to use in your programm the next code.
code:
#include "dbtext.h"
#include "gi/gitextstyle.h"
#include "dbtextstyletablerecord.h"
#include "gi/gicontextfordbdatabase.h"
void calctextextents(oddbtextptr text)
{
odgitextstyle gistyle;
gifromdbtextstyle(text->textstyle(), gistyle);
gistyle.settextsize(text->height());
gistyle.setxscale(text->widthfactor());
gistyle.setobliquingangle(text->oblique());
odstaticrxobject<odgicontextfordbdatabase> gicontext;
gicontext.setdatabase(text->database());
odgepoint3d _min, _max, lastpos;
// extents with leading/trailing space

gicontext.textextentsbox(gistyle, text->textstring(), -1, kodgiincludepenups /*| kodgirawtext*/, _min, _max, &lastpos);
// oda_trace2("min x %f, y %f \n", _min.x, _min.y );
// oda_trace2("max x %f, y %f \n", _max.x, _max.y );
// extents without leading/trailing space
gicontext.textextentsbox(gistyle, text->textstring(), -1, 0, _min, _max, &lastpos);
// oda_trace2("min x %f, y %f \n", _min.x, _min.y );
// oda_trace2("max x %f, y %f \n", _max.x, _max.y );
}
--
best regards,
sergey zaitcev
thank you sergey, this will really help me !


所有的时间均为北京时间。 现在的时间是 07:41 PM.