OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Computer, Inc. | 2 * Copyright (C) 2007 Apple Computer, Inc. |
3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. | 3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. |
4 * Copyright (C) 2010 Company 100, Inc. | 4 * Copyright (C) 2010 Company 100, Inc. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // reasonable upper limit and leaving the deduplication for TODO(drott), | 68 // reasonable upper limit and leaving the deduplication for TODO(drott), |
69 // crbug.com/674878 second duplicate value should supersede first.. | 69 // crbug.com/674878 second duplicate value should supersede first.. |
70 if (variationSettings && variationSettings->size() < UINT16_MAX) { | 70 if (variationSettings && variationSettings->size() < UINT16_MAX) { |
71 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); | 71 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); |
72 Vector<SkFontMgr::FontParameters::Axis, 0> axes; | 72 Vector<SkFontMgr::FontParameters::Axis, 0> axes; |
73 axes.reserveCapacity(variationSettings->size()); | 73 axes.reserveCapacity(variationSettings->size()); |
74 for (size_t i = 0; i < variationSettings->size(); ++i) { | 74 for (size_t i = 0; i < variationSettings->size(); ++i) { |
75 SkFontMgr::FontParameters::Axis axis = { | 75 SkFontMgr::FontParameters::Axis axis = { |
76 atomicStringToFourByteTag(variationSettings->at(i).tag()), | 76 atomicStringToFourByteTag(variationSettings->at(i).tag()), |
77 SkFloatToScalar(variationSettings->at(i).value())}; | 77 SkFloatToScalar(variationSettings->at(i).value())}; |
78 axes.append(axis); | 78 axes.push_back(axis); |
79 } | 79 } |
80 | 80 |
81 sk_sp<SkTypeface> skVariationFont(fm->createFromStream( | 81 sk_sp<SkTypeface> skVariationFont(fm->createFromStream( |
82 m_baseTypeface->openStream(nullptr)->duplicate(), | 82 m_baseTypeface->openStream(nullptr)->duplicate(), |
83 SkFontMgr::FontParameters().setAxes(axes.data(), axes.size()))); | 83 SkFontMgr::FontParameters().setAxes(axes.data(), axes.size()))); |
84 | 84 |
85 if (skVariationFont) { | 85 if (skVariationFont) { |
86 returnTypeface = skVariationFont; | 86 returnTypeface = skVariationFont; |
87 } else { | 87 } else { |
88 SkString familyName; | 88 SkString familyName; |
(...skipping 23 matching lines...) Expand all Loading... |
112 new FontCustomPlatformData(std::move(typeface), decoder.decodedSize())); | 112 new FontCustomPlatformData(std::move(typeface), decoder.decodedSize())); |
113 } | 113 } |
114 | 114 |
115 bool FontCustomPlatformData::supportsFormat(const String& format) { | 115 bool FontCustomPlatformData::supportsFormat(const String& format) { |
116 return equalIgnoringCase(format, "truetype") || | 116 return equalIgnoringCase(format, "truetype") || |
117 equalIgnoringCase(format, "opentype") || | 117 equalIgnoringCase(format, "opentype") || |
118 WebFontDecoder::supportsFormat(format); | 118 WebFontDecoder::supportsFormat(format); |
119 } | 119 } |
120 | 120 |
121 } // namespace blink | 121 } // namespace blink |
OLD | NEW |