yj821005 发表于 2005-7-27 08:33:00

[求助]定义字体问题

<P>&nbsp;&nbsp;&nbsp; Const DEFAULT_CHARSET As Long = 1<BR>&nbsp;&nbsp;&nbsp; Const FIXED_PITCH As Long = 1<BR>&nbsp;&nbsp;&nbsp; Const FF_ROMAN As Long = 16<BR>&nbsp;&nbsp;&nbsp; Dim TextColl As AcadTextStyles<BR>&nbsp;&nbsp;&nbsp; Set TextColl = ThisDrawing.TextStyles<BR>&nbsp;&nbsp;&nbsp; Dim textStyle As AcadTextStyle<BR>&nbsp;&nbsp;&nbsp; Set textStyle = TextColl.Add("Yujun")<BR>&nbsp;&nbsp;&nbsp; Dim TypeFace As String<BR>&nbsp;&nbsp;&nbsp; Dim Bold As Boolean<BR>&nbsp;&nbsp;&nbsp; Dim Italic As Boolean<BR>&nbsp;&nbsp;&nbsp; Dim CharSet As Long<BR>&nbsp;&nbsp;&nbsp; Dim PitchAndFamily As Long<BR>&nbsp;&nbsp;&nbsp; TypeFace = 仿宋_GB2312"</P>
<P>&nbsp;&nbsp;&nbsp; Bold = False<BR>&nbsp;&nbsp;&nbsp; Italic = False<BR>&nbsp;&nbsp;&nbsp; CharSet = DEFAULT_CHARSET<BR>&nbsp;&nbsp;&nbsp; PitchAndFamily = FIXED_PITCH Or FF_ROMAN<BR>&nbsp;&nbsp;&nbsp; textStyle.SetFont TypeFace, Bold, Italic, CharSet, PitchAndFamily<BR>&nbsp;&nbsp;&nbsp; textStyle.height = 3<BR>&nbsp;&nbsp;&nbsp; textStyle.Width = 0.7</P>

<P>以上代码是我定义的一种字体,但是用的是仿宋_GB2312,也就是Windows自带的字体,但是我想改成CAD特有的.shx字体,如simplex9.shx如何修改,将TypeFace = 仿宋_GB2312"直接改成TypeFace = simplex9.shx"好像不对,</P>
<P>请问各位如何解决,谢谢!</P>

wyj7485 发表于 2005-7-27 10:49:00

<P>直接这样定义:</P>
<P>Dim MyTxtType As AcadTextStyle<BR>Set MyTxtType = ThisDrawing.TextStyles.Add("Yujun")<BR>MyTxtType.SetFont "simplex9.shx", False, False, 0, 0</P>

sharksun 发表于 2005-7-27 19:46:00

wyj7485发表于2005-7-27 10:49:00static/image/common/back.gif
直接这样定义:
Dim MyTxtType As AcadTextStyleSet MyTxtType = ThisDrawing.TextStyles.Add(\"Yujun\")MyTxtType.SetFont \"simplex9....


<P><BR>&nbsp;&nbsp;&nbsp; 应该是setfont "simplex", 没有.shx,&nbsp; 只有设置大字体时,才需要后缀的。<BR></P>
<P>另外,楼主,simplex9是什么字体?fonts文件里没有的话,当然会出错的。</P>

yj821005 发表于 2005-7-28 08:23:00

<P>郁闷,好像两位说的都不行啊,字体文件里面肯定有的。刚才试了试好像只有“txt”是能通过的,其他都不能通过,而且运行完了好像并没有设置为“txt”字体</P>

wyj7485 发表于 2005-7-28 08:58:00

wyj7485发表于2005-7-27 10:49:00static/image/common/back.gif
直接这样定义:
Dim MyTxtType As AcadTextStyleSet MyTxtType = ThisDrawing.TextStyles.Add(\"Yujun\")MyTxtType.SetFont \"simplex9....


<P>以上这种设置对汉字体有用</P>
<P>采用以下语句就可以了:</P>
<P>Dim MyTxtType As AcadTextStyle<BR>Set MyTxtType = ThisDrawing.TextStyles.Add("Yujun")<BR>MyTxtType.fontFile = "simplex9.shx"<BR></P>

yj821005 发表于 2005-7-28 09:40:00

谢谢楼上的,送鲜花一朵!呵呵
页: [1]
查看完整版本: [求助]定义字体问题