| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 255 |
| 256 RefPtr<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsMask,
0).iterator->value; | 256 RefPtr<CSSSegmentedFontFace>& face = segmentedFontFaceCache->add(traitsMask,
0).iterator->value; |
| 257 if (!face) { | 257 if (!face) { |
| 258 for (HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >::const_iterator i
= familyFontFaces->begin(); i != familyFontFaces->end(); ++i) { | 258 for (HashMap<unsigned, RefPtr<CSSSegmentedFontFace> >::const_iterator i
= familyFontFaces->begin(); i != familyFontFaces->end(); ++i) { |
| 259 CSSSegmentedFontFace* candidate = i->value.get(); | 259 CSSSegmentedFontFace* candidate = i->value.get(); |
| 260 unsigned candidateTraitsMask = candidate->traitsMask(); | 260 unsigned candidateTraitsMask = candidate->traitsMask(); |
| 261 if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & Fo
ntStyleNormalMask)) | 261 if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask & Fo
ntStyleNormalMask)) |
| 262 continue; | 262 continue; |
| 263 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask &
FontVariantNormalMask)) | 263 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMask &
FontVariantNormalMask)) |
| 264 continue; | 264 continue; |
| 265 #if ENABLE(SVG_FONTS) | |
| 266 // For SVG Fonts that specify that they only support the "normal" va
riant, we will assume they are incapable | |
| 267 // of small-caps synthesis and just ignore the font face as a candid
ate. | |
| 268 if (candidate->hasSVGFontFaceSource() && (traitsMask & FontVariantSm
allCapsMask) && !(candidateTraitsMask & FontVariantSmallCapsMask)) | |
| 269 continue; | |
| 270 #endif | |
| 271 if (!face || compareFontFaces(candidate, face.get(), traitsMask)) | 265 if (!face || compareFontFaces(candidate, face.get(), traitsMask)) |
| 272 face = candidate; | 266 face = candidate; |
| 273 } | 267 } |
| 274 | 268 |
| 275 if (Vector<RefPtr<CSSSegmentedFontFace> >* familyLocallyInstalledFontFac
es = m_locallyInstalledFontFaces.get(family)) { | 269 if (Vector<RefPtr<CSSSegmentedFontFace> >* familyLocallyInstalledFontFac
es = m_locallyInstalledFontFaces.get(family)) { |
| 276 unsigned numLocallyInstalledFontFaces = familyLocallyInstalledFontFa
ces->size(); | 270 unsigned numLocallyInstalledFontFaces = familyLocallyInstalledFontFa
ces->size(); |
| 277 for (unsigned i = 0; i < numLocallyInstalledFontFaces; ++i) { | 271 for (unsigned i = 0; i < numLocallyInstalledFontFaces; ++i) { |
| 278 CSSSegmentedFontFace* candidate = familyLocallyInstalledFontFace
s->at(i).get(); | 272 CSSSegmentedFontFace* candidate = familyLocallyInstalledFontFace
s->at(i).get(); |
| 279 unsigned candidateTraitsMask = candidate->traitsMask(); | 273 unsigned candidateTraitsMask = candidate->traitsMask(); |
| 280 if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask
& FontStyleNormalMask)) | 274 if ((traitsMask & FontStyleNormalMask) && !(candidateTraitsMask
& FontStyleNormalMask)) |
| 281 continue; | 275 continue; |
| 282 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMas
k & FontVariantNormalMask)) | 276 if ((traitsMask & FontVariantNormalMask) && !(candidateTraitsMas
k & FontVariantNormalMask)) |
| 283 continue; | 277 continue; |
| 284 if (!face || compareFontFaces(candidate, face.get(), traitsMask)
) | 278 if (!face || compareFontFaces(candidate, face.get(), traitsMask)
) |
| 285 face = candidate; | 279 face = candidate; |
| 286 } | 280 } |
| 287 } | 281 } |
| 288 } | 282 } |
| 289 return face.get(); | 283 return face.get(); |
| 290 } | 284 } |
| 291 | 285 |
| 292 } | 286 } |
| OLD | NEW |