| 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" | |
| 12 #include "webkit/glue/plugins/pepper_resource.h" | 8 #include "webkit/glue/plugins/pepper_resource.h" |
| 13 | 9 |
| 14 namespace WebKit { | 10 typedef struct _ppb_Font PPB_Font; |
| 15 class WebFont; | |
| 16 } | |
| 17 | 11 |
| 18 namespace pepper { | 12 namespace pepper { |
| 19 | 13 |
| 20 class PluginInstance; | 14 class PluginInstance; |
| 21 | 15 |
| 22 class Font : public Resource { | 16 class Font : public Resource { |
| 23 public: | 17 public: |
| 24 Font(PluginModule* module, const PP_FontDescription& desc); | 18 Font(PluginModule* module, int fd); |
| 25 virtual ~Font(); | 19 virtual ~Font(); |
| 26 | 20 |
| 27 // Returns a pointer to the interface implementing PPB_Font that is exposed to | 21 // Returns a pointer to the interface implementing PPB_Font that is exposed to |
| 28 // the plugin. | 22 // the plugin. |
| 29 static const PPB_Font* GetInterface(); | 23 static const PPB_Font* GetInterface(); |
| 30 | 24 |
| 31 // Resource overrides. | 25 // Resource overrides. |
| 32 Font* AsFont() { return this; } | 26 Font* AsFont() { return this; } |
| 33 | 27 |
| 34 // PPB_Font implementation. | 28 // PPB_Font implementation. |
| 35 bool Describe(PP_FontDescription* description, | 29 bool GetFontTable(uint32_t table, |
| 36 PP_FontMetrics* metrics); | 30 void* output, |
| 37 bool DrawTextAt(PP_Resource image_data, | 31 uint32_t* output_length); |
| 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); | |
| 48 | 32 |
| 49 private: | 33 private: |
| 50 scoped_ptr<WebKit::WebFont> font_; | 34 int fd_; |
| 51 }; | 35 }; |
| 52 | 36 |
| 53 } // namespace pepper | 37 } // namespace pepper |
| 54 | 38 |
| 55 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ | 39 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ |
| OLD | NEW |