diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 22:25:54 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 22:25:54 +0000 |
commit | adb072f92d93e5adf28a77fb4f6c15effca7b001 (patch) | |
tree | 11043d294f773825ecd59aa8f8ede9df549f1e30 /third_party | |
parent | d4d1b878fde9f01c21a8e247288d56df1e5382c6 (diff) | |
download | chromium_src-adb072f92d93e5adf28a77fb4f6c15effca7b001.zip chromium_src-adb072f92d93e5adf28a77fb4f6c15effca7b001.tar.gz chromium_src-adb072f92d93e5adf28a77fb4f6c15effca7b001.tar.bz2 |
Add a font API to Pepper and implement on Linux based on agl's code from http://codereview.chromium.org/2673003.
Review URL: http://codereview.chromium.org/2794004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/npapi/bindings/npapi_extensions.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h index c1c2f01..82a7c59 100644 --- a/third_party/npapi/bindings/npapi_extensions.h +++ b/third_party/npapi/bindings/npapi_extensions.h @@ -630,6 +630,83 @@ typedef NPError (*NPSetCursorPtr)( NPP instance, NPCursorType type); +/* unique id for each font */ +typedef int NPFontID; + +typedef enum { + NPCharsetAnsi = 0, + NPCharsetDefault = 1, + NPCharsetSymbol = 2, + NPCharsetMac = 77, + NPCharsetShiftJIS = 128, + NPCharsetHangul = 129, + NPCharsetJohab = 130, + NPCharsetGB2312 =134, + NPCharsetChineseBIG5 = 136, + NPCharsetGreek = 161, + NPCharsetTurkish = 162, + NPCharsetVietnamese = 163, + NPCharsetHebrew = 177, + NPCharsetArabic = 178, + NPCharsetBaltic = 186, + NPCharsetRussian = 204, + NPCharsetThai = 222, + NPCharsetEastEurope = 238, + NPCharsetOEM = 255 +} NPCharset; + +typedef enum { + NPPitchDefault, + NPPitchFixed +} NPPitch; + +typedef enum { + NPFamilyDefault, + NPFamilyRoman, + NPFamilyScript +} NPFamily; + +typedef struct _NPFontDescription { + const char* face; + int weight; + bool italic; + NPPitch pitch; + NPFamily family; + NPCharset charset; +} NPFontDescription; + +// Return a font which best matches the given properties. +typedef NPError (*NPMatchFontWithFallbackPtr) ( + NPP instance, + const NPFontDescription* description, + NPFontID* id); + +// Loads a specified font table for the given font. +// table: the table in *big-endian* format, or 0 for the whole font file. +// output: a buffer of size output_length that gets the data. can be 0, in +// which case output_length will be set to the required size in bytes. +// output_length: size of output, if it's not 0. +typedef NPError (*GetFontTablePtr) ( + NPP instance, + NPFontID id, + uint32_t table, + void* output, + size_t* output_length); + +// Destroys a font. +typedef NPError (*NPDestroyFontPtr) ( + NPP instance, + NPFontID id); + +typedef struct _NPFontExtensions { + NPMatchFontWithFallbackPtr matchFontWithFallback; + GetFontTablePtr getFontTable; + NPDestroyFontPtr destroyFont; +} NPFontExtensions; + +typedef NPFontExtensions* (*NPGetFontExtensionsPtr)( + NPP instance); + /* Pepper extensions */ struct NPNExtensions { /* Device interface acquisition */ @@ -645,6 +722,8 @@ struct NPNExtensions { NPGetWidgetExtensionsPtr getWidgetExtensions; /* Cursor */ NPSetCursorPtr setCursor; + /* Font */ + NPGetFontExtensionsPtr getFontExtensions; }; /* 3D -----------------------------------------------------------------------*/ |