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 PPAPI_CPP_DEV_FONT_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_FONT_DEV_H_ |
6 #define PPAPI_CPP_DEV_FONT_DEV_H_ | 6 #define PPAPI_CPP_DEV_FONT_DEV_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/dev/ppb_font_dev.h" | 10 #include "ppapi/c/dev/ppb_font_dev.h" |
| 11 #include "ppapi/cpp/common.h" |
11 #include "ppapi/cpp/resource.h" | 12 #include "ppapi/cpp/resource.h" |
12 #include "ppapi/cpp/var.h" | 13 #include "ppapi/cpp/var.h" |
13 | 14 |
14 struct PP_FontDescription_Dev; | 15 struct PP_FontDescription_Dev; |
15 | 16 |
16 namespace pp { | 17 namespace pp { |
17 | 18 |
18 class Font_dev; | 19 class Font_dev; |
19 class ImageData; | 20 class ImageData; |
20 class Instance; | 21 class Instance; |
(...skipping 23 matching lines...) Expand all Loading... |
44 | 45 |
45 PP_FontFamily_Dev family() const { return pp_font_description_.family; } | 46 PP_FontFamily_Dev family() const { return pp_font_description_.family; } |
46 void set_family(PP_FontFamily_Dev f) { pp_font_description_.family = f; } | 47 void set_family(PP_FontFamily_Dev f) { pp_font_description_.family = f; } |
47 | 48 |
48 uint32_t size() const { return pp_font_description_.size; } | 49 uint32_t size() const { return pp_font_description_.size; } |
49 void set_size(uint32_t s) { pp_font_description_.size = s; } | 50 void set_size(uint32_t s) { pp_font_description_.size = s; } |
50 | 51 |
51 PP_FontWeight_Dev weight() const { return pp_font_description_.weight; } | 52 PP_FontWeight_Dev weight() const { return pp_font_description_.weight; } |
52 void set_weight(PP_FontWeight_Dev w) { pp_font_description_.weight = w; } | 53 void set_weight(PP_FontWeight_Dev w) { pp_font_description_.weight = w; } |
53 | 54 |
54 bool italic() const { return pp_font_description_.italic; } | 55 bool italic() const { return PPBoolToBool(pp_font_description_.italic); } |
55 void set_italic(bool i) { pp_font_description_.italic = i; } | 56 void set_italic(bool i) { pp_font_description_.italic = BoolToPPBool(i); } |
56 | 57 |
57 bool small_caps() const { return pp_font_description_.small_caps; } | 58 bool small_caps() const { |
58 void set_small_caps(bool s) { pp_font_description_.small_caps = s; } | 59 return PPBoolToBool(pp_font_description_.small_caps); |
| 60 } |
| 61 void set_small_caps(bool s) { |
| 62 pp_font_description_.small_caps = BoolToPPBool(s); |
| 63 } |
59 | 64 |
60 int letter_spacing() const { return pp_font_description_.letter_spacing; } | 65 int letter_spacing() const { return pp_font_description_.letter_spacing; } |
61 void set_letter_spacing(int s) { pp_font_description_.letter_spacing = s; } | 66 void set_letter_spacing(int s) { pp_font_description_.letter_spacing = s; } |
62 | 67 |
63 int word_spacing() const { return pp_font_description_.word_spacing; } | 68 int word_spacing() const { return pp_font_description_.word_spacing; } |
64 void set_word_spacing(int w) { pp_font_description_.word_spacing = w; } | 69 void set_word_spacing(int w) { pp_font_description_.word_spacing = w; } |
65 | 70 |
66 private: | 71 private: |
67 friend class Font_Dev; | 72 friend class Font_Dev; |
68 | 73 |
69 Var face_; // Manages memory for pp_font_description_.face | 74 Var face_; // Manages memory for pp_font_description_.face |
70 PP_FontDescription_Dev pp_font_description_; | 75 PP_FontDescription_Dev pp_font_description_; |
71 }; | 76 }; |
72 | 77 |
73 // TextRun_Dev -----------------------------------------------------------------
---- | 78 // TextRun_Dev ----------------------------------------------------------------- |
74 | 79 |
75 class TextRun_Dev { | 80 class TextRun_Dev { |
76 public: | 81 public: |
77 TextRun_Dev(); | 82 TextRun_Dev(); |
78 TextRun_Dev(const std::string& text, | 83 TextRun_Dev(const std::string& text, |
79 bool rtl = false, | 84 bool rtl = false, |
80 bool override_direction = false); | 85 bool override_direction = false); |
81 TextRun_Dev(const TextRun_Dev& other); | 86 TextRun_Dev(const TextRun_Dev& other); |
82 ~TextRun_Dev(); | 87 ~TextRun_Dev(); |
83 | 88 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 uint32_t color, | 135 uint32_t color, |
131 bool image_data_is_opaque = false) const; | 136 bool image_data_is_opaque = false) const; |
132 | 137 |
133 // Convenience function that assumes a left-to-right string. | 138 // Convenience function that assumes a left-to-right string. |
134 int32_t MeasureSimpleText(const std::string& text) const; | 139 int32_t MeasureSimpleText(const std::string& text) const; |
135 }; | 140 }; |
136 | 141 |
137 } // namespace pp | 142 } // namespace pp |
138 | 143 |
139 #endif // PPAPI_CPP_DEV_FONT_DEV_H_ | 144 #endif // PPAPI_CPP_DEV_FONT_DEV_H_ |
OLD | NEW |