| 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_C_DEV_PPB_FONT_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_FONT_DEV_H_ |
| 6 #define PPAPI_C_DEV_PPB_FONT_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_FONT_DEV_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_macros.h" | 10 #include "ppapi/c/pp_macros.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 uint32_t color, | 148 uint32_t color, |
| 149 const struct PP_Rect* clip, | 149 const struct PP_Rect* clip, |
| 150 PP_Bool image_data_is_opaque); | 150 PP_Bool image_data_is_opaque); |
| 151 | 151 |
| 152 // Returns the width of the given string. If the font is invalid or the var | 152 // Returns the width of the given string. If the font is invalid or the var |
| 153 // isn't a valid string, this will return -1. | 153 // isn't a valid string, this will return -1. |
| 154 // | 154 // |
| 155 // Note that this function handles complex scripts such as Arabic, combining | 155 // Note that this function handles complex scripts such as Arabic, combining |
| 156 // accents, etc. so that adding the width of substrings won't necessarily | 156 // accents, etc. so that adding the width of substrings won't necessarily |
| 157 // produce the correct width of the entire string. | 157 // produce the correct width of the entire string. |
| 158 // |
| 159 // Returns -1 on failure. |
| 158 int32_t (*MeasureText)(PP_Resource font, | 160 int32_t (*MeasureText)(PP_Resource font, |
| 159 const struct PP_TextRun_Dev* text); | 161 const struct PP_TextRun_Dev* text); |
| 160 | 162 |
| 161 // Returns the character at the given pixel X position from the beginning of | 163 // Returns the character at the given pixel X position from the beginning of |
| 162 // the string. This handles complex scripts such as Arabic, where characters | 164 // the string. This handles complex scripts such as Arabic, where characters |
| 163 // may be combined or replaced depending on the context. | 165 // may be combined or replaced depending on the context. Returns (uint32)-1 |
| 166 // on failure. |
| 164 uint32_t (*CharacterOffsetForPixel)(PP_Resource font, | 167 uint32_t (*CharacterOffsetForPixel)(PP_Resource font, |
| 165 const struct PP_TextRun_Dev* text, | 168 const struct PP_TextRun_Dev* text, |
| 166 int32_t pixel_position); | 169 int32_t pixel_position); |
| 167 | 170 |
| 168 // Returns the horizontal advance to the given character if the string was | 171 // Returns the horizontal advance to the given character if the string was |
| 169 // placed at the given position. This handles complex scripts such as Arabic, | 172 // placed at the given position. This handles complex scripts such as Arabic, |
| 170 // where characters may be combined or replaced depending on context. | 173 // where characters may be combined or replaced depending on context. Returns |
| 174 // -1 on error. |
| 171 int32_t (*PixelOffsetForCharacter)(PP_Resource font, | 175 int32_t (*PixelOffsetForCharacter)(PP_Resource font, |
| 172 const struct PP_TextRun_Dev* text, | 176 const struct PP_TextRun_Dev* text, |
| 173 uint32_t char_offset); | 177 uint32_t char_offset); |
| 174 }; | 178 }; |
| 175 | 179 |
| 176 #endif /* PPAPI_C_DEV_PPB_FONT_DEV_H_ */ | 180 #endif /* PPAPI_C_DEV_PPB_FONT_DEV_H_ */ |
| 177 | 181 |
| OLD | NEW |