Topic: 请熟悉Java图形编程的看过来。 |
Print this page |
1.请熟悉Java图形编程的看过来。 | Copy to clipboard |
Posted by: scottding Posted on: 2002-12-31 11:24 我在一个Graphic里面使用drawString,p为Point,st为一字符串,绘出来的效果如图,注意外框是我另外加上去的,然或通过getFontMetrics()得到了它的高和宽度,但是明显在高度上不是跟实际高度相匹配,我原以为起始点图中的point点应该在左上角,其实也不是,然后查了一点资料,说明还有什么ascent,descent,leading等等,但是我没有找到更加详细的资料把这些值应该出现在哪个部位标示出来,希望谁熟悉这方面的给我补充一下,或者提供一些更加详细的图形资料,谢谢。 g.drawString(st,p.x,p.y); |
2.Re:请熟悉Java图形编程的看过来。 [Re: scottding] | Copy to clipboard |
Posted by: snowbug Posted on: 2002-12-31 12:01 scottding wrote: When drawing swing font, the point p you use refer to the first point on the base line (the middle line in the graph below) |
3.Re:请熟悉Java图形编程的看过来。 [Re: scottding] | Copy to clipboard |
Posted by: scottding Posted on: 2002-12-31 13:22 你所指示的高度似乎和我实现的不一样哦,我是在打印的时候出现象我上面贴图出来的高出实际字体很多的高度。不知道这个是什么原因。 |
4.Re:请熟悉Java图形编程的看过来。 [Re: scottding] | Copy to clipboard |
Posted by: taogang Posted on: 2002-12-31 16:57 a snapshot of your code might be a bit more helpful than the description. |
5.snowbug is right [Re: scottding] | Copy to clipboard |
Posted by: 烂泥 Posted on: 2003-01-02 23:30 as title |
6.Re:请熟悉Java图形编程的看过来。 [Re: scottding] | Copy to clipboard |
Posted by: frankwg Posted on: 2003-02-14 14:18 use getAscent() instead, not getHeight() of the FontMetrics object. Because Height is the distance between two baselines. |
7.Re:请熟悉Java图形编程的看过来。 [Re: scottding] | Copy to clipboard |
Posted by: zyfleague Posted on: 2003-03-04 23:01 我觉得你在getHeight之前没有setfont. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |