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