blob: 47df236a57d740381e45e67b9d877f66a07c3990 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::HTML {
class TextMetrics : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(TextMetrics, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<TextMetrics> create(JS::Realm&);
virtual ~TextMetrics() override;
double width() const { return m_width; }
double actual_bounding_box_left() const { return m_actual_bounding_box_left; }
double actual_bounding_box_right() const { return m_actual_bounding_box_right; }
double font_bounding_box_ascent() const { return m_font_bounding_box_ascent; }
double font_bounding_box_descent() const { return m_font_bounding_box_descent; }
double actual_bounding_box_ascent() const { return m_actual_bounding_box_ascent; }
double actual_bounding_box_descent() const { return m_actual_bounding_box_descent; }
double em_height_ascent() const { return m_em_height_ascent; }
double em_height_descent() const { return m_em_height_descent; }
double hanging_baseline() const { return m_hanging_baseline; }
double alphabetic_baseline() const { return m_alphabetic_baseline; }
double ideographic_baseline() const { return m_ideographic_baseline; }
void set_width(double width) { m_width = width; }
void set_actual_bounding_box_left(double left) { m_actual_bounding_box_left = left; }
void set_actual_bounding_box_right(double right) { m_actual_bounding_box_right = right; }
void set_font_bounding_box_ascent(double ascent) { m_font_bounding_box_ascent = ascent; }
void set_font_bounding_box_descent(double descent) { m_font_bounding_box_descent = descent; }
void set_actual_bounding_box_ascent(double ascent) { m_actual_bounding_box_ascent = ascent; }
void set_actual_bounding_box_descent(double descent) { m_actual_bounding_box_descent = descent; }
void set_em_height_ascent(double ascent) { m_em_height_ascent = ascent; }
void set_em_height_descent(double descent) { m_em_height_descent = descent; }
void set_hanging_baseline(double baseline) { m_hanging_baseline = baseline; }
void set_alphabetic_baseline(double baseline) { m_alphabetic_baseline = baseline; }
void set_ideographic_baseline(double baseline) { m_ideographic_baseline = baseline; }
private:
explicit TextMetrics(JS::Realm&);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
double m_width { 0 };
double m_actual_bounding_box_left { 0 };
double m_actual_bounding_box_right { 0 };
double m_font_bounding_box_ascent { 0 };
double m_font_bounding_box_descent { 0 };
double m_actual_bounding_box_ascent { 0 };
double m_actual_bounding_box_descent { 0 };
double m_em_height_ascent { 0 };
double m_em_height_descent { 0 };
double m_hanging_baseline { 0 };
double m_alphabetic_baseline { 0 };
double m_ideographic_baseline { 0 };
};
}
|