textAscent()
Typography / MetricsDescription
Returns the ascent of the current font at its current size. The ascent is the height of the character above the baseline.
Syntax
float textAscent()
Parameters
None
Returns
floatRelated
Under the Hood
From Processing.h:
float textAscent();
Under the Hood
From Processing.cpp:
float PApplet::textAscent() {
#if PROCESSING_HAS_STB_TRUETYPE
if (g_ttf.loaded) {
float sc = stbtt_ScaleForMappingEmToPixels(&g_ttf.info, g_textSize);
int asc; stbtt_GetFontVMetrics(&g_ttf.info, &asc, nullptr, nullptr);
return asc * sc;
}
#endif
int sc = std::max(1,(int)(g_textSize/8.0f));
return (BF_GH - 2) * sc;
}