| Class zebkit.Font | <zebkit> |
This class represents a font and provides basic font metrics like height, ascent. Using the class developers can compute string width.
// plain font
var f = new zebkit.Font("Arial", 14);
// bold font
var f = new zebkit.Font("Arial", "bold", 14);
// defining font with CSS font name
var f = new zebkit.Font("100px Futura, Helvetica, sans-serif");
zebkit.Font (name, [style], [size])
Parameters:
| public | <Integer> | charsWidth (s, off, len) |
| public | <zebkit.Font> | resize (size) |
| public | <zebkit.Font> | restyle (style) |
| public | <Integer> | stringWidth (s) |
| public | <String> | toString ( ) |
|
public
<Integer>
charsWidth (s, off, len)
Calculate the specified substring width Parameters:
Returns:
<Integer>
a substring size in pixels |
|
public
<zebkit.Font>
resize (size)
Resize font and return new instance of font class with new size. Parameters:
Returns:
<zebkit.Font>
a font Example:
|
|
public
<zebkit.Font>
restyle (style)
Restyle font and return new instance of the font class Parameters:
Returns:
<zebkit.Font>
a font |
|
public
<Integer>
stringWidth (s)
Compute the given string width in pixels basing on the font metrics. Parameters:
Returns:
<Integer>
a string width |