OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/scoped_ptr.h" |
| 11 #include "third_party/ppapi/c/ppb_font.h" |
8 #include "webkit/glue/plugins/pepper_resource.h" | 12 #include "webkit/glue/plugins/pepper_resource.h" |
9 | 13 |
10 typedef struct _ppb_Font PPB_Font; | 14 namespace WebKit { |
| 15 class WebFont; |
| 16 } |
11 | 17 |
12 namespace pepper { | 18 namespace pepper { |
13 | 19 |
14 class PluginInstance; | 20 class PluginInstance; |
15 | 21 |
16 class Font : public Resource { | 22 class Font : public Resource { |
17 public: | 23 public: |
18 Font(PluginModule* module, int fd); | 24 Font(PluginModule* module, const PP_FontDescription& desc); |
19 virtual ~Font(); | 25 virtual ~Font(); |
20 | 26 |
21 // Returns a pointer to the interface implementing PPB_Font that is exposed to | 27 // Returns a pointer to the interface implementing PPB_Font that is exposed to |
22 // the plugin. | 28 // the plugin. |
23 static const PPB_Font* GetInterface(); | 29 static const PPB_Font* GetInterface(); |
24 | 30 |
25 // Resource overrides. | 31 // Resource overrides. |
26 Font* AsFont() { return this; } | 32 Font* AsFont() { return this; } |
27 | 33 |
28 // PPB_Font implementation. | 34 // PPB_Font implementation. |
29 bool GetFontTable(uint32_t table, | 35 bool Describe(PP_FontDescription* description, |
30 void* output, | 36 PP_FontMetrics* metrics); |
31 uint32_t* output_length); | 37 bool DrawTextAt(PP_Resource image_data, |
| 38 const PP_TextRun* text, |
| 39 const PP_Point* position, |
| 40 uint32_t color, |
| 41 const PP_Rect* clip, |
| 42 bool image_data_is_opaque); |
| 43 int32_t MeasureText(const PP_TextRun* text); |
| 44 uint32_t CharacterOffsetForPixel(const PP_TextRun* text, |
| 45 int32_t pixel_position); |
| 46 int32_t PixelOffsetForCharacter(const PP_TextRun* text, |
| 47 uint32_t char_offset); |
32 | 48 |
33 private: | 49 private: |
34 int fd_; | 50 scoped_ptr<WebKit::WebFont> font_; |
35 }; | 51 }; |
36 | 52 |
37 } // namespace pepper | 53 } // namespace pepper |
38 | 54 |
39 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ | 55 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ |
OLD | NEW |