diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-17 20:15:25 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-17 20:15:25 +0000 |
commit | 7a26d92ecbe0ec01d433a4bc97106b4743c15049 (patch) | |
tree | 8ec52949f54934b188ae3b345f9ecf212435839b /ppapi/examples | |
parent | 94394dc91c469fe2f851769784e4f2d81e0c9573 (diff) | |
download | chromium_src-7a26d92ecbe0ec01d433a4bc97106b4743c15049.zip chromium_src-7a26d92ecbe0ec01d433a4bc97106b4743c15049.tar.gz chromium_src-7a26d92ecbe0ec01d433a4bc97106b4743c15049.tar.bz2 |
Rename PPB_Font to PPB_BrowserFont_Trusted.
PPB_Font can never be exported to NaCl since it relies on in-process WebKit.
So I'm renaming this to BrowserFont_Trusted to imply that this is the way that
the browser would render fonts in the content area (if we export a font API to
NaCl in the future, it will likely be a simpler native font API).
The new API is binary compatible with the old font API, so I map PPB_Font to
PPB_BrowserFont_Trusted for now to avoid breaking Flash (which uses this). When
we update Flash and push it out, we can remove the mapping and PPB_Font.
This does a lot of cleanup of the font implementation. It had complexity from
the fact that it used to run on a different thread. I was able to remove a lot
of code.
Review URL: https://chromiumcodereview.appspot.com/9360045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122564 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/examples')
-rw-r--r-- | ppapi/examples/font/simple_font.cc | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/ppapi/examples/font/simple_font.cc b/ppapi/examples/font/simple_font.cc index 94b0ecc..b66c79e 100644 --- a/ppapi/examples/font/simple_font.cc +++ b/ppapi/examples/font/simple_font.cc @@ -5,13 +5,13 @@ #include <stdio.h> #include "ppapi/cpp/completion_callback.h" -#include "ppapi/cpp/dev/font_dev.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/rect.h" #include "ppapi/cpp/size.h" +#include "ppapi/cpp/trusted/browser_font_trusted.h" static void DummyCompletionCallback(void* /*user_data*/, int32_t /*result*/) { } @@ -31,50 +31,50 @@ class MyInstance : public pp::Instance { pp::Graphics2D graphics(this, last_size_, false); BindGraphics(graphics); - pp::FontDescription_Dev desc; - desc.set_family(PP_FONTFAMILY_SANSSERIF); + pp::BrowserFontDescription desc; + desc.set_family(PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF); desc.set_size(100); - pp::Font_Dev font(this, desc); + pp::BrowserFont_Trusted font(this, desc); // Draw some large, alpha blended text, including Arabic shaping. pp::Rect text_clip(position.size()); // Use entire bounds for clip. font.DrawTextAt(&image, - pp::TextRun_Dev("\xD9\x85\xD8\xB1\xD8\xAD\xD8\xA8\xD8\xA7\xE2\x80\x8E", - true, true), + pp::BrowserFontTextRun( + "\xD9\x85\xD8\xB1\xD8\xAD\xD8\xA8\xD8\xA7\xE2\x80\x8E", true, true), pp::Point(20, 100), 0x80008000, clip, false); // Draw the default font names and sizes. int y = 160; { - pp::FontDescription_Dev desc; - pp::Font_Dev default_font(this, desc); + pp::BrowserFontDescription desc; + pp::BrowserFont_Trusted default_font(this, desc); default_font.DrawSimpleText( &image, DescribeFont(default_font, "Default font"), pp::Point(10, y), 0xFF000000); y += 20; } { - pp::FontDescription_Dev desc; - desc.set_family(PP_FONTFAMILY_SERIF); - pp::Font_Dev serif_font(this, desc); + pp::BrowserFontDescription desc; + desc.set_family(PP_BROWSERFONT_TRUSTED_FAMILY_SERIF); + pp::BrowserFont_Trusted serif_font(this, desc); serif_font.DrawSimpleText( &image, DescribeFont(serif_font, "Serif font"), pp::Point(10, y), 0xFF000000); y += 20; } { - pp::FontDescription_Dev desc; - desc.set_family(PP_FONTFAMILY_SANSSERIF); - pp::Font_Dev sans_serif_font(this, desc); + pp::BrowserFontDescription desc; + desc.set_family(PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF); + pp::BrowserFont_Trusted sans_serif_font(this, desc); sans_serif_font.DrawSimpleText( &image, DescribeFont(sans_serif_font, "Sans serif font"), pp::Point(10, y), 0xFF000000); y += 20; } { - pp::FontDescription_Dev desc; - desc.set_family(PP_FONTFAMILY_MONOSPACE); - pp::Font_Dev monospace_font(this, desc); + pp::BrowserFontDescription desc; + desc.set_family(PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE); + pp::BrowserFont_Trusted monospace_font(this, desc); monospace_font.DrawSimpleText( &image, DescribeFont(monospace_font, "Monospace font"), pp::Point(10, y), 0xFF000000); @@ -87,9 +87,10 @@ class MyInstance : public pp::Instance { private: // Returns a string describing the given font, using the given title. - std::string DescribeFont(const pp::Font_Dev& font, const char* title) { - pp::FontDescription_Dev desc; - PP_FontMetrics_Dev metrics; + std::string DescribeFont(const pp::BrowserFont_Trusted& font, + const char* title) { + pp::BrowserFontDescription desc; + PP_BrowserFont_Trusted_Metrics metrics; font.Describe(&desc, &metrics); char buf[256]; |