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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp

Issue 2785033004: Update comment on overspecified font-variation-settings (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | 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 (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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 FontPlatformData FontCustomPlatformData::fontPlatformData( 56 FontPlatformData FontCustomPlatformData::fontPlatformData(
57 float size, 57 float size,
58 bool bold, 58 bool bold,
59 bool italic, 59 bool italic,
60 FontOrientation orientation, 60 FontOrientation orientation,
61 const FontVariationSettings* variationSettings) { 61 const FontVariationSettings* variationSettings) {
62 DCHECK(m_baseTypeface); 62 DCHECK(m_baseTypeface);
63 63
64 sk_sp<SkTypeface> returnTypeface = m_baseTypeface; 64 sk_sp<SkTypeface> returnTypeface = m_baseTypeface;
65 65
66 // Maximum axis count is maximum value for the OpenType USHORT, which is a 66 // Maximum axis count is maximum value for the OpenType USHORT,
67 // 16bit unsigned. https://www.microsoft.com/typography/otspec/fvar.htm 67 // which is a 16bit unsigned.
68 // Variation settings coming from CSS can have duplicate assignments and the 68 // https://www.microsoft.com/typography/otspec/fvar.htm Variation
69 // list can be longer than UINT16_MAX, but ignoring this for now, going with a 69 // settings coming from CSS can have duplicate assignments and the
70 // reasonable upper limit and leaving the deduplication for TODO(drott), 70 // list can be longer than UINT16_MAX, but ignoring the length for
71 // crbug.com/674878 second duplicate value should supersede first.. 71 // now, going with a reasonable upper limit. Deduplication is
72 // handled by Skia with priority given to the last occuring
73 // assignment.
72 if (variationSettings && variationSettings->size() < UINT16_MAX) { 74 if (variationSettings && variationSettings->size() < UINT16_MAX) {
73 #if OS(WIN) 75 #if OS(WIN)
74 sk_sp<SkFontMgr> fm(SkFontMgr_New_Custom_Empty()); 76 sk_sp<SkFontMgr> fm(SkFontMgr_New_Custom_Empty());
75 #else 77 #else
76 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); 78 sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
77 #endif 79 #endif
78 Vector<SkFontMgr::FontParameters::Axis, 0> axes; 80 Vector<SkFontMgr::FontParameters::Axis, 0> axes;
79 axes.reserveCapacity(variationSettings->size()); 81 axes.reserveCapacity(variationSettings->size());
80 for (size_t i = 0; i < variationSettings->size(); ++i) { 82 for (size_t i = 0; i < variationSettings->size(); ++i) {
81 SkFontMgr::FontParameters::Axis axis = { 83 SkFontMgr::FontParameters::Axis axis = {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 new FontCustomPlatformData(std::move(typeface), decoder.decodedSize())); 120 new FontCustomPlatformData(std::move(typeface), decoder.decodedSize()));
119 } 121 }
120 122
121 bool FontCustomPlatformData::supportsFormat(const String& format) { 123 bool FontCustomPlatformData::supportsFormat(const String& format) {
122 return equalIgnoringCase(format, "truetype") || 124 return equalIgnoringCase(format, "truetype") ||
123 equalIgnoringCase(format, "opentype") || 125 equalIgnoringCase(format, "opentype") ||
124 WebFontDecoder::supportsFormat(format); 126 WebFontDecoder::supportsFormat(format);
125 } 127 }
126 128
127 } // namespace blink 129 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698