textDescent()
例子
float base = height * 0.75;
float scalar = 0.8; // Different for each font
textSize(32); // Set initial text size
float a = textDescent() * scalar; // Calc ascent
line(0, base+a, width, base+a);
text(“dp”, 0, base); // Draw text on baseline
textSize(64); // Increase text size
a = textDescent() * scalar; // Recalc ascent
line(40, base+a, width, base+a);
text(“dp”, 40, base); // Draw text on baseline
描述
返回当前字体在当前大小下的下行高度。这条信息在检测字体在基线以下的高度时非常有用。例如,将textAscent() 和 textDecsent() 相加会得到这一行的总高度。
语法
textDescent()
返回值类型
float
相关
textAscent()
- 本文固定链接: http://iprocessing.cn/2017/07/15/textdescent文本下行高度/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表