Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/complete text metrics #827

Merged
merged 2 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26488,6 +26488,17 @@ TextEventInit[JT] var inputMethod: js.UndefOr[Int]
TextEventInit[JT] var locale: js.UndefOr[String]
TextEventInit[JT] var scoped: js.UndefOr[Boolean]
TextEventInit[JT] var view: js.UndefOr[Window]
TextMetrics[JC] val actualBoundingBoxAscent: Double
TextMetrics[JC] val actualBoundingBoxDescent: Double
TextMetrics[JC] val actualBoundingBoxLeft: Double
TextMetrics[JC] val actualBoundingBoxRight: Double
TextMetrics[JC] val alphabeticBaseline: Double
TextMetrics[JC] val emHeightAscent: Double
TextMetrics[JC] val emHeightDescent: Double
TextMetrics[JC] val fontBoundingBoxAscent: Double
TextMetrics[JC] val fontBoundingBoxDescent: Double
TextMetrics[JC] val hangingBaseline: Double
TextMetrics[JC] val ideographicBaseline: Double
TextMetrics[JC] var width: Double
TextTrack[JO] var DISABLED: Int
TextTrack[JO] var ERROR: Int
Expand Down
11 changes: 11 additions & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26488,6 +26488,17 @@ TextEventInit[JT] var inputMethod: js.UndefOr[Int]
TextEventInit[JT] var locale: js.UndefOr[String]
TextEventInit[JT] var scoped: js.UndefOr[Boolean]
TextEventInit[JT] var view: js.UndefOr[Window]
TextMetrics[JC] val actualBoundingBoxAscent: Double
TextMetrics[JC] val actualBoundingBoxDescent: Double
TextMetrics[JC] val actualBoundingBoxLeft: Double
TextMetrics[JC] val actualBoundingBoxRight: Double
TextMetrics[JC] val alphabeticBaseline: Double
TextMetrics[JC] val emHeightAscent: Double
TextMetrics[JC] val emHeightDescent: Double
TextMetrics[JC] val fontBoundingBoxAscent: Double
TextMetrics[JC] val fontBoundingBoxDescent: Double
TextMetrics[JC] val hangingBaseline: Double
TextMetrics[JC] val ideographicBaseline: Double
TextMetrics[JC] var width: Double
TextTrack[JO] var DISABLED: Int
TextTrack[JO] var ERROR: Int
Expand Down
58 changes: 58 additions & 0 deletions dom/src/main/scala/org/scalajs/dom/TextMetrics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,62 @@ class TextMetrics extends js.Object {
* current font of the context.
*/
var width: Double = js.native

/** Distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign
* property to the left side of the bounding rectangle of the given text, in CSS pixels; positive numbers indicating
* a distance going left from the given alignment point.
*/
val actualBoundingBoxLeft: Double = js.native

/** Returns the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the
* right side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the
* baseline.
*/
val actualBoundingBoxRight: Double = js.native

/** 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.
*/
val fontBoundingBoxAscent: Double = js.native

/** 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.
*/
val fontBoundingBoxDescent: Double = js.native

/** 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.
*/
val actualBoundingBoxAscent: Double = js.native

/** 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.
*/
val actualBoundingBoxDescent: Double = js.native

/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
* the top of the em square in the line box, in CSS pixels.
*/
val emHeightAscent: Double = js.native

/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
* the bottom of the em square in the line box, in CSS pixels.
*/
val emHeightDescent: Double = js.native

/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
* the hanging baseline of the line box, in CSS pixels.
*/
val hangingBaseline: Double = js.native

/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
* the alphabetic baseline of the line box, in CSS pixels.
*/
val alphabeticBaseline: Double = js.native

/** Returns the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to
* the ideographic baseline of the line box, in CSS pixels.
*/
val ideographicBaseline: Double = js.native

}
Loading