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

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

Issue 21563002: stub support for SK_FONTHOST_USES_FONTMGR (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 462
463 void FamilyTypeface::onGetFontDescriptor(SkFontDescriptor* desc, 463 void FamilyTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
464 bool* isLocalStream) const { 464 bool* isLocalStream) const {
465 desc->setFamilyName(find_family_name(this)); 465 desc->setFamilyName(find_family_name(this));
466 desc->setFontFileName(this->getUniqueString()); 466 desc->setFontFileName(this->getUniqueString());
467 *isLocalStream = !this->isSysFont(); 467 *isLocalStream = !this->isSysFont();
468 } 468 }
469 469
470 /////////////////////////////////////////////////////////////////////////////// 470 ///////////////////////////////////////////////////////////////////////////////
471 471
472 #ifndef SK_FONTHOST_USES_FONTMGR
473
472 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, 474 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
473 const char familyName[], 475 const char familyName[],
474 SkTypeface::Style style) { 476 SkTypeface::Style style) {
475 load_system_fonts(); 477 load_system_fonts();
476 478
477 SkAutoMutexAcquire ac(gFamilyMutex); 479 SkAutoMutexAcquire ac(gFamilyMutex);
478 480
479 // clip to legal style bits 481 // clip to legal style bits
480 style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic); 482 style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
481 483
482 SkTypeface* tf = NULL; 484 SkTypeface* tf = NULL;
483 485
484 if (NULL != familyFace) { 486 if (NULL != familyFace) {
485 tf = find_typeface(familyFace, style); 487 tf = find_typeface(familyFace, style);
486 } else if (NULL != familyName) { 488 } else if (NULL != familyName) {
487 // SkDebugf("======= familyName <%s>\n", familyName); 489 // SkDebugf("======= familyName <%s>\n", familyName);
488 tf = find_typeface(familyName, style); 490 tf = find_typeface(familyName, style);
489 } 491 }
490 492
491 if (NULL == tf) { 493 if (NULL == tf) {
492 tf = find_best_face(gDefaultFamily, style); 494 tf = find_best_face(gDefaultFamily, style);
493 } 495 }
494 496
495 SkSafeRef(tf); 497 SkSafeRef(tf);
496 return tf; 498 return tf;
497 } 499 }
498 500
499 ///////////////////////////////////////////////////////////////////////////////
500
501 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) { 501 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
502 if (NULL == stream || stream->getLength() <= 0) { 502 if (NULL == stream || stream->getLength() <= 0) {
503 SkDELETE(stream); 503 SkDELETE(stream);
504 return NULL; 504 return NULL;
505 } 505 }
506 506
507 bool isFixedPitch; 507 bool isFixedPitch;
508 SkTypeface::Style style; 508 SkTypeface::Style style;
509 if (find_name_and_attributes(stream, NULL, &style, &isFixedPitch)) { 509 if (find_name_and_attributes(stream, NULL, &style, &isFixedPitch)) {
510 return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedPi tch)); 510 return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedPi tch));
511 } else { 511 } else {
512 return NULL; 512 return NULL;
513 } 513 }
514 } 514 }
515 515
516 SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) { 516 SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
517 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); 517 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path));
518 return stream.get() ? CreateTypefaceFromStream(stream) : NULL; 518 return stream.get() ? CreateTypefaceFromStream(stream) : NULL;
519 } 519 }
520 520
521 #endif
522
521 /////////////////////////////////////////////////////////////////////////////// 523 ///////////////////////////////////////////////////////////////////////////////
522 524
523 #include "SkFontMgr.h" 525 #include "SkFontMgr.h"
524 526
525 SkFontMgr* SkFontMgr::Factory() { 527 SkFontMgr* SkFontMgr::Factory() {
526 // todo 528 // todo
527 return NULL; 529 return NULL;
528 } 530 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698