OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebFont_h | 5 #ifndef WebFont_h |
6 #define WebFont_h | 6 #define WebFont_h |
7 | 7 |
8 #include "WebCanvas.h" | 8 #include "WebCanvas.h" |
9 #include "WebColor.h" | 9 #include "WebColor.h" |
10 #include "WebCommon.h" | 10 #include "WebCommon.h" |
11 #include "WebPrivateOwnPtr.h" | 11 #include "WebPrivateOwnPtr.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 struct WebFloatPoint; | 15 struct WebFloatPoint; |
16 struct WebFloatRect; | 16 struct WebFloatRect; |
17 struct WebFontDescription; | 17 struct WebFontDescription; |
18 struct WebRect; | 18 struct WebRect; |
19 struct WebTextRun; | 19 struct WebTextRun; |
20 | 20 |
21 class WebFont { | 21 class WebFont { |
22 public: | 22 public: |
23 BLINK_PLATFORM_EXPORT static WebFont* create(const WebFontDescription&); | 23 BLINK_PLATFORM_EXPORT static WebFont* create(const WebFontDescription&); |
24 BLINK_PLATFORM_EXPORT ~WebFont(); | 24 BLINK_PLATFORM_EXPORT ~WebFont(); |
25 | 25 |
26 BLINK_PLATFORM_EXPORT WebFontDescription fontDescription() const; | 26 BLINK_PLATFORM_EXPORT WebFontDescription getFontDescription() const; |
27 BLINK_PLATFORM_EXPORT int ascent() const; | 27 BLINK_PLATFORM_EXPORT int ascent() const; |
28 BLINK_PLATFORM_EXPORT int descent() const; | 28 BLINK_PLATFORM_EXPORT int descent() const; |
29 BLINK_PLATFORM_EXPORT int height() const; | 29 BLINK_PLATFORM_EXPORT int height() const; |
30 BLINK_PLATFORM_EXPORT int lineSpacing() const; | 30 BLINK_PLATFORM_EXPORT int lineSpacing() const; |
31 BLINK_PLATFORM_EXPORT float xHeight() const; | 31 BLINK_PLATFORM_EXPORT float xHeight() const; |
32 BLINK_PLATFORM_EXPORT void drawText(WebCanvas*, const WebTextRun&, | 32 BLINK_PLATFORM_EXPORT void drawText(WebCanvas*, const WebTextRun&, |
33 const WebFloatPoint& leftBaseline, WebColor, const WebRect& clip) const; | 33 const WebFloatPoint& leftBaseline, WebColor, const WebRect& clip) const; |
34 BLINK_PLATFORM_EXPORT int calculateWidth(const WebTextRun&) const; | 34 BLINK_PLATFORM_EXPORT int calculateWidth(const WebTextRun&) const; |
35 BLINK_PLATFORM_EXPORT int offsetForPosition(const WebTextRun&, | 35 BLINK_PLATFORM_EXPORT int offsetForPosition(const WebTextRun&, |
36 float position) const; | 36 float position) const; |
37 BLINK_PLATFORM_EXPORT WebFloatRect selectionRectForText( | 37 BLINK_PLATFORM_EXPORT WebFloatRect selectionRectForText( |
38 const WebTextRun&, | 38 const WebTextRun&, |
39 const WebFloatPoint& leftBaseline, | 39 const WebFloatPoint& leftBaseline, |
40 int height, | 40 int height, |
41 int from = 0, | 41 int from = 0, |
42 int to = -1) const; | 42 int to = -1) const; |
43 | 43 |
44 private: | 44 private: |
45 explicit WebFont(const WebFontDescription&); | 45 explicit WebFont(const WebFontDescription&); |
46 | 46 |
47 class Impl; | 47 class Impl; |
48 WebPrivateOwnPtr<Impl> m_private; | 48 WebPrivateOwnPtr<Impl> m_private; |
49 }; | 49 }; |
50 | 50 |
51 } // namespace blink | 51 } // namespace blink |
52 | 52 |
53 #endif | 53 #endif |
OLD | NEW |