高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】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.
|