Pepper_47_C_interfaces
Public Attributes | List of all members
PPB_BrowserFont_Trusted_1_0 Struct Reference

#include <ppb_browser_font_trusted.h>

Collaboration diagram for PPB_BrowserFont_Trusted_1_0:
Collaboration graph

Public Attributes

struct PP_Var(* GetFontFamilies )(PP_Instance instance)
 
PP_Resource(* Create )(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description *description)
 
PP_Bool(* IsFont )(PP_Resource resource)
 
PP_Bool(* Describe )(PP_Resource font, struct PP_BrowserFont_Trusted_Description *description, struct PP_BrowserFont_Trusted_Metrics *metrics)
 
PP_Bool(* DrawTextAt )(PP_Resource font, PP_Resource image_data, const struct PP_BrowserFont_Trusted_TextRun *text, const struct PP_Point *position, uint32_t color, const struct PP_Rect *clip, PP_Bool image_data_is_opaque)
 
int32_t(* MeasureText )(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun *text)
 
uint32_t(* CharacterOffsetForPixel )(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun *text, int32_t pixel_position)
 
int32_t(* PixelOffsetForCharacter )(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun *text, uint32_t char_offset)
 

Detailed Description

Provides an interface for native browser text rendering.

This API is "trusted" not for security reasons, but because it can not be implemented efficiently when running out-of-process in Browser Client. In this case, WebKit is in another process and every text call would require a synchronous IPC to the renderer. It is, however, available to native (non-NaCl) out-of-process PPAPI plugins since WebKit is available in the plugin process.

Definition at line 173 of file ppb_browser_font_trusted.h.

Member Data Documentation

uint32_t(* PPB_BrowserFont_Trusted_1_0::CharacterOffsetForPixel)(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun *text, int32_t pixel_position)

Returns the character at the given pixel X position from the beginning of the string. This handles complex scripts such as Arabic, where characters may be combined or replaced depending on the context. Returns (uint32)-1 on failure.

TODO(brettw) this function may be broken. See the CharPosRTL test. It seems to tell you "insertion point" rather than painting position. This is useful but maybe not what we intended here.

Definition at line 260 of file ppb_browser_font_trusted.h.

PP_Resource(* PPB_BrowserFont_Trusted_1_0::Create)(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description *description)

Returns a font which best matches the given description. The return value will have a non-zero ID on success, or zero on failure.

Definition at line 189 of file ppb_browser_font_trusted.h.

PP_Bool(* PPB_BrowserFont_Trusted_1_0::Describe)(PP_Resource font, struct PP_BrowserFont_Trusted_Description *description, struct PP_BrowserFont_Trusted_Metrics *metrics)

Loads the description and metrics of the font into the given structures. The description will be different than the description the font was created with since it will be filled with the real values from the font that was actually selected.

The PP_Var in the description should be of type Void on input. On output, this will contain the string and will have a reference count of 1. The plugin is responsible for calling Release on this var.

Returns PP_TRUE on success, PP_FALSE if the font is invalid or if the Var in the description isn't Null (to prevent leaks).

Definition at line 210 of file ppb_browser_font_trusted.h.

PP_Bool(* PPB_BrowserFont_Trusted_1_0::DrawTextAt)(PP_Resource font, PP_Resource image_data, const struct PP_BrowserFont_Trusted_TextRun *text, const struct PP_Point *position, uint32_t color, const struct PP_Rect *clip, PP_Bool image_data_is_opaque)

Draws the text to the image buffer.

The given point represents the baseline of the left edge of the font, regardless of whether it is left-to-right or right-to-left (in the case of RTL text, this will actually represent the logical end of the text).

The clip is optional and may be NULL. In this case, the text will be clipped to the image.

The image_data_is_opaque flag indicates whether subpixel antialiasing can be performed, if it is supported. When the image below the text is opaque, subpixel antialiasing is supported and you should set this to PP_TRUE to pick up the user's default preferences. If your plugin is partially transparent, then subpixel antialiasing is not possible and grayscale antialiasing will be used instead (assuming the user has antialiasing enabled at all).

Definition at line 231 of file ppb_browser_font_trusted.h.

struct PP_Var(* PPB_BrowserFont_Trusted_1_0::GetFontFamilies)(PP_Instance instance)

Returns a list of all available font families on the system. You can use this list to decide whether to Create() a font.

The return value will be a single string with null characters delimiting the end of each font name. For example: "Arial\0Courier\0Times\0".

Returns an undefined var on failure (this typically means you passed an invalid instance).

Definition at line 184 of file ppb_browser_font_trusted.h.

PP_Bool(* PPB_BrowserFont_Trusted_1_0::IsFont)(PP_Resource resource)

Returns PP_TRUE if the given resource is a Font. Returns PP_FALSE if the resource is invalid or some type other than a Font.

Definition at line 196 of file ppb_browser_font_trusted.h.

int32_t(* PPB_BrowserFont_Trusted_1_0::MeasureText)(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun *text)

Returns the width of the given string. If the font is invalid or the var isn't a valid string, this will return -1.

Note that this function handles complex scripts such as Arabic, combining accents, etc. so that adding the width of substrings won't necessarily produce the correct width of the entire string.

Returns -1 on failure.

Definition at line 248 of file ppb_browser_font_trusted.h.

int32_t(* PPB_BrowserFont_Trusted_1_0::PixelOffsetForCharacter)(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun *text, uint32_t char_offset)

Returns the horizontal advance to the given character if the string was placed at the given position. This handles complex scripts such as Arabic, where characters may be combined or replaced depending on context. Returns -1 on error.

Definition at line 270 of file ppb_browser_font_trusted.h.


The documentation for this struct was generated from the following file: