图形绘制与触摸屏交互技术详解
1. 文本属性与缩放
1.1 文本属性控制
除了字体名称和大小,还能控制文本对齐方式(LEFT、RIGHT、CENTER、BOTTOM、TOP)以及行间距。示例代码如下:
size(900, 300);
PFont titleFont = createFont("Serif", 32);
PFont textFont = createFont("Serif", 28);
textFont(titleFont);
textAlign(CENTER);
fill(120);
text("On Exactitude in Science", width/2, 60);
textFont(textFont);
textAlign(RIGHT);
textLeading(60);
text("...In that Empire, the Art of Cartography attained such Perfection " +
"that the map of a single Province occupied the entirety of a City, " +
"and the map of the Empire, the entirety of a Province.",
20, 100, width - 40, height - 20);
通过上述代码,可以设置不同的字体、对齐方式和行间距,实现多样化的文本布局。
1.2 文本缩放
利用 displayDens
超级会员免费看
订阅专栏 解锁全文

1213

被折叠的 条评论
为什么被折叠?



