首页 > 文档 > textDescent()文本下行高度
2017
07-15

textDescent()文本下行高度

textDescent()

 

例子

float base = height * 0.75;

textDescent()文本下行高度 - 第1张  | Processing编程艺术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()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。