mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
enhance: Implement CanvasRenderingContext2D.measureText
(#32704)
Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
d82232d549
commit
1223335547
14 changed files with 325 additions and 51 deletions
|
@ -58,6 +58,7 @@ pub enum Canvas2dMsg {
|
|||
IsPointInPath(f64, f64, FillRule, IpcSender<bool>),
|
||||
LineTo(Point2D<f32>),
|
||||
MoveTo(Point2D<f32>),
|
||||
MeasureText(String, IpcSender<TextMetrics>),
|
||||
PutImageData(Rect<u64>, IpcBytesReceiver),
|
||||
QuadraticCurveTo(Point2D<f32>, Point2D<f32>),
|
||||
Rect(Rect<f32>),
|
||||
|
@ -474,3 +475,19 @@ impl FromStr for Direction {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct TextMetrics {
|
||||
pub width: f32,
|
||||
pub actual_boundingbox_left: f32,
|
||||
pub actual_boundingbox_right: f32,
|
||||
pub actual_boundingbox_ascent: f32,
|
||||
pub actual_boundingbox_descent: f32,
|
||||
pub font_boundingbox_ascent: f32,
|
||||
pub font_boundingbox_descent: f32,
|
||||
pub em_height_ascent: f32,
|
||||
pub em_height_descent: f32,
|
||||
pub hanging_baseline: f32,
|
||||
pub alphabetic_baseline: f32,
|
||||
pub ideographic_baseline: f32,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue