Pepper_31_C_interfaces
Public Attributes | List of all members
PPB_Font_Dev_0_6 Struct Reference

#include <ppb_font_dev.h>

Collaboration diagram for PPB_Font_Dev_0_6:
Collaboration graph

Public Attributes

struct PP_Var(* GetFontFamilies )(PP_Instance instance)
 
PP_Resource(* Create )(PP_Instance instance, const struct PP_FontDescription_Dev *description)
 
PP_Bool(* IsFont )(PP_Resource resource)
 
PP_Bool(* Describe )(PP_Resource font, struct PP_FontDescription_Dev *description, struct PP_FontMetrics_Dev *metrics)
 
PP_Bool(* DrawTextAt )(PP_Resource font, PP_Resource image_data, const struct PP_TextRun_Dev *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_TextRun_Dev *text)
 
uint32_t(* CharacterOffsetForPixel )(PP_Resource font, const struct PP_TextRun_Dev *text, int32_t pixel_position)
 
int32_t(* PixelOffsetForCharacter )(PP_Resource font, const struct PP_TextRun_Dev *text, uint32_t char_offset)
 

Detailed Description

Definition at line 177 of file ppb_font_dev.h.

Member Data Documentation

uint32_t(* PPB_Font_Dev_0_6::CharacterOffsetForPixel)(PP_Resource font, const struct PP_TextRun_Dev *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.

Definition at line 258 of file ppb_font_dev.h.

PP_Resource(* PPB_Font_Dev_0_6::Create)(PP_Instance instance, const struct PP_FontDescription_Dev *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 193 of file ppb_font_dev.h.

PP_Bool(* PPB_Font_Dev_0_6::Describe)(PP_Resource font, struct PP_FontDescription_Dev *description, struct PP_FontMetrics_Dev *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 213 of file ppb_font_dev.h.

PP_Bool(* PPB_Font_Dev_0_6::DrawTextAt)(PP_Resource font, PP_Resource image_data, const struct PP_TextRun_Dev *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 234 of file ppb_font_dev.h.

struct PP_Var(* PPB_Font_Dev_0_6::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 188 of file ppb_font_dev.h.

PP_Bool(* PPB_Font_Dev_0_6::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 199 of file ppb_font_dev.h.

int32_t(* PPB_Font_Dev_0_6::MeasureText)(PP_Resource font, const struct PP_TextRun_Dev *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 251 of file ppb_font_dev.h.

int32_t(* PPB_Font_Dev_0_6::PixelOffsetForCharacter)(PP_Resource font, const struct PP_TextRun_Dev *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 267 of file ppb_font_dev.h.


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