几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】shx Font Representation (http://www.dimcax.com/hust/showthread.php?t=18585)

yang686526 2009-05-07 03:55 PM

【转帖】shx Font Representation
 
shx font representation
shx font representation
i am developping a cad application where it is possible to write a text.
i would like to give the possibility to write also shx fonts.
so i am looking how to explode a text made with an shx font in polylines.
i am able to import correctly a dxf with shx font and explode it but
i am not able to use shx font without importing dxf.
now, if i want to represent the polulines of a text with shx font i do this:
oddbdatabaseptr pdb = myapp.createdatabase(true, false);
odstaticrxobject<dumpvectorizer> dv;
odstaticrxobject<odgicontextfordbdatabase> gicontext;
gicontext.setdatabase(pdb);
dv.setdrawcontext(&dv);
dv.setcontext(&gicontext);
odgitextstyle gistyle;
gicontext.getdefaulttextstyle(gistyle);
gistyle.setfont("solid.shx" ,false, false, 0, 0);
gistyle.setfontfilepath(ptext->getfontname());
dv.textproc(position, direction, upvector , pstrmsg, ilen, true, &gistyle);
i have the font solid.shx in the directory acad enviroment variable but what i obtained is a very simple and not very fine font completely different form solid.shx and differnet also from txt.shx.
am i doing everything correct?
thank you in advance for any help.
ftimillero
hi ftimillero,
1. use method setfilename(const char* fontname) for shx font instead of setfont().
2.
quote:
i have the font solid.shx in the directory acad enviroment variable
use gistyle.loadstylerec(oddbdatabase* pdb) instead of setfontfilepath() and dwgdirect must find font in your acad directory.
--
best regards,
sergey z.


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