OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009-2015 Google Inc. | 2 * Copyright 2009-2015 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 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ | 8 /* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ |
9 | 9 |
10 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 static const MapRanges widthRanges[] = { | 426 static const MapRanges widthRanges[] = { |
427 { SkTFixed<FC_WIDTH_ULTRACONDENSED>::value, SkTFixed<SkFS::kUltraCondens
ed_Width>::value }, | 427 { SkTFixed<FC_WIDTH_ULTRACONDENSED>::value, SkTFixed<SkFS::kUltraCondens
ed_Width>::value }, |
428 { SkTFixed<FC_WIDTH_EXTRACONDENSED>::value, SkTFixed<SkFS::kExtraCondens
ed_Width>::value }, | 428 { SkTFixed<FC_WIDTH_EXTRACONDENSED>::value, SkTFixed<SkFS::kExtraCondens
ed_Width>::value }, |
429 { SkTFixed<FC_WIDTH_CONDENSED>::value, SkTFixed<SkFS::kCondensed_Wi
dth>::value }, | 429 { SkTFixed<FC_WIDTH_CONDENSED>::value, SkTFixed<SkFS::kCondensed_Wi
dth>::value }, |
430 { SkTFixed<FC_WIDTH_SEMICONDENSED>::value, SkTFixed<SkFS::kSemiCondense
d_Width>::value }, | 430 { SkTFixed<FC_WIDTH_SEMICONDENSED>::value, SkTFixed<SkFS::kSemiCondense
d_Width>::value }, |
431 { SkTFixed<FC_WIDTH_NORMAL>::value, SkTFixed<SkFS::kNormal_Width
>::value }, | 431 { SkTFixed<FC_WIDTH_NORMAL>::value, SkTFixed<SkFS::kNormal_Width
>::value }, |
432 { SkTFixed<FC_WIDTH_SEMIEXPANDED>::value, SkTFixed<SkFS::kSemiExpanded
_Width>::value }, | 432 { SkTFixed<FC_WIDTH_SEMIEXPANDED>::value, SkTFixed<SkFS::kSemiExpanded
_Width>::value }, |
433 { SkTFixed<FC_WIDTH_EXPANDED>::value, SkTFixed<SkFS::kExpanded_Wid
th>::value }, | 433 { SkTFixed<FC_WIDTH_EXPANDED>::value, SkTFixed<SkFS::kExpanded_Wid
th>::value }, |
434 { SkTFixed<FC_WIDTH_EXTRAEXPANDED>::value, SkTFixed<SkFS::kExtraExpande
d_Width>::value }, | 434 { SkTFixed<FC_WIDTH_EXTRAEXPANDED>::value, SkTFixed<SkFS::kExtraExpande
d_Width>::value }, |
435 { SkTFixed<FC_WIDTH_ULTRAEXPANDED>::value, SkTFixed<SkFS::kUltaExpanded
_Width>::value }, | 435 { SkTFixed<FC_WIDTH_ULTRAEXPANDED>::value, SkTFixed<SkFS::kUltraExpande
d_Width>::value }, |
436 }; | 436 }; |
437 int width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL), | 437 int width = map_ranges(get_int(pattern, FC_WIDTH, FC_WIDTH_NORMAL), |
438 widthRanges, SK_ARRAY_COUNT(widthRanges)); | 438 widthRanges, SK_ARRAY_COUNT(widthRanges)); |
439 | 439 |
440 SkFS::Slant slant = SkFS::kUpright_Slant; | 440 SkFS::Slant slant = SkFS::kUpright_Slant; |
441 switch (get_int(pattern, FC_SLANT, FC_SLANT_ROMAN)) { | 441 switch (get_int(pattern, FC_SLANT, FC_SLANT_ROMAN)) { |
442 case FC_SLANT_ROMAN: slant = SkFS::kUpright_Slant; break; | 442 case FC_SLANT_ROMAN: slant = SkFS::kUpright_Slant; break; |
443 case FC_SLANT_ITALIC : slant = SkFS::kItalic_Slant ; break; | 443 case FC_SLANT_ITALIC : slant = SkFS::kItalic_Slant ; break; |
444 case FC_SLANT_OBLIQUE: slant = SkFS::kOblique_Slant; break; | 444 case FC_SLANT_OBLIQUE: slant = SkFS::kOblique_Slant; break; |
445 default: SkASSERT(false); break; | 445 default: SkASSERT(false); break; |
(...skipping 21 matching lines...) Expand all Loading... |
467 | 467 |
468 static const MapRanges widthRanges[] = { | 468 static const MapRanges widthRanges[] = { |
469 { SkTFixed<SkFS::kUltraCondensed_Width>::value, SkTFixed<FC_WIDTH_ULTRAC
ONDENSED>::value }, | 469 { SkTFixed<SkFS::kUltraCondensed_Width>::value, SkTFixed<FC_WIDTH_ULTRAC
ONDENSED>::value }, |
470 { SkTFixed<SkFS::kExtraCondensed_Width>::value, SkTFixed<FC_WIDTH_EXTRAC
ONDENSED>::value }, | 470 { SkTFixed<SkFS::kExtraCondensed_Width>::value, SkTFixed<FC_WIDTH_EXTRAC
ONDENSED>::value }, |
471 { SkTFixed<SkFS::kCondensed_Width>::value, SkTFixed<FC_WIDTH_CONDEN
SED>::value }, | 471 { SkTFixed<SkFS::kCondensed_Width>::value, SkTFixed<FC_WIDTH_CONDEN
SED>::value }, |
472 { SkTFixed<SkFS::kSemiCondensed_Width>::value, SkTFixed<FC_WIDTH_SEMICO
NDENSED>::value }, | 472 { SkTFixed<SkFS::kSemiCondensed_Width>::value, SkTFixed<FC_WIDTH_SEMICO
NDENSED>::value }, |
473 { SkTFixed<SkFS::kNormal_Width>::value, SkTFixed<FC_WIDTH_NORMAL
>::value }, | 473 { SkTFixed<SkFS::kNormal_Width>::value, SkTFixed<FC_WIDTH_NORMAL
>::value }, |
474 { SkTFixed<SkFS::kSemiExpanded_Width>::value, SkTFixed<FC_WIDTH_SEMIEX
PANDED>::value }, | 474 { SkTFixed<SkFS::kSemiExpanded_Width>::value, SkTFixed<FC_WIDTH_SEMIEX
PANDED>::value }, |
475 { SkTFixed<SkFS::kExpanded_Width>::value, SkTFixed<FC_WIDTH_EXPAND
ED>::value }, | 475 { SkTFixed<SkFS::kExpanded_Width>::value, SkTFixed<FC_WIDTH_EXPAND
ED>::value }, |
476 { SkTFixed<SkFS::kExtraExpanded_Width>::value, SkTFixed<FC_WIDTH_EXTRAE
XPANDED>::value }, | 476 { SkTFixed<SkFS::kExtraExpanded_Width>::value, SkTFixed<FC_WIDTH_EXTRAE
XPANDED>::value }, |
477 { SkTFixed<SkFS::kUltaExpanded_Width>::value, SkTFixed<FC_WIDTH_ULTRAE
XPANDED>::value }, | 477 { SkTFixed<SkFS::kUltraExpanded_Width>::value, SkTFixed<FC_WIDTH_ULTRAE
XPANDED>::value }, |
478 }; | 478 }; |
479 int width = map_ranges(style.width(), widthRanges, SK_ARRAY_COUNT(widthRange
s)); | 479 int width = map_ranges(style.width(), widthRanges, SK_ARRAY_COUNT(widthRange
s)); |
480 | 480 |
481 int slant = FC_SLANT_ROMAN; | 481 int slant = FC_SLANT_ROMAN; |
482 switch (style.slant()) { | 482 switch (style.slant()) { |
483 case SkFS::kUpright_Slant: slant = FC_SLANT_ROMAN ; break; | 483 case SkFS::kUpright_Slant: slant = FC_SLANT_ROMAN ; break; |
484 case SkFS::kItalic_Slant : slant = FC_SLANT_ITALIC ; break; | 484 case SkFS::kItalic_Slant : slant = FC_SLANT_ITALIC ; break; |
485 case SkFS::kOblique_Slant: slant = FC_SLANT_OBLIQUE; break; | 485 case SkFS::kOblique_Slant: slant = FC_SLANT_OBLIQUE; break; |
486 default: SkASSERT(false); break; | 486 default: SkASSERT(false); break; |
487 } | 487 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 const char* famName = get_name(match, FC_FAMILY); | 726 const char* famName = get_name(match, FC_FAMILY); |
727 if (famName && !find_name(names, famName)) { | 727 if (famName && !find_name(names, famName)) { |
728 *names.append() = famName; | 728 *names.append() = famName; |
729 *sizes.append() = strlen(famName) + 1; | 729 *sizes.append() = strlen(famName) + 1; |
730 } | 730 } |
731 } | 731 } |
732 | 732 |
733 return SkDataTable::NewCopyArrays((const void*const*)names.begin(), | 733 return SkDataTable::NewCopyArrays((const void*const*)names.begin(), |
734 sizes.begin(), names.count()); | 734 sizes.begin(), names.count()); |
735 } | 735 } |
OLD | NEW |