几何尺寸与公差论坛------致力于产品几何量公差标准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-06, 10:43 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】problem finding fonts

problem finding fonts
problem finding fonts
i have been testing a vectorization program that i wrote to translate dwg files into another vector drawing format. i have tested on several pcs. i include the autocad shx font files in the same directory as the exe. on one of the pcs it does not seem to be finding the shx files. instead of stick fonts i get tesselated text (vectors with width and filled). while this looks ok it results in huge output files. on that pc i verified that the shx files are in the same directory as the exe. it did find the shx files when i put them in the same directory as the dwg, but that is not a good solution as there maybe many directory to be processed.
how does dwgdirect search for shx files?
hi,
in autocad are serveral ways:
(1) add your fontpath to supportpath via preferences.files.supportpath
example:
currsupportpath = preferences.files.supportpath
...
//add your fontpath
(2) parsetextstyles in your document/dwg and put the correct path to your textstyle via property fontfile with fullpath.
i prever (1), because it's easy to change of different pc's.
____________
ralph
[quote=hi-cads] thank you for your reply.
the problem is that it might be the case that autocad will not be loaded on the pcs that are doing the translation. so i need to know how to specify the font path within dwgdirect.
mark
how dd searches the fonts is described in
developer's guide/font handling
sergey slezkin
i have looked at the steps that dd goes through for finding the fonts. the mystery to me is why on this one test pc that when i have the font files in the current directory that it does not find them. i added code to display the current working directory to verify that i am in the correct directory.
the only thing different about this pc is that it has autodesk map installed. autocad is also installed on this pc.
mark

i came up with a work around solution to the problem on the one pc. i overide the findfile and check for the shx file in the current working directory. if the file exist in the current working directory then i return the fully pathed shx file name. if the shx does not exist in the current directory then i let dd find the font or substitute font file by making a call to the oddbhostappservices::findfile.
mark
strange. dd implementation of findfile() looks into current directory.
first it tries to access file using the path passed as parameter.
next step is to extract only file name with extension (remove path) and try to acces it. if the file is in current folder this step will succeed.
are you sure that by the moment findfile is called the current directory is ok?
sergey slezkin
sergey 鈥?yes is my reply to your question 鈥淎re you sure that by the moment findfile is called the current directory is ok?鈥? my work around is to build a file name with the full path specified (inside my override of the findfile routine). i get the path to the current directory with a call the windows platform sdk routine getcurrentdirectory.
i recall having a similar problem a few years back where i thought that just specifying the file name without a path would result in it being opened in the current directory. i don鈥檛 recall the details of the problem, but i think it was a windows program and not a command line program. i believe my solution to that problem was to add the prefix 鈥?\鈥?to the file name. 鈥?\鈥?being the current working directory.
it turns out that it was not an isolated case of one pc. i found that at some point on my pc that i put the shx font files in the input dwg data directory. for testing on other pcs i had copied the data from my pc except the one pc that i was having problems on. so that it why it worked on all the other pc except one.
when i removed the shx files from the directory with the dwg, i get the some problem with the dd findfile and the output files getting huge (text with tessellated fills). note that for display programs this would also make display very slow. the amount of vector data output is 10 times larger. this will not appear to be much of a problem with small test dwg files, but when you are starting with some dwg files as large as 6 megabyte and are processing hundreds of these files then the amount of output data does matter. why is the substitute font a font with width and tesselated fills?
i am working in windows 2000. i鈥檓 building my processing dll with visual studio 6.0. all the dwg files i am processing are 2d.
in any case my override of findfile seems to have solved the problem i was having.
mark
if shx is not found dd tries to find similar ttf font and uses txt.ttf instead of txt.shx for example.
autocad installs ttf equivalents for shx fonts.
probably your application does not handle ttf texts and they are displayed by polygons/triangles.
sergey slezkin
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】handle true type fonts in vectorize yang686526 DirectDWG 0 2009-05-05 11:44 AM
【转帖】gdi leak with ttf-fonts yang686526 DirectDWG 0 2009-05-05 11:10 AM
【转帖】fonts not read yang686526 DirectDWG 0 2009-05-05 11:05 AM
【转帖】embedded fonts yang686526 DirectDWG 0 2009-05-05 09:01 AM
【转帖】ddx1.06 rendering beta - rendering of fonts yang686526 DirectDWG 0 2009-05-04 07:08 PM


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


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