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

oddbtextiterator returns wrong value
oddbtextiterator returns wrong value
with the drawing attached, on the third line of asian characters down (the line starting with ( a' ), when i use the following code, the first character gives me the wrong value, the lead character value is correct, but when retreiving the next character, the value is 0x0000, however when viewing the textptr->textstring().c_str() the value is correct? what must i be doing wrong?
my code that i use is as follows, and the drawing is attached for you.
cheers
jason
odcodepageid id = m_dwgdb->getdwgcodepage();
odgitextstyle *pstyle = new odgitextstyle();
oddbtextiteratorptr txtitr = oddbtextiterator::createobject(textptr->textstring().c_str(), strlen(textptr->textstring().c_str()), false, cp_ascii, pstyle);
do {
oduint16 curchar = 0x0000;
curchar = txtitr->nextchar();
if( odcharmapper::isleadbyte(curchar, id) ) {
curchar = curchar << 8;
oduint16 nextcurchar = 0x0000;
nextcurchar = txtitr->nextchar();
curchar = curchar | nextcurchar;
}
// now convert it to unicode.
oduint16 uchar;
odcharmapper::codepagetounicode(curchar, id, uchar);
pmystring->addchar(uchar);
} while(txtitr->currproperties().blastchar == false );
attached files
quote:
originally posted by janderssen
odcodepageid id = m_dwgdb->getdwgcodepage();
odgitextstyle *pstyle = new odgitextstyle();
oddbtextiteratorptr txtitr = oddbtextiterator::createobject(textptr->textstring().c_str(), strlen(textptr->textstring().c_str()), false, cp_ascii, pstyle);
1. you need to do next:
code:
odcodepageid id = m_dwgdb->getdwgcodepage();
odgitextstyle style;
gifromdbtextstyle(textptr->textstyle(), style);
oddbtextiteratorptr txtitr = oddbtextiterator::createobject(textptr->textstring().c_str(), strlen(textptr->textstring().c_str()), false, id, pstyle);
text style must correspond with text and parameter codepage is equal id ( no cp_ascii ).
2. nextchar() method return value depend of font coding.(for example: it is unicode for unicode shx & ttf fonts and multibyte for bigfont).
so you no need make conversion in most case.
--
best regards,
sergey z.
sergey,
all works great except for the following text inside of this drawing as well.
\m+100bd\m+100c4\m+100db\m+100b0\m+100b8
as an example, \m+100bd gets converted to bd, where it should be a totally different value.
also note that this is the only line of text that gets converted wrong. is there something else i am missing. i have played around with lots of the odcharmapper functions to try and figure it out, but to no success.
cheers
jason
quote:
originally posted by sergey z.
1. you need to do next:
code:
odcodepageid id = m_dwgdb->getdwgcodepage();
odgitextstyle style;
gifromdbtextstyle(textptr->textstyle(), style);
oddbtextiteratorptr txtitr = oddbtextiterator::createobject(textptr->textstring().c_str(), strlen(textptr->textstring().c_str()), false, id, pstyle);
text style must correspond with text and parameter codepage is equal id ( no cp_ascii ).
2. nextchar() method return value depend of font coding.(for example: it is unicode for unicode shx & ttf fonts and multibyte for bigfont).
so you no need make conversion in most case.
--
best regards,
sergey z.

hi cheers,
string \m+100bd\m+100c4\m+100db\m+100b0\m+100b8 is rendered by bigfont.shx. coding bigfont is multibyte. so text iterator return multibyte value from this string ( it is 0xbd, 0xc4 etc.).
acad help:
"\m+nxxxx
multibyte shape number. the n is a digit identifying the originating multibyte code page id. the xxxx is the hexadecimal value of the multibyte character."
--
best regards,
sergey z.
sergey,
than why does the rest of the drawings text get converted to the correct unicode charcters i need, because the rest of the asian characters are encoded in the same \m+1xxxx format.
it is only this one single line that seems to be wrong?
also note that if i check txtitr->currproperties().binbigfont it returns false?
also, how does one read the geometry of a bigfont.shx. i do all my vectorization myself manually, and do not go through the opendwg vectorization frame work. but i cannot seem to see how one can get the geometry for a single character via opendwg?
cheers
jason
quote:
originally posted by sergey z.
hi cheers,
string \m+100bd\m+100c4\m+100db\m+100b0\m+100b8 is rendered by bigfont.shx. coding bigfont is multibyte. so text iterator return multibyte value from this string ( it is 0xbd, 0xc4 etc.).
acad help:
"\m+nxxxx
multibyte shape number. the n is a digit identifying the originating multibyte code page id. the xxxx is the hexadecimal value of the multibyte character."
--
best regards,
sergey z.
quote:
originally posted by janderssen
than why does the rest of the drawings text get converted to the correct unicode charcters i need, because the rest of the asian characters are encoded in the same \m+1xxxx format.
it is only this one single line that seems to be wrong?
also note that if i check txtitr->currproperties().binbigfont it returns false?
it is strange. i am not able reproduce this on my computer. in case bigfont.shx is accessed in your computer (and dwgdirect has found it) all symbols like \m+1xxxx in attached file have to be in multibyte coding. does odamfcapp example show correctly attached file?
note: about support fonts see dwgdirect reference topic "font handling".
quote:
originally posted by janderssen
also, how does one read the geometry of a bigfont.shx. i do all my vectorization myself manually, and do not go through the opendwg vectorization frame work. but i cannot seem to see how one can get the geometry for a single character via opendwg?
i afraid you can't get geometry for a single character via opendwg directly.
see topic "text with shx font by polylines"
--
best regards,
sergey
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


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

高级搜索
显示模式

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

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

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】exploded arc is in the wrong direction yang686526 DirectDWG 0 2009-05-05 10:13 AM
【转帖】c++中动态内存分配引发问题的解决方案(转) huangyhg vc编程 0 2008-10-27 11:37 AM


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


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