| OLD | NEW |
| 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 #include "SkAdvancedTypefaceMetrics.h" | 9 #include "SkAdvancedTypefaceMetrics.h" |
| 10 #include "SkBase64.h" | 10 #include "SkBase64.h" |
| (...skipping 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2429 rec->fMaskFormat = SkMask::kA8_Format; | 2429 rec->fMaskFormat = SkMask::kA8_Format; |
| 2430 } | 2430 } |
| 2431 #endif | 2431 #endif |
| 2432 | 2432 |
| 2433 if (!fCanBeLCD && isLCD(*rec)) { | 2433 if (!fCanBeLCD && isLCD(*rec)) { |
| 2434 rec->fMaskFormat = SkMask::kA8_Format; | 2434 rec->fMaskFormat = SkMask::kA8_Format; |
| 2435 rec->fFlags &= ~SkScalerContext::kGenA8FromLCD_Flag; | 2435 rec->fFlags &= ~SkScalerContext::kGenA8FromLCD_Flag; |
| 2436 } | 2436 } |
| 2437 } | 2437 } |
| 2438 | 2438 |
| 2439 static SkTypeface* create_typeface(const SkTypeface* familyFace, | |
| 2440 const char familyName[], | |
| 2441 unsigned styleBits) { | |
| 2442 LOGFONT lf; | |
| 2443 if (NULL == familyFace && NULL == familyName) { | |
| 2444 lf = get_default_font(); | |
| 2445 } else if (familyFace) { | |
| 2446 LogFontTypeface* face = (LogFontTypeface*)familyFace; | |
| 2447 lf = face->fLogFont; | |
| 2448 } else { | |
| 2449 logfont_for_name(familyName, &lf); | |
| 2450 } | |
| 2451 setStyle(&lf, (SkTypeface::Style)styleBits); | |
| 2452 return SkCreateTypefaceFromLOGFONT(lf); | |
| 2453 } | |
| 2454 | |
| 2455 /////////////////////////////////////////////////////////////////////////////// | 2439 /////////////////////////////////////////////////////////////////////////////// |
| 2456 | 2440 |
| 2457 #include "SkFontMgr.h" | 2441 #include "SkFontMgr.h" |
| 2458 #include "SkDataTable.h" | 2442 #include "SkDataTable.h" |
| 2459 | 2443 |
| 2460 static bool valid_logfont_for_enum(const LOGFONT& lf) { | 2444 static bool valid_logfont_for_enum(const LOGFONT& lf) { |
| 2461 // TODO: Vector FON is unsupported and should not be listed. | 2445 // TODO: Vector FON is unsupported and should not be listed. |
| 2462 return | 2446 return |
| 2463 // Ignore implicit vertical variants. | 2447 // Ignore implicit vertical variants. |
| 2464 lf.lfFaceName[0] && lf.lfFaceName[0] != '@' | 2448 lf.lfFaceName[0] && lf.lfFaceName[0] != '@' |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2597 } | 2581 } |
| 2598 | 2582 |
| 2599 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) SK_OVE
RRIDE { | 2583 virtual SkTypeface* onCreateFromFile(const char path[], int ttcIndex) SK_OVE
RRIDE { |
| 2600 // could be in base impl | 2584 // could be in base impl |
| 2601 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); | 2585 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(path)); |
| 2602 return this->createFromStream(stream); | 2586 return this->createFromStream(stream); |
| 2603 } | 2587 } |
| 2604 | 2588 |
| 2605 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], | 2589 virtual SkTypeface* onLegacyCreateTypeface(const char familyName[], |
| 2606 unsigned styleBits) SK_OVERRIDE { | 2590 unsigned styleBits) SK_OVERRIDE { |
| 2607 return create_typeface(NULL, familyName, styleBits); | 2591 LOGFONT lf; |
| 2592 if (NULL == familyName) { |
| 2593 lf = get_default_font(); |
| 2594 } else { |
| 2595 logfont_for_name(familyName, &lf); |
| 2596 } |
| 2597 setStyle(&lf, (SkTypeface::Style)styleBits); |
| 2598 return SkCreateTypefaceFromLOGFONT(lf); |
| 2608 } | 2599 } |
| 2609 | 2600 |
| 2610 private: | 2601 private: |
| 2611 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2602 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
| 2612 }; | 2603 }; |
| 2613 | 2604 |
| 2614 /////////////////////////////////////////////////////////////////////////////// | 2605 /////////////////////////////////////////////////////////////////////////////// |
| 2615 | 2606 |
| 2616 SkFontMgr* SkFontMgr_New_GDI() { | 2607 SkFontMgr* SkFontMgr_New_GDI() { |
| 2617 return SkNEW(SkFontMgrGDI); | 2608 return SkNEW(SkFontMgrGDI); |
| 2618 } | 2609 } |
| OLD | NEW |