aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-31 15:56:22 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-31 15:56:22 +0000
commit3b0a9fe5672e7339ec3e5e6d3986b15f57ae24e7 (patch)
tree3c1fd7d83830d76aa412f57a3d7cf39cb8d1e24a /src/ports
parent633c32b13b5d199d797be669d3dc7981d603a945 (diff)
Update filter tool to allow more flexible filtering
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkFontDescriptor.cpp79
-rw-r--r--src/ports/SkFontDescriptor.h46
2 files changed, 0 insertions, 125 deletions
diff --git a/src/ports/SkFontDescriptor.cpp b/src/ports/SkFontDescriptor.cpp
deleted file mode 100644
index 7679d92a14..0000000000
--- a/src/ports/SkFontDescriptor.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkFontDescriptor.h"
-#include "SkStream.h"
-
-enum {
- // these must match the sfnt 'name' enums
- kFontFamilyName = 0x01,
- kFullName = 0x04,
- kPostscriptName = 0x06,
-
- // These count backwards from 0xFF, so as not to collide with the SFNT
- // defines for names in its 'name' table.
- kFontFileName = 0xFE,
- kSentinel = 0xFF,
-};
-
-SkFontDescriptor::SkFontDescriptor(SkTypeface::Style style) {
- fStyle = style;
-}
-
-static void read_string(SkStream* stream, SkString* string) {
- const uint32_t length = stream->readPackedUInt();
- if (length > 0) {
- string->resize(length);
- stream->read(string->writable_str(), length);
- }
-}
-
-static void write_string(SkWStream* stream, const SkString& string,
- uint32_t id) {
- if (!string.isEmpty()) {
- stream->writePackedUInt(id);
- stream->writePackedUInt(string.size());
- stream->write(string.c_str(), string.size());
- }
-}
-
-SkFontDescriptor::SkFontDescriptor(SkStream* stream) {
- fStyle = (SkTypeface::Style)stream->readPackedUInt();
-
- for (;;) {
- switch (stream->readPackedUInt()) {
- case kFontFamilyName:
- read_string(stream, &fFamilyName);
- break;
- case kFullName:
- read_string(stream, &fFullName);
- break;
- case kPostscriptName:
- read_string(stream, &fPostscriptName);
- break;
- case kFontFileName:
- read_string(stream, &fFontFileName);
- break;
- case kSentinel:
- return;
- default:
- SkDEBUGFAIL("Unknown id used by a font descriptor");
- return;
- }
- }
-}
-
-void SkFontDescriptor::serialize(SkWStream* stream) {
- stream->writePackedUInt(fStyle);
-
- write_string(stream, fFamilyName, kFontFamilyName);
- write_string(stream, fFullName, kFullName);
- write_string(stream, fPostscriptName, kPostscriptName);
- write_string(stream, fFontFileName, kFontFileName);
-
- stream->writePackedUInt(kSentinel);
-}
diff --git a/src/ports/SkFontDescriptor.h b/src/ports/SkFontDescriptor.h
deleted file mode 100644
index 5febfd81a3..0000000000
--- a/src/ports/SkFontDescriptor.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkFontDescriptor_DEFINED
-#define SkFontDescriptor_DEFINED
-
-#include "SkString.h"
-#include "SkTypeface.h"
-
-class SkStream;
-class SkWStream;
-
-class SkFontDescriptor {
-public:
- SkFontDescriptor(SkTypeface::Style = SkTypeface::kNormal);
- SkFontDescriptor(SkStream*);
-
- void serialize(SkWStream*);
-
- SkTypeface::Style getStyle() { return fStyle; }
- void setStyle(SkTypeface::Style style) { fStyle = style; }
-
- const char* getFamilyName() { return fFamilyName.c_str(); }
- const char* getFullName() { return fFullName.c_str(); }
- const char* getPostscriptName() { return fPostscriptName.c_str(); }
- const char* getFontFileName() { return fFontFileName.c_str(); }
-
- void setFamilyName(const char* name) { fFamilyName.set(name); }
- void setFullName(const char* name) { fFullName.set(name); }
- void setPostscriptName(const char* name) { fPostscriptName.set(name); }
- void setFontFileName(const char* name) { fFontFileName.set(name); }
-
-private:
- SkString fFamilyName;
- SkString fFullName;
- SkString fPostscriptName;
- SkString fFontFileName;
-
- SkTypeface::Style fStyle;
-};
-
-#endif // SkFontDescriptor_DEFINED