a port of the Processing Visualization Language
Name

textAscent()

Processing.js Behavior Font support for the Canvas element varies across browsers. FireFox currently has the best support, but still uses a pre-defined set of fonts. (Documentation to follow soon.) Good alternatives to the browser's Canvas-font functions are available: such as the Glyph method. See also: Canvas Text, BurntToys Bauhaus.

Please use the following demos to learn how fonts can be rendered in Firefox with Processing.js: Letters, Words, width()

Examples
example pic
PFont font;
font = loadFont("FFScala.ttf"); 
textFont(font);

textSize(32); 
float ascent = textAscent();
text("dp", 0, 70);
line(0, 70-ascent, 100, 70-ascent); 

textSize(64);
ascent = textAscent();
text("dp", 35, 70);
line(35, 70-ascent, 100, 70-ascent);
Description

Returns ascent of the current font at its current size. This information is useful for determining the height of the font above the baseline. For example, adding the textAscent() and textDescent() values will give you the total height of the line.

Syntax
textAscent()
Returns Float
Usage Web & Application
Related textDescent()

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub