首页 > 文档 > textAscent()文本上行间距
2017
07-15

textAscent()文本上行间距

textAscent()

 

例子

textAscent()文本上行间距 - 第1张  | Processing编程艺术float base = height * 0.75;

float scalar = 0.8; // Different for each font

 

textSize(32); // Set initial text size

float a = textAscent() * scalar; // Calc ascent

line(0, base-a, width, base-a);

text(“dp”, 0, base); // Draw text on baseline

 

textSize(64); // Increase text size

a = textAscent() * scalar; // Recalc ascent

line(40, base-a, width, base-a);

text(“dp”, 40, base); // Draw text on baseline

 

描述

返回当前字体在当前大小下的上行间距。这条信息对于检测字体在基线之上的高度十分有用。例如,将textAscent() 和 textDescent() 相加会得到这一行的总高度。

 

语法    

textAscent()

 

返回值类型

float

 

相关

textDescent()



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

留下一个回复

你的email不会被公开。