OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 bool shouldSetSyntheticItalic = false; | 140 bool shouldSetSyntheticItalic = false; |
141 FontDescription description(fontDescription); | 141 FontDescription description(fontDescription); |
142 if (fallbackFont.isBold && description.weight() < FontWeightBold) | 142 if (fallbackFont.isBold && description.weight() < FontWeightBold) |
143 description.setWeight(FontWeightBold); | 143 description.setWeight(FontWeightBold); |
144 if (!fallbackFont.isBold && description.weight() >= FontWeightBold) { | 144 if (!fallbackFont.isBold && description.weight() >= FontWeightBold) { |
145 shouldSetSyntheticBold = true; | 145 shouldSetSyntheticBold = true; |
146 description.setWeight(FontWeightNormal); | 146 description.setWeight(FontWeightNormal); |
147 } | 147 } |
148 if (fallbackFont.isItalic && description.style() == FontStyleNormal) | 148 if (fallbackFont.isItalic && description.style() == FontStyleNormal) |
149 description.setStyle(FontStyleItalic); | 149 description.setStyle(FontStyleItalic); |
150 if (!fallbackFont.isItalic && (description.style() == FontStyleItalic || | 150 if (!fallbackFont.isItalic && |
151 description.style() == FontStyleOblique)) { | 151 (description.style() == FontStyleItalic || |
| 152 description.style() == FontStyleOblique)) { |
152 shouldSetSyntheticItalic = true; | 153 shouldSetSyntheticItalic = true; |
153 description.setStyle(FontStyleNormal); | 154 description.setStyle(FontStyleNormal); |
154 } | 155 } |
155 | 156 |
156 FontPlatformData* substitutePlatformData = | 157 FontPlatformData* substitutePlatformData = |
157 getFontPlatformData(description, creationParams); | 158 getFontPlatformData(description, creationParams); |
158 if (!substitutePlatformData) | 159 if (!substitutePlatformData) |
159 return nullptr; | 160 return nullptr; |
160 | 161 |
161 std::unique_ptr<FontPlatformData> platformData( | 162 std::unique_ptr<FontPlatformData> platformData( |
162 new FontPlatformData(*substitutePlatformData)); | 163 new FontPlatformData(*substitutePlatformData)); |
163 platformData->setSyntheticBold(shouldSetSyntheticBold); | 164 platformData->setSyntheticBold(shouldSetSyntheticBold); |
164 platformData->setSyntheticItalic(shouldSetSyntheticItalic); | 165 platformData->setSyntheticItalic(shouldSetSyntheticItalic); |
165 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); | 166 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); |
166 } | 167 } |
167 | 168 |
168 #endif // !OS(ANDROID) | 169 #endif // !OS(ANDROID) |
169 | 170 |
170 } // namespace blink | 171 } // namespace blink |
OLD | NEW |