| OLD | NEW |
| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // From [n] to +Inf | 294 // From [n] to +Inf |
| 295 // if (fcweight < Inf) | 295 // if (fcweight < Inf) |
| 296 return ranges[rangesCount-1].new_val; | 296 return ranges[rangesCount-1].new_val; |
| 297 } | 297 } |
| 298 | 298 |
| 299 static int map_ranges(int val, MapRanges const ranges[], int rangesCount) { | 299 static int map_ranges(int val, MapRanges const ranges[], int rangesCount) { |
| 300 return SkFixedRoundToInt(map_ranges_fixed(SkIntToFixed(val), ranges, rangesC
ount)); | 300 return SkFixedRoundToInt(map_ranges_fixed(SkIntToFixed(val), ranges, rangesC
ount)); |
| 301 } | 301 } |
| 302 | 302 |
| 303 template<int n> struct SkTFixed { | 303 template<int n> struct SkTFixed { |
| 304 SK_COMPILE_ASSERT(-32768 <= n && n <= 32767, SkTFixed_n_not_in_range); | 304 static_assert(-32768 <= n && n <= 32767, "SkTFixed_n_not_in_range"); |
| 305 static const SkFixed value = static_cast<SkFixed>(n << 16); | 305 static const SkFixed value = static_cast<SkFixed>(n << 16); |
| 306 }; | 306 }; |
| 307 | 307 |
| 308 static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) { | 308 static SkFontStyle skfontstyle_from_fcpattern(FcPattern* pattern) { |
| 309 typedef SkFontStyle SkFS; | 309 typedef SkFontStyle SkFS; |
| 310 | 310 |
| 311 static const MapRanges weightRanges[] = { | 311 static const MapRanges weightRanges[] = { |
| 312 { SkTFixed<FC_WEIGHT_THIN>::value, SkTFixed<SkFS::kThin_Weight>::v
alue }, | 312 { SkTFixed<FC_WEIGHT_THIN>::value, SkTFixed<SkFS::kThin_Weight>::v
alue }, |
| 313 { SkTFixed<FC_WEIGHT_EXTRALIGHT>::value, SkTFixed<SkFS::kExtraLight_Weig
ht>::value }, | 313 { SkTFixed<FC_WEIGHT_EXTRALIGHT>::value, SkTFixed<SkFS::kExtraLight_Weig
ht>::value }, |
| 314 { SkTFixed<FC_WEIGHT_LIGHT>::value, SkTFixed<SkFS::kLight_Weight>::
value }, | 314 { SkTFixed<FC_WEIGHT_LIGHT>::value, SkTFixed<SkFS::kLight_Weight>::
value }, |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 return typeface.detach(); | 873 return typeface.detach(); |
| 874 } | 874 } |
| 875 | 875 |
| 876 return this->matchFamilyStyle(NULL, style); | 876 return this->matchFamilyStyle(NULL, style); |
| 877 } | 877 } |
| 878 }; | 878 }; |
| 879 | 879 |
| 880 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { | 880 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { |
| 881 return new SkFontMgr_fontconfig(fc); | 881 return new SkFontMgr_fontconfig(fc); |
| 882 } | 882 } |
| OLD | NEW |