Class Index | File Index

Classes


Class FontMetrics


Defined in: graphics2d.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
FontMetrics(font)
This utility class allows to get the metrics of a given font.
Method Summary
Method Attributes Method Name and Description
 
Gets the font ascent.
 
Gets the font descent.
 
Gets the font height.
 
getStringBounds(aString)
Gets the bounds of the given string for this font metrics.
Class Detail
FontMetrics(font)
This utility class allows to get the metrics of a given font. Note that this class will approximate the metrics on older browsers where CanvasRenderingContext2D.measureText() is only partially implemented. Builds a font metrics instance for the given font.
Author: Renaud Pawlak, Emmanuel Puybaret.
Parameters:
{string} font
the given font, in a CSS canvas-compatible representation
Method Detail
{number} getAscent()
Gets the font ascent.
Returns:
{number} the font ascent

{number} getDescent()
Gets the font descent.
Returns:
{number} the font descent

{number} getHeight()
Gets the font height.
Returns:
{number} the font height

{java.awt.geom.Rectangle2D} getStringBounds(aString)
Gets the bounds of the given string for this font metrics.
Parameters:
{string} aString
the string to get the bounds of
Returns:
{java.awt.geom.Rectangle2D} the bounds as an instance of java.awt.geom.Rectangle2D

© Copyright 2024 Emmanuel PUYBARET / eTeks
Distributed under GNU General Public License
Documentation generated by JsDoc Toolkit 2.4.0 on Thu Apr 04 2024 17:30:25 GMT+0200 (CEST)