高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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 !
|