| Index: src/ports/SkFontMgr_custom.cpp
|
| diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
|
| index 496a54cd3831befc952e751706787bb88a0bd576..7f3ce6b03208ef6759dae895522aab7f726bd2ba 100644
|
| --- a/src/ports/SkFontMgr_custom.cpp
|
| +++ b/src/ports/SkFontMgr_custom.cpp
|
| @@ -63,7 +63,7 @@ public:
|
| SkTypeface_Empty() : INHERITED(SkFontStyle(), false, true, SkString(), 0) {}
|
|
|
| protected:
|
| - SkStreamAsset* onOpenStream(int*) const override { return NULL; }
|
| + SkStreamAsset* onOpenStream(int*) const override { return nullptr; }
|
|
|
| private:
|
| typedef SkTypeface_Custom INHERITED;
|
| @@ -156,7 +156,7 @@ public:
|
|
|
| SkTypeface* matchStyle(const SkFontStyle& pattern) override {
|
| if (0 == fStyles.count()) {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| SkTypeface_Custom* closest = fStyles[0];
|
| @@ -203,30 +203,30 @@ public:
|
| virtual ~SystemFontLoader() { }
|
| virtual void loadSystemFonts(const SkTypeface_FreeType::Scanner&, Families*) const = 0;
|
| };
|
| - explicit SkFontMgr_Custom(const SystemFontLoader& loader) : fDefaultFamily(NULL) {
|
| + explicit SkFontMgr_Custom(const SystemFontLoader& loader) : fDefaultFamily(nullptr) {
|
| loader.loadSystemFonts(fScanner, &fFamilies);
|
|
|
| // Try to pick a default font.
|
| static const char* defaultNames[] = {
|
| - "Arial", "Verdana", "Times New Roman", "Droid Sans", NULL
|
| + "Arial", "Verdana", "Times New Roman", "Droid Sans", nullptr
|
| };
|
| for (size_t i = 0; i < SK_ARRAY_COUNT(defaultNames); ++i) {
|
| SkFontStyleSet_Custom* set = this->onMatchFamily(defaultNames[i]);
|
| - if (NULL == set) {
|
| + if (nullptr == set) {
|
| continue;
|
| }
|
|
|
| SkTypeface* tf = set->matchStyle(SkFontStyle(SkFontStyle::kNormal_Weight,
|
| SkFontStyle::kNormal_Width,
|
| SkFontStyle::kUpright_Slant));
|
| - if (NULL == tf) {
|
| + if (nullptr == tf) {
|
| continue;
|
| }
|
|
|
| fDefaultFamily = set;
|
| break;
|
| }
|
| - if (NULL == fDefaultFamily) {
|
| + if (nullptr == fDefaultFamily) {
|
| fDefaultFamily = fFamilies[0];
|
| }
|
| }
|
| @@ -252,7 +252,7 @@ protected:
|
| return SkRef(fFamilies[i].get());
|
| }
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| SkTypeface* onMatchFamilyStyle(const char familyName[],
|
| @@ -266,7 +266,7 @@ protected:
|
| const char* bcp47[], int bcp47Count,
|
| SkUnichar character) const override
|
| {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| SkTypeface* onMatchFaceStyle(const SkTypeface* familyMember,
|
| @@ -279,7 +279,7 @@ protected:
|
| }
|
| }
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
|
| @@ -288,24 +288,24 @@ protected:
|
|
|
| SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) const override {
|
| SkAutoTDelete<SkStreamAsset> stream(bareStream);
|
| - if (NULL == stream || stream->getLength() <= 0) {
|
| - return NULL;
|
| + if (nullptr == stream || stream->getLength() <= 0) {
|
| + return nullptr;
|
| }
|
|
|
| bool isFixedPitch;
|
| SkFontStyle style;
|
| SkString name;
|
| - if (fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, NULL)) {
|
| + if (fScanner.scanFont(stream, ttcIndex, &name, &style, &isFixedPitch, nullptr)) {
|
| return new SkTypeface_Stream(style, isFixedPitch, false, name, stream.detach(),
|
| ttcIndex);
|
| } else {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| }
|
|
|
| SkTypeface* onCreateFromFile(const char path[], int ttcIndex) const override {
|
| SkAutoTDelete<SkStreamAsset> stream(SkStream::NewFromFile(path));
|
| - return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : NULL;
|
| + return stream.get() ? this->createFromStream(stream.detach(), ttcIndex) : nullptr;
|
| }
|
|
|
| SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
|
| @@ -317,13 +317,13 @@ protected:
|
| oldStyle & SkTypeface::kItalic
|
| ? SkFontStyle::kItalic_Slant
|
| : SkFontStyle::kUpright_Slant);
|
| - SkTypeface* tf = NULL;
|
| + SkTypeface* tf = nullptr;
|
|
|
| if (familyName) {
|
| tf = this->onMatchFamilyStyle(familyName, style);
|
| }
|
|
|
| - if (NULL == tf) {
|
| + if (nullptr == tf) {
|
| tf = fDefaultFamily->matchStyle(style);
|
| }
|
|
|
| @@ -366,7 +366,7 @@ private:
|
| return families[i].get();
|
| }
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| static void load_directory_fonts(const SkTypeface_FreeType::Scanner& scanner,
|
| @@ -394,7 +394,7 @@ private:
|
| bool isFixedPitch;
|
| SkString realname;
|
| SkFontStyle style = SkFontStyle(); // avoid uninitialized warning
|
| - if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, NULL)) {
|
| + if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, nullptr)) {
|
| SkDebugf("---- failed to open <%s> <%d> as a font\n",
|
| filename.c_str(), faceIndex);
|
| continue;
|
| @@ -405,7 +405,7 @@ private:
|
| realname, filename.c_str(), faceIndex);
|
|
|
| SkFontStyleSet_Custom* addTo = find_family(*families, realname.c_str());
|
| - if (NULL == addTo) {
|
| + if (nullptr == addTo) {
|
| addTo = new SkFontStyleSet_Custom(realname);
|
| families->push_back().reset(addTo);
|
| }
|
| @@ -463,7 +463,7 @@ private:
|
| return families[i].get();
|
| }
|
| }
|
| - return NULL;
|
| + return nullptr;
|
| }
|
|
|
| static void load_embedded_font(const SkTypeface_FreeType::Scanner& scanner,
|
| @@ -482,7 +482,7 @@ private:
|
| bool isFixedPitch;
|
| SkString realname;
|
| SkFontStyle style = SkFontStyle(); // avoid uninitialized warning
|
| - if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, NULL)) {
|
| + if (!scanner.scanFont(stream, faceIndex, &realname, &style, &isFixedPitch, nullptr)) {
|
| SkDebugf("---- failed to open <%d> <%d> as a font\n", index, faceIndex);
|
| return;
|
| }
|
| @@ -492,7 +492,7 @@ private:
|
| realname, stream.detach(), faceIndex);
|
|
|
| SkFontStyleSet_Custom* addTo = find_family(*families, realname.c_str());
|
| - if (NULL == addTo) {
|
| + if (nullptr == addTo) {
|
| addTo = new SkFontStyleSet_Custom(realname);
|
| families->push_back().reset(addTo);
|
| }
|
|
|