Skip to content

Commit efe1b87

Browse files
authored
Merge pull request #827 from buntec/feature/complete-text-metrics
Feature/complete text metrics
2 parents 29724e9 + 96ae08e commit efe1b87

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

api-reports/2_12.txt

+11
Original file line numberDiff line numberDiff line change
@@ -26488,6 +26488,17 @@ TextEventInit[JT] var inputMethod: js.UndefOr[Int]
2648826488
TextEventInit[JT] var locale: js.UndefOr[String]
2648926489
TextEventInit[JT] var scoped: js.UndefOr[Boolean]
2649026490
TextEventInit[JT] var view: js.UndefOr[Window]
26491+
TextMetrics[JC] val actualBoundingBoxAscent: Double
26492+
TextMetrics[JC] val actualBoundingBoxDescent: Double
26493+
TextMetrics[JC] val actualBoundingBoxLeft: Double
26494+
TextMetrics[JC] val actualBoundingBoxRight: Double
26495+
TextMetrics[JC] val alphabeticBaseline: Double
26496+
TextMetrics[JC] val emHeightAscent: Double
26497+
TextMetrics[JC] val emHeightDescent: Double
26498+
TextMetrics[JC] val fontBoundingBoxAscent: Double
26499+
TextMetrics[JC] val fontBoundingBoxDescent: Double
26500+
TextMetrics[JC] val hangingBaseline: Double
26501+
TextMetrics[JC] val ideographicBaseline: Double
2649126502
TextMetrics[JC] var width: Double
2649226503
TextTrack[JO] var DISABLED: Int
2649326504
TextTrack[JO] var ERROR: Int

api-reports/2_13.txt

+11
Original file line numberDiff line numberDiff line change
@@ -26488,6 +26488,17 @@ TextEventInit[JT] var inputMethod: js.UndefOr[Int]
2648826488
TextEventInit[JT] var locale: js.UndefOr[String]
2648926489
TextEventInit[JT] var scoped: js.UndefOr[Boolean]
2649026490
TextEventInit[JT] var view: js.UndefOr[Window]
26491+
TextMetrics[JC] val actualBoundingBoxAscent: Double
26492+
TextMetrics[JC] val actualBoundingBoxDescent: Double
26493+
TextMetrics[JC] val actualBoundingBoxLeft: Double
26494+
TextMetrics[JC] val actualBoundingBoxRight: Double
26495+
TextMetrics[JC] val alphabeticBaseline: Double
26496+
TextMetrics[JC] val emHeightAscent: Double
26497+
TextMetrics[JC] val emHeightDescent: Double
26498+
TextMetrics[JC] val fontBoundingBoxAscent: Double
26499+
TextMetrics[JC] val fontBoundingBoxDescent: Double
26500+
TextMetrics[JC] val hangingBaseline: Double
26501+
TextMetrics[JC] val ideographicBaseline: Double
2649126502
TextMetrics[JC] var width: Double
2649226503
TextTrack[JO] var DISABLED: Int
2649326504
TextTrack[JO] var ERROR: Int

dom/src/main/scala/org/scalajs/dom/TextMetrics.scala

+58
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,62 @@ class TextMetrics extends js.Object {
2020
* current font of the context.
2121
*/
2222
var width: Double = js.native
23+
24+
/** Distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign
25+
* property to the left side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating
26+
* a distance going left from the given alignment point.
27+
*/
28+
val actualBoundingBoxLeft: Double = js.native
29+
30+
/** Returns the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the
31+
* right side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the
32+
* baseline.
33+
*/
34+
val actualBoundingBoxRight: Double = js.native
35+
36+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to
37+
* the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels.
38+
*/
39+
val fontBoundingBoxAscent: Double = js.native
40+
41+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to
42+
* the bottom of the bounding rectangle of all the fonts used to render the text, in CSS pixels.
43+
*/
44+
val fontBoundingBoxDescent: Double = js.native
45+
46+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to
47+
* the top of the bounding rectangle used to render the text, in CSS pixels.
48+
*/
49+
val actualBoundingBoxAscent: Double = js.native
50+
51+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to
52+
* the bottom of the bounding rectangle used to render the text, in CSS pixels.
53+
*/
54+
val actualBoundingBoxDescent: Double = js.native
55+
56+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
57+
* the top of the em square in the line box, in CSS pixels.
58+
*/
59+
val emHeightAscent: Double = js.native
60+
61+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
62+
* the bottom of the em square in the line box, in CSS pixels.
63+
*/
64+
val emHeightDescent: Double = js.native
65+
66+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
67+
* the hanging baseline of the line box, in CSS pixels.
68+
*/
69+
val hangingBaseline: Double = js.native
70+
71+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
72+
* the alphabetic baseline of the line box, in CSS pixels.
73+
*/
74+
val alphabeticBaseline: Double = js.native
75+
76+
/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
77+
* the ideographic baseline of the line box, in CSS pixels.
78+
*/
79+
val ideographicBaseline: Double = js.native
80+
2381
}

0 commit comments

Comments
 (0)