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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-07, 03:01 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】rendering Text With Odamfc

rendering text with odamfc
rendering text with odamfc
hi,
there a difference in text rendering between autocad and odamfc.
if the zoom is too big we can't read text with ttf font. files in attachment show the difference, in odamfc the text "hello world" is very hard to read.
can you give me advices to resolve this problem ?
best regards,
froggy.
attached images
is that gl or gdi device?
perhaps regen will help.
vladimir
i reproduce it in odamfcappdll.exe with wingdi.gs.
if i click on "regen all" it doesn't change anything.
i see. now i remember that bug. the cause is that we do not render ttf text with gdi functions (and therefore get no antialiasing and other built-in bonuses)
it can be fixed on client side (in exgigdigeometry::textproc or exgdivectorizeview::text), but it is not quite trivial. the main issue is text width, that should remain consistent while zooming.
see the commented code in \extensions\exrender\win\exgigdigeometry.cpp, exgigdigeometry::textproc
vladimir
we are using dd 2.03.00.
is this bug fixe in dd 2.05.01 ?
no.
the fix is not even planned.
vladimir
you say that it is not trivial, but do you someone who have implemente this feature and can help me ?
not sure i understand you.
i pointed you the place where to start, if you want fo fix it yourself.
what else do you require?
vladimir
quote:
not sure i understand you.
i want the code !
thank you for your advices, vladimir and sorry for my question.
well, i am not sure that i can implemente that code and i don't have much time to spend on this problem, so if you have the code or know someone who have implemented it and can help me, i will be very happy !
best regards,
froggy.
rendering text
hi vladimir,
we are migrating from dd 2.03.00 to dd 2.05.02 and we try to fixe the bug on ttf text rendering.
the problem is that exgigdigeometry::textproc is never call (only exgigdigeometry::shellproc) and exgdivectorizeview::text calls odgsbasevectorizeview::text, but we are not able to implemente this fonction.
can this bug still be fixed on client side ?
best regards,
froggy.
quote:
originally posted by froggy
can this bug still be fixed on client side ?
yes you can.
exgigdigeometry::textproc is not called, because default metafile recorder does not create text records when creating gs model cache (it always explodes text to polylines).
you should do it yourself, like in exgdivectorizeview:wnerdrawdc it is done for "owner draw" calls.
(note that you should check if the text is true type - it is more effective to draw shx text as polylines).
vladimir
sorry, but i don't understand when you say: "you should do it yourself,".
what do i have to do and where ?
you should create metafile records for text objects in exgdivectorizeview::text, like it is done in exgdivectorizeview:wnerdrawdc. (look for recownerdrawdc)
(drawing is cached when rendered the first time or regenerated. cache records are metafile-like.)
vladimir
i need more help, vladimir.
i define a metafile record for texte, like this :
code:
struct tcrectext : odgigeometrymetafile::record
{
odgepoint3d position;
odgevector3d normal;
odgevector3d direction;
odstring msg;
bool raw;
odgitextstyle mtextstyle;

void play(odgiconveyorgeometry*, odgiconveyorcontext* pctx) const
{
exgdivectorizeview* pview = static_cast<exgdivectorizeview*>(pctx);
odgematrix3d x = pview->objecttodevicematrix();
pview->device()->textproc(x * position, x * normal, x * direction, msg.c_str(), msg.getlength(), raw, &mtextstyle, null);
}
};then in exgdivectorizeview::text, i create the record (only for ttf), or call textproc :
code:
void exgdivectorizeview::text(const odgepoint3d& position,
const odgevector3d& normal,
const odgevector3d& direction,
const odchar* msg,
odint32 length,
bool raw,
const odgitextstyle* ptextstyle)
{
if (device()->showtext())
{
device()->m_bprocessingttf = ptextstyle->isttffont();

if (ptextstyle->isttffont() == true)
{
odgsbasevectorizeview:ntraitsmodified();

if(m_pmetafiler->metafile() != null)
{
odgematrix3d x;
x = eyetooutputtransform() * getmodeltoeyetransform();
tcrectext *prec = new tcrectext;
prec->position = x * position;
prec->normal = x * normal;
prec->direction = x * direction;
prec->msg = msg;
prec->raw = raw;

oddbdatabase *pdatabase = (oddbdatabase*)usergicontext()->database();
prec->mtextstyle.set(ptextstyle->getfontfilepath(pdatabase)
, ptextstyle->getbigfontfilepath(pdatabase)
, ptextstyle->textsize()
, ptextstyle->xscale()
, ptextstyle->obliquingangle()
, ptextstyle->trackingpercent()
, ptextstyle->isbackward()
, ptextstyle->isupsidedown()
, ptextstyle->isvertical()
, ptextstyle->isoverlined()
, ptextstyle->isunderlined());
prec->mtextstyle.setcodepage(ptextstyle->getcodepage());
prec->mtextstyle.setshapeloaded(ptextstyle->isshapeloaded());
prec->mtextstyle.setisshape(ptextstyle->isshape());
prec->mtextstyle.setpreloaded(ptextstyle->ispreloaded());
prec->mtextstyle.setshxfont(ptextstyle->isshxfont());
prec->mtextstyle.ttfdecriptor() = ptextstyle->ttfdecriptor();
prec->mtextstyle.setfontfilepath(ptextstyle->getfontfilepath(pdatabase));
prec->mtextstyle.setbigfontfilepath(ptextstyle->getbigfontfilepath(pdatabase));
prec->mtextstyle.setfont(ptextstyle->getfont());
prec->mtextstyle.setbigfont(ptextstyle->getbigfont());
m_pmetafiler->metafile()->add(prec);
}
else
{
exgsgdivectorizedevice *pexgsgdivectorizedevice = device();
odgematrix3d x;
x = eyetoscreenmatrix() * getmodeltoeyetransform();
pexgsgdivectorizedevice->textproc(x * position, x * normal, x * direction, msg, length, raw, ptextstyle, null);
}
}
else
{
odgsbasevectorizeview::text(position, normal, direction, msg, length, raw, ptextstyle);
}
device()->m_bprocessingttf = false;
}
}now textproc is call, but it doesn't works, texts are not displayed in my view.
is it a good start ?
regards.
it is a good start, yes.
is tcrectext:lay called after regen?
see what coordinates are passed to textproc()
vladimir
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】question about brackets [ ] in text and mtext entity yang686526 DirectDWG 0 2009-05-07 12:08 PM
【转帖】oddbtext to oddbmte yang686526 DirectDWG 0 2009-05-06 08:17 PM
【转帖】custom properties for multiple part configurations yang686526 SolidWorks二次开发 0 2009-04-13 10:08 AM
【转帖】linked sketch text now possible1 9sort of0 yang686526 SolidWorks二次开发 0 2009-04-12 09:34 PM
Unicode、UCS、UTF、BMP、BOM huangyhg vc编程 2 2007-01-22 05:43 PM


所有的时间均为北京时间。 现在的时间是 02:05 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多