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

displaying true type
displaying true type
hello,
some text with true type font are not displayed correctly with dwgdirect.
to understand my problem, i'm going to explain how i have resolved it in toolkit/viewkit.
in toolkit/viewkit we had a function named winexaminettf.
in this function, if facename is null, we call getttfontnamebyfilename, and then enumfontfamilies with the new facename.
in my dwg the facename is null, i call getttfontnamebyfilename and get "times new roman bold italic", then i call enumfontfamilies, but this function does not find this font ????
however if i replace, bold by gras and italic by italique (french windows) and i call enumfontfamilies with "times new roman gras italique" it works !!!
in dwgdirect the findfile function find the ttf file but the display doesn't work (it display rectangles).
so my question is: where can i replace the ttfontname in dwgdirect ?
is it in odfindttf.h/.cpp files ? if so, how can i use this file ?
regards,
i met similar problems.
in odamdiapp in 1.08, i thought i need to resolve the ttf file path to display ttf correctly. so i tried to override oddbhostappservices::findfile. but it didn't work.
but when "ms ui gothic.ttf" was used in a dwg file, it was displayed correctly without my version of oddbhostappservices::findfile.
my questions are:
1. does dwgdirect toolkit have any their own implementation to resolve the ttf file path?
2. to override the implementation, is it the only way to override oddbhostappservices::findfile? how about oddbhostappservices::ttffilenamebydescriptor()?
3. to implement my version of oddbhostappservices::findfile, which string below should i return?
1) full path file name ( ex. "c:\\windows\\font\\aaa.ttf" )
2) file name without path ( ex. "aaa.ttf" )
3) ttf face name ( to search in hklm\software\microsoft\windows\currentversion\fon ts) ( ex. "aaa gothic bold italic" )
thank you for your help.
junichi yoshimoto
ttf font problem
i have problem about ttf font.
i opened a drawing with chinese ttf fonts using odamfcapp example program. all the chinese characters were displayed as "?".
my operating system is chinese windows 2000. ttf font file is "simhei.ttf", "simsun.ttc" and "simfung.ttf".
odamfcapp called exhostappservices::ttffilenamebydescriptor for "simsun.ttc" and "simfung.ttf", but didn't call for "simhei.ttf". why?
odamfcapp called codamfcappapp::findfile for all the ttf fonts, including "simhei.ttf".
i changed the code in exhostappservices::ttffilenamebydescriptor, now odamfcapp can display "simsun.ttc" and "simfung.ttf" fonts correctly, but because odamfcapp never call exhostappservices::ttffilenamebydescriptor for "simhei.ttf", text in that fonts are still displayed as "?".
in codamfcappapp::findfile, when file=="simhei.ttf", the return value is "c:\\winnt\\simhei.ttf". it is correct.
can anyone help me?
ycf888
quote:
1. does dwgdirect toolkit have any their own implementation to resolve the ttf file path?
2. to override the implementation, is it the only way to override oddbhostappservices::findfile? how about oddbhostappservices::ttffilenamebydescriptor()?
yes. dwgdirect toolkit has default implementation to resolve
fonts file path. some additional information you can find here
quote:
3. to implement my version of oddbhostappservices::findfile, which string below should i return?
the function must return the string like "c:\\windows\\font\\aaa.ttf".
some correction in this functionality was made in dwgdirect version 1.09. try to use last update this version (november).
regards,
sergey zaitcev.
sergey.
in v.1.09(nov.), oddbhostappservices::findfile() seems to be improved, but some ttf still be displayed as "???".
my environment is win2k(japanease), vc6. i tested using a dwg file( ttftest.dwg ), and the result is below.
---
note:
1) 1st param (const char* pcfilename) of oddbhostappservices::findfile().
2) odstring returned from oddbhostappservices::findfile().
3) font is displayed correctly or not.
1) 2) 3)
[ms ui gothic.ttf] [] [yes]
[msgothic.ttc] [c:\winnt\fonts\msgothic.ttc] [no]
[msprgot.ttf] [c:\winnt\fonts\msprgot.ttf] [yes]
[ms gothic.ttf] [] [no]
[msgothic.ttc] [c:\winnt\fonts\msgothic.ttc] [no]
[hgpsoeikakugothicub.ttf] [] [no]
[hgrsmp.ttf] [c:\winnt\fonts\hgrsmp.ttf] [no]
[hgrskp.ttf] [c:\winnt\fonts\hgrskp.ttf] [no]
[hgpsoeikakupoptai.ttf] [] [no]
---
i think this problem could relates to find the ttf face name.
in opendwg viewkit, a function passing to adsetad2examinettffn() is responsible to find logfont.
i used winexaminettf() found in /nonlibs/examples/win/ttf/adwingdi.c. but for some ttf, it didn't work. if enumfontfamilies finds logfont, effexamineproc() is called by enumfontfamilies. the 1st and 4th param of effexamineproc is logfont and lparam, and it compares a charset number, italic or not, bold or not, and face name, and if these are the same, it returns 0(found).
i made a test version to display ttftest.dwg using viewkit, and got the same problem. "ms ui gothic.ttf" and "msprgot.ttf" were displayed correctly, but others were not.
for instance, in "msgothic.ttc" case, enumfontfamilies can find the logfont, so effexamineproc() is called. but in effexamineproc(), the facename (enumlogfont far *)plogfont->elflogfont.lffacename is not equal to (pad_ttf_data)lparam->facename, because (enumlogfont far *)plogfont->elflogfont.lffacename returns a japanease face name, and (pad_ttf_data)lparam->facename is "msgothic.ttc".
effexamineproc() is called only once for "msgothic.ttc", and the logfont is the right font except the japanease name. so, i modified effexamineproc() (if enumfontfamilies can't find the font, clear the pttf->facename, call enumfontfamilies again, and copy (enumlogfont far *)plogfont->elflogfont.lffacename to (pad_ttf_data)lparam->facename. there might be more smart way...) and it became to find the right font, and it was displayed correctly.
i found odfindttf.cpp in examples/win/ttf/ in dd. i'm not sure this source is used in dd or not, but if it is used, findfulltypeface() could have the same problem i wrote above.
---
my questions are:
1) does dd have the way to find the font in case logfont.lffacename doesn't have an equal name to the facename?
2) if it doesn't, is there the way to override these finding font function?
thank you for your help.
junichi yoshimoto
quote:
i found odfindttf.cpp in examples/win/ttf/ in dd. i'm not sure this source is used in dd or not, but if it is used, findfulltypeface() could have the same problem i wrote above.
this source isn't used but some functionality was replaced into c++ dwgdirect.
quote:
1) does dd have the way to find the font in case logfont.lffacename doesn't have an equal name to the facename?
2) if it doesn't, is there the way to override these finding font function?
dd doesn't have such functionality. i have reproduced this situation. this is really problem with face names. we are going to fix this problem in next version dd.
best regards,
sergey z.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】模拟南方软件下polyline线的输入(并进行修改),不敢独享 - 精华帖集合 yang686526 ObjectARX(VB.NET/C#) 0 2009-04-29 05:37 PM
【转帖】哪位高手指点一下下边lisp的怎么用 yang686526 数据库ObjectDBX 0 2009-04-28 12:13 PM
哪位高手指点一下下边lisp的怎么用 yang686526 ObjectARX(AutoLISP) 0 2009-04-26 06:19 PM
【转帖】asme美国机械工程师标准目录2 huangyhg American standards 5 2009-04-26 02:38 PM


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


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