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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 static const MapRanges widthRanges[] = { | 334 static const MapRanges widthRanges[] = { |
335 { SkTFixed<FC_WIDTH_ULTRACONDENSED>::value, SkTFixed<SkFS::kUltraCondens
ed_Width>::value }, | 335 { SkTFixed<FC_WIDTH_ULTRACONDENSED>::value, SkTFixed<SkFS::kUltraCondens
ed_Width>::value }, |
336 { SkTFixed<FC_WIDTH_EXTRACONDENSED>::value, SkTFixed<SkFS::kExtraCondens
ed_Width>::value }, | 336 { SkTFixed<FC_WIDTH_EXTRACONDENSED>::value, SkTFixed<SkFS::kExtraCondens
ed_Width>::value }, |
337 { SkTFixed<FC_WIDTH_CONDENSED>::value, SkTFixed<SkFS::kCondensed_Wi
dth>::value }, | 337 { SkTFixed<FC_WIDTH_CONDENSED>::value, SkTFixed<SkFS::kCondensed_Wi
dth>::value }, |
338 { SkTFixed<FC_WIDTH_SEMICONDENSED>::value, SkTFixed<SkFS::kSemiCondense
d_Width>::value }, | 338 { SkTFixed<FC_WIDTH_SEMICONDENSED>::value, SkTFixed<SkFS::kSemiCondense
d_Width>::value }, |
339 { SkTFixed<FC_WIDTH_NORMAL>::value, SkTFixed<SkFS::kNormal_Width
>::value }, | 339 { SkTFixed<FC_WIDTH_NORMAL>::value, SkTFixed<SkFS::kNormal_Width
>::value }, |
340 { SkTFixed<FC_WIDTH_SEMIEXPANDED>::value, SkTFixed<SkFS::kSemiExpanded
_Width>::value }, | 340 { SkTFixed<FC_WIDTH_SEMIEXPANDED>::value, SkTFixed<SkFS::kSemiExpanded
_Width>::value }, |
341 { SkTFixed<FC_WIDTH_EXPANDED>::value, SkTFixed<SkFS::kExpanded_Wid
th>::value }, | 341 { SkTFixed<FC_WIDTH_EXPANDED>::value, SkTFixed<SkFS::kExpanded_Wid
th>::value }, |
342 { SkTFixed<FC_WIDTH_EXTRAEXPANDED>::value, SkTFixed<SkFS::kExtraExpande
d_Width>::value }, | 342 { SkTFixed<FC_WIDTH_EXTRAEXPANDED>::value, SkTFixed<SkFS::kExtraExpande
d_Width>::value }, |
343 { SkTFixed<FC_WIDTH_ULTRAEXPANDED>::value, SkTFixed<SkFS::kUltaExpanded
_Width>::value }, | 343 { SkTFixed<FC_WIDTH_ULTRAEXPANDED>::value, SkTFixed<SkFS::kUltraExpande
d_Width>::value }, |
344 }; | 344 }; |
345 int width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL), | 345 int width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL), |
346 widthRanges, SK_ARRAY_COUNT(widthRanges)); | 346 widthRanges, SK_ARRAY_COUNT(widthRanges)); |
347 | 347 |
348 SkFS::Slant slant = SkFS::kUpright_Slant; | 348 SkFS::Slant slant = SkFS::kUpright_Slant; |
349 switch (get_int(pattern, FC_SLANT, FC_SLANT_ROMAN)) { | 349 switch (get_int(pattern, FC_SLANT, FC_SLANT_ROMAN)) { |
350 case FC_SLANT_ROMAN: slant = SkFS::kUpright_Slant; break; | 350 case FC_SLANT_ROMAN: slant = SkFS::kUpright_Slant; break; |
351 case FC_SLANT_ITALIC : slant = SkFS::kItalic_Slant ; break; | 351 case FC_SLANT_ITALIC : slant = SkFS::kItalic_Slant ; break; |
352 case FC_SLANT_OBLIQUE: slant = SkFS::kOblique_Slant; break; | 352 case FC_SLANT_OBLIQUE: slant = SkFS::kOblique_Slant; break; |
353 default: SkASSERT(false); break; | 353 default: SkASSERT(false); break; |
(...skipping 23 matching lines...) Expand all Loading... |
377 | 377 |
378 static const MapRanges widthRanges[] = { | 378 static const MapRanges widthRanges[] = { |
379 { SkTFixed<SkFS::kUltraCondensed_Width>::value, SkTFixed<FC_WIDTH_ULTRAC
ONDENSED>::value }, | 379 { SkTFixed<SkFS::kUltraCondensed_Width>::value, SkTFixed<FC_WIDTH_ULTRAC
ONDENSED>::value }, |
380 { SkTFixed<SkFS::kExtraCondensed_Width>::value, SkTFixed<FC_WIDTH_EXTRAC
ONDENSED>::value }, | 380 { SkTFixed<SkFS::kExtraCondensed_Width>::value, SkTFixed<FC_WIDTH_EXTRAC
ONDENSED>::value }, |
381 { SkTFixed<SkFS::kCondensed_Width>::value, SkTFixed<FC_WIDTH_CONDEN
SED>::value }, | 381 { SkTFixed<SkFS::kCondensed_Width>::value, SkTFixed<FC_WIDTH_CONDEN
SED>::value }, |
382 { SkTFixed<SkFS::kSemiCondensed_Width>::value, SkTFixed<FC_WIDTH_SEMICO
NDENSED>::value }, | 382 { SkTFixed<SkFS::kSemiCondensed_Width>::value, SkTFixed<FC_WIDTH_SEMICO
NDENSED>::value }, |
383 { SkTFixed<SkFS::kNormal_Width>::value, SkTFixed<FC_WIDTH_NORMAL
>::value }, | 383 { SkTFixed<SkFS::kNormal_Width>::value, SkTFixed<FC_WIDTH_NORMAL
>::value }, |
384 { SkTFixed<SkFS::kSemiExpanded_Width>::value, SkTFixed<FC_WIDTH_SEMIEX
PANDED>::value }, | 384 { SkTFixed<SkFS::kSemiExpanded_Width>::value, SkTFixed<FC_WIDTH_SEMIEX
PANDED>::value }, |
385 { SkTFixed<SkFS::kExpanded_Width>::value, SkTFixed<FC_WIDTH_EXPAND
ED>::value }, | 385 { SkTFixed<SkFS::kExpanded_Width>::value, SkTFixed<FC_WIDTH_EXPAND
ED>::value }, |
386 { SkTFixed<SkFS::kExtraExpanded_Width>::value, SkTFixed<FC_WIDTH_EXTRAE
XPANDED>::value }, | 386 { SkTFixed<SkFS::kExtraExpanded_Width>::value, SkTFixed<FC_WIDTH_EXTRAE
XPANDED>::value }, |
387 { SkTFixed<SkFS::kUltaExpanded_Width>::value, SkTFixed<FC_WIDTH_ULTRAE
XPANDED>::value }, | 387 { SkTFixed<SkFS::kUltraExpanded_Width>::value, SkTFixed<FC_WIDTH_ULTRAE
XPANDED>::value }, |
388 }; | 388 }; |
389 int width = map_ranges(style.width(), widthRanges, SK_ARRAY_COUNT(widthRange
s)); | 389 int width = map_ranges(style.width(), widthRanges, SK_ARRAY_COUNT(widthRange
s)); |
390 | 390 |
391 int slant = FC_SLANT_ROMAN; | 391 int slant = FC_SLANT_ROMAN; |
392 switch (style.slant()) { | 392 switch (style.slant()) { |
393 case SkFS::kUpright_Slant: slant = FC_SLANT_ROMAN ; break; | 393 case SkFS::kUpright_Slant: slant = FC_SLANT_ROMAN ; break; |
394 case SkFS::kItalic_Slant : slant = FC_SLANT_ITALIC ; break; | 394 case SkFS::kItalic_Slant : slant = FC_SLANT_ITALIC ; break; |
395 case SkFS::kOblique_Slant: slant = FC_SLANT_OBLIQUE; break; | 395 case SkFS::kOblique_Slant: slant = FC_SLANT_OBLIQUE; break; |
396 default: SkASSERT(false); break; | 396 default: SkASSERT(false); break; |
397 } | 397 } |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 return typeface.release(); | 933 return typeface.release(); |
934 } | 934 } |
935 | 935 |
936 return this->matchFamilyStyle(nullptr, style); | 936 return this->matchFamilyStyle(nullptr, style); |
937 } | 937 } |
938 }; | 938 }; |
939 | 939 |
940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { | 940 SK_API SkFontMgr* SkFontMgr_New_FontConfig(FcConfig* fc) { |
941 return new SkFontMgr_fontconfig(fc); | 941 return new SkFontMgr_fontconfig(fc); |
942 } | 942 } |
OLD | NEW |