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

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

Issue 2147733002: Remove user specified typeface id. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove one last straggler. Created 4 years, 5 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 | « src/ports/SkFontMgr_custom.cpp ('k') | src/ports/SkTypeface_win_dw.h » ('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 "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkFixed.h" 9 #include "SkFixed.h"
10 #include "SkFontDescriptor.h" 10 #include "SkFontDescriptor.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 FcPatternAddInteger(pattern, FC_WEIGHT, weight); 399 FcPatternAddInteger(pattern, FC_WEIGHT, weight);
400 FcPatternAddInteger(pattern, FC_WIDTH , width); 400 FcPatternAddInteger(pattern, FC_WIDTH , width);
401 FcPatternAddInteger(pattern, FC_SLANT , slant); 401 FcPatternAddInteger(pattern, FC_SLANT , slant);
402 } 402 }
403 403
404 class SkTypeface_stream : public SkTypeface_FreeType { 404 class SkTypeface_stream : public SkTypeface_FreeType {
405 public: 405 public:
406 /** @param data takes ownership of the font data.*/ 406 /** @param data takes ownership of the font data.*/
407 SkTypeface_stream(SkFontData* data, const SkFontStyle& style, bool fixedWidt h) 407 SkTypeface_stream(SkFontData* data, const SkFontStyle& style, bool fixedWidt h)
408 : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) 408 : INHERITED(style, fixedWidth)
409 , fData(data) 409 , fData(data)
410 { }; 410 { };
411 411
412 void onGetFamilyName(SkString* familyName) const override { 412 void onGetFamilyName(SkString* familyName) const override {
413 familyName->reset(); 413 familyName->reset();
414 } 414 }
415 415
416 void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) const over ride { 416 void onGetFontDescriptor(SkFontDescriptor* desc, bool* serialize) const over ride {
417 *serialize = true; 417 *serialize = true;
418 } 418 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 virtual ~SkTypeface_fontconfig() { 486 virtual ~SkTypeface_fontconfig() {
487 // Hold the lock while unrefing the pattern. 487 // Hold the lock while unrefing the pattern.
488 FCLocker lock; 488 FCLocker lock;
489 fPattern.reset(); 489 fPattern.reset();
490 } 490 }
491 491
492 private: 492 private:
493 /** @param pattern takes ownership of the reference. */ 493 /** @param pattern takes ownership of the reference. */
494 SkTypeface_fontconfig(FcPattern* pattern) 494 SkTypeface_fontconfig(FcPattern* pattern)
495 : INHERITED(skfontstyle_from_fcpattern(pattern), 495 : INHERITED(skfontstyle_from_fcpattern(pattern),
496 SkTypefaceCache::NewFontID(),
497 FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIO NAL)) 496 FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIO NAL))
498 , fPattern(pattern) 497 , fPattern(pattern)
499 { }; 498 { };
500 499
501 typedef SkTypeface_FreeType INHERITED; 500 typedef SkTypeface_FreeType INHERITED;
502 }; 501 };
503 502
504 class SkFontMgr_fontconfig : public SkFontMgr { 503 class SkFontMgr_fontconfig : public SkFontMgr {
505 mutable SkAutoFcConfig fFC; 504 mutable SkAutoFcConfig fFC;
506 SkAutoTUnref<SkDataTable> fFamilyNames; 505 SkAutoTUnref<SkDataTable> fFamilyNames;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 return typeface.release(); 932 return typeface.release();
934 } 933 }
935 934
936 return this->matchFamilyStyle(nullptr, style); 935 return this->matchFamilyStyle(nullptr, style);
937 } 936 }
938 }; 937 };
939 938
940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { 939 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) {
941 return new SkFontMgr_fontconfig(fc); 940 return new SkFontMgr_fontconfig(fc);
942 } 941 }
OLDNEW
« no previous file with comments | « src/ports/SkFontMgr_custom.cpp ('k') | src/ports/SkTypeface_win_dw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698