Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(704)

Unified Diff: ppapi/cpp/dev/truetype_font_dev.cc

Issue 13913006: Add Pepper TrueType font API call to enumerate fonts in a given family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/cpp/dev/truetype_font_dev.cc
diff --git a/ppapi/cpp/dev/truetype_font_dev.cc b/ppapi/cpp/dev/truetype_font_dev.cc
index 3de81fd4ca56ba302e42696f547a8bbd8e0572d0..b10348a0c730d2ca4d193250e8fb8c8867bedbdc 100644
--- a/ppapi/cpp/dev/truetype_font_dev.cc
+++ b/ppapi/cpp/dev/truetype_font_dev.cc
@@ -4,7 +4,6 @@
#include "ppapi/cpp/dev/truetype_font_dev.h"
-#include <stdio.h>
#include <string.h> // memcpy
#include "ppapi/c/dev/ppb_truetype_font_dev.h"
@@ -41,7 +40,7 @@ TrueTypeFontDesc_Dev::TrueTypeFontDesc_Dev(
PassRef,
const PP_TrueTypeFontDesc_Dev& pp_desc) {
desc_ = pp_desc;
- family_ = Var(PASS_REF, pp_desc.family);
+ set_family(Var(PASS_REF, pp_desc.family));
}
TrueTypeFontDesc_Dev::TrueTypeFontDesc_Dev(const TrueTypeFontDesc_Dev& other) {
@@ -61,12 +60,12 @@ TrueTypeFontDesc_Dev& TrueTypeFontDesc_Dev::operator=(
if (this == &other)
return *this;
- desc_ = other.desc_;
- // Be careful about the refcount of the string, the assignment above doesn't
- // copy a ref. The assignments below take a ref to the new name and copy the
- // PP_Var into the wrapped descriptor.
- family_ = other.family();
- desc_.family = family_.pp_var();
+ set_family(other.family());
+ set_generic_family(other.generic_family());
+ set_style(other.style());
+ set_weight(other.weight());
+ set_width(other.width());
+ set_charset(other.charset());
return *this;
}
@@ -104,6 +103,21 @@ int32_t TrueTypeFont_Dev::GetFontFamilies(
return cc.MayForce(PP_ERROR_NOINTERFACE);
}
+// static
+int32_t TrueTypeFont_Dev::GetFontsInFamily(
+ const InstanceHandle& instance,
+ const Var& family,
+ const CompletionCallbackWithOutput<std::vector<TrueTypeFontDesc_Dev> >& cc)
+ {
+ if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {
+ return get_interface<PPB_TrueTypeFont_Dev_0_1>()->GetFontsInFamily(
+ instance.pp_instance(),
+ family.pp_var(),
+ cc.output(), cc.pp_completion_callback());
+ }
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+}
+
int32_t TrueTypeFont_Dev::Describe(
const CompletionCallbackWithOutput<TrueTypeFontDesc_Dev>& cc) {
if (has_interface<PPB_TrueTypeFont_Dev_0_1>()) {

Powered by Google App Engine
This is Rietveld 408576698