-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathTextMetrics.java
More file actions
44 lines (37 loc) · 1.75 KB
/
TextMetrics.java
File metadata and controls
44 lines (37 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package snap.webapi;
/**
* This class is a wrapper for Web API TextMetrics (https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics).
*/
public class TextMetrics extends JSProxy {
/**
* Constructor.
*/
public TextMetrics(Object textMetricsJS)
{
super(textMetricsJS);
}
/**
* Returns the width of a segment of inline text in CSS pixels.
*/
public int getWidth() { return getMemberInt("width"); }
/**
* Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute
* to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels.
*/
public double getFontBoundingBoxAscent() { return getMemberDouble("fontBoundingBoxAscent"); }
/**
* Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute
* to the top of the bounding rectangle used to render the text, in CSS pixels.
*/
public double getActualBoundingBoxAscent() { return getMemberDouble("actualBoundingBoxAscent"); }
/**
* Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute
* to the bottom of the bounding rectangle of all the fonts used to render the text, in CSS pixels.
*/
public double getFontBoundingBoxDescent() { return getMemberDouble("fontBoundingBoxDescent"); }
/**
* Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute
* to the bottom of the bounding rectangle used to render the text, in CSS pixels.
*/
public double getActualBoundingBoxDescent() { return getMemberDouble("actualBoundingBoxDescent"); }
}