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

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

Issue 2333423002: Simulated fonts aren't TrueType fonts. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Also FontConfig. Created 4 years, 3 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
« no previous file with comments | « no previous file | src/ports/SkTypeface_win_dw.cpp » ('j') | 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkAdvancedTypefaceMetrics.h"
8 #include "SkDataTable.h" 9 #include "SkDataTable.h"
9 #include "SkFixed.h" 10 #include "SkFixed.h"
10 #include "SkFontDescriptor.h" 11 #include "SkFontDescriptor.h"
11 #include "SkFontHost_FreeType_common.h" 12 #include "SkFontHost_FreeType_common.h"
12 #include "SkFontMgr.h" 13 #include "SkFontMgr.h"
13 #include "SkFontStyle.h" 14 #include "SkFontStyle.h"
14 #include "SkMath.h" 15 #include "SkMath.h"
15 #include "SkMutex.h" 16 #include "SkMutex.h"
16 #include "SkOSFile.h" 17 #include "SkOSFile.h"
17 #include "SkRefCnt.h" 18 #include "SkRefCnt.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 rec->fPost2x2[0][1] = sm.getSkewX(); 478 rec->fPost2x2[0][1] = sm.getSkewX();
478 rec->fPost2x2[1][0] = sm.getSkewY(); 479 rec->fPost2x2[1][0] = sm.getSkewY();
479 rec->fPost2x2[1][1] = sm.getScaleY(); 480 rec->fPost2x2[1][1] = sm.getScaleY();
480 } 481 }
481 if (get_bool(fPattern, FC_EMBOLDEN)) { 482 if (get_bool(fPattern, FC_EMBOLDEN)) {
482 rec->fFlags |= SkScalerContext::kEmbolden_Flag; 483 rec->fFlags |= SkScalerContext::kEmbolden_Flag;
483 } 484 }
484 this->INHERITED::onFilterRec(rec); 485 this->INHERITED::onFilterRec(rec);
485 } 486 }
486 487
488 SkAdvancedTypefaceMetrics* onGetAdvancedTypefaceMetrics(PerGlyphInfo perGlyp hInfo,
489 const uint32_t* glyp hIDs,
490 uint32_t glyphIDsCou nt) const override
491 {
492 SkAdvancedTypefaceMetrics* info =
493 this->INHERITED::onGetAdvancedTypefaceMetrics(perGlyphInfo, glyphIDs , glyphIDsCount);
494
495 // Simulated fonts shouldn't be considered to be of the type of their da ta.
496 if (get_matrix(fPattern, FC_MATRIX) || get_bool(fPattern, FC_EMBOLDEN)) {
497 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
498 }
499 return info;
500 }
501
487 virtual ~SkTypeface_fontconfig() { 502 virtual ~SkTypeface_fontconfig() {
488 // Hold the lock while unrefing the pattern. 503 // Hold the lock while unrefing the pattern.
489 FCLocker lock; 504 FCLocker lock;
490 fPattern.reset(); 505 fPattern.reset();
491 } 506 }
492 507
493 private: 508 private:
494 /** @param pattern takes ownership of the reference. */ 509 /** @param pattern takes ownership of the reference. */
495 SkTypeface_fontconfig(FcPattern* pattern) 510 SkTypeface_fontconfig(FcPattern* pattern)
496 : INHERITED(skfontstyle_from_fcpattern(pattern), 511 : INHERITED(skfontstyle_from_fcpattern(pattern),
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 return typeface.release(); 948 return typeface.release();
934 } 949 }
935 950
936 return this->matchFamilyStyle(nullptr, style); 951 return this->matchFamilyStyle(nullptr, style);
937 } 952 }
938 }; 953 };
939 954
940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { 955 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) {
941 return new SkFontMgr_fontconfig(fc); 956 return new SkFontMgr_fontconfig(fc);
942 } 957 }
OLDNEW
« no previous file with comments | « no previous file | src/ports/SkTypeface_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698