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

Side by Side Diff: src/ports/SkFontHost_simple.cpp

Issue 12807004: move impl of AdvancedTypefaceMetrics into typeface (3) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 The Android Open Source Project 3 * Copyright 2011 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkFontHost.h" 10 #include "SkFontHost.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 detach_and_delete_family(family); 253 detach_and_delete_family(family);
254 } 254 }
255 } 255 }
256 256
257 bool isSysFont() const { return fIsSysFont; } 257 bool isSysFont() const { return fIsSysFont; }
258 258
259 virtual SkStream* openStream() = 0; 259 virtual SkStream* openStream() = 0;
260 virtual const char* getUniqueString() const = 0; 260 virtual const char* getUniqueString() const = 0;
261 virtual const char* getFilePath() const = 0; 261 virtual const char* getFilePath() const = 0;
262 262
263 protected:
264 virtual SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(
265 SkAdvancedTypefaceMetrics::PerGlyphInfo,
266 const uint32_t*,
267 uint32_t) const SK_OVERRIDE {
268 return NULL;
269 }
270
263 private: 271 private:
264 bool fIsSysFont; 272 bool fIsSysFont;
265 273
266 typedef SkTypeface INHERITED; 274 typedef SkTypeface INHERITED;
267 }; 275 };
268 276
269 /////////////////////////////////////////////////////////////////////////////// 277 ///////////////////////////////////////////////////////////////////////////////
270 278
271 class StreamTypeface : public FamilyTypeface { 279 class StreamTypeface : public FamilyTypeface {
272 public: 280 public:
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID); 553 FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
546 SkStream* stream = tf ? tf->openStream() : NULL; 554 SkStream* stream = tf ? tf->openStream() : NULL;
547 555
548 if (stream && stream->getLength() == 0) { 556 if (stream && stream->getLength() == 0) {
549 stream->unref(); 557 stream->unref();
550 stream = NULL; 558 stream = NULL;
551 } 559 }
552 return stream; 560 return stream;
553 } 561 }
554 562
555 #if 0
556 SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
557 uint32_t fontID,
558 SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo,
559 const uint32_t* glyphIDs,
560 uint32_t glyphIDsCount) {
561 SkDEBUGFAIL("SkFontHost::GetAdvancedTypefaceMetrics unimplemented");
562 return NULL;
563 }
564 #endif
565
566 size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length, 563 size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length,
567 int32_t* index) { 564 int32_t* index) {
568 SkAutoMutexAcquire ac(gFamilyMutex); 565 SkAutoMutexAcquire ac(gFamilyMutex);
569 566
570 FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID); 567 FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
571 const char* src = tf ? tf->getFilePath() : NULL; 568 const char* src = tf ? tf->getFilePath() : NULL;
572 569
573 if (src) { 570 if (src) {
574 size_t size = strlen(src); 571 size_t size = strlen(src);
575 if (path) { 572 if (path) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream)); 610 return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream));
614 } else { 611 } else {
615 return NULL; 612 return NULL;
616 } 613 }
617 } 614 }
618 615
619 SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) { 616 SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
620 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); 617 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
621 return stream.get() ? SkFontHost::CreateTypefaceFromStream(stream) : NULL; 618 return stream.get() ? SkFontHost::CreateTypefaceFromStream(stream) : NULL;
622 } 619 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698