OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple 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 * | 7 * |
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 if (!matchData.m_hasMatched) | 462 if (!matchData.m_hasMatched) |
463 return 0; | 463 return 0; |
464 | 464 |
465 matchData.m_chosen.lfHeight = -size; | 465 matchData.m_chosen.lfHeight = -size; |
466 matchData.m_chosen.lfWidth = 0; | 466 matchData.m_chosen.lfWidth = 0; |
467 matchData.m_chosen.lfEscapement = 0; | 467 matchData.m_chosen.lfEscapement = 0; |
468 matchData.m_chosen.lfOrientation = 0; | 468 matchData.m_chosen.lfOrientation = 0; |
469 matchData.m_chosen.lfUnderline = false; | 469 matchData.m_chosen.lfUnderline = false; |
470 matchData.m_chosen.lfStrikeOut = false; | 470 matchData.m_chosen.lfStrikeOut = false; |
471 matchData.m_chosen.lfCharSet = DEFAULT_CHARSET; | 471 matchData.m_chosen.lfCharSet = DEFAULT_CHARSET; |
472 #if USE(CG) || USE(CAIRO) | 472 #if USE(CG) |
473 matchData.m_chosen.lfOutPrecision = OUT_TT_ONLY_PRECIS; | 473 matchData.m_chosen.lfOutPrecision = OUT_TT_ONLY_PRECIS; |
474 #else | 474 #else |
475 matchData.m_chosen.lfOutPrecision = OUT_TT_PRECIS; | 475 matchData.m_chosen.lfOutPrecision = OUT_TT_PRECIS; |
476 #endif | 476 #endif |
477 matchData.m_chosen.lfQuality = DEFAULT_QUALITY; | 477 matchData.m_chosen.lfQuality = DEFAULT_QUALITY; |
478 matchData.m_chosen.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; | 478 matchData.m_chosen.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; |
479 | 479 |
480 if (desiredItalic && !matchData.m_chosen.lfItalic && synthesizeItalic) | 480 if (desiredItalic && !matchData.m_chosen.lfItalic && synthesizeItalic) |
481 matchData.m_chosen.lfItalic = 1; | 481 matchData.m_chosen.lfItalic = 1; |
482 | 482 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 LOGFONT logFont; | 571 LOGFONT logFont; |
572 GetObject(hfont, sizeof(LOGFONT), &logFont); | 572 GetObject(hfont, sizeof(LOGFONT), &logFont); |
573 | 573 |
574 bool synthesizeBold = isGDIFontWeightBold(weight) && !isGDIFontWeightBold(lo
gFont.lfWeight); | 574 bool synthesizeBold = isGDIFontWeightBold(weight) && !isGDIFontWeightBold(lo
gFont.lfWeight); |
575 bool synthesizeItalic = fontDescription.italic() && !logFont.lfItalic; | 575 bool synthesizeItalic = fontDescription.italic() && !logFont.lfItalic; |
576 | 576 |
577 FontPlatformData* result = new FontPlatformData(hfont, fontDescription.compu
tedPixelSize(), synthesizeBold, synthesizeItalic, useGDI); | 577 FontPlatformData* result = new FontPlatformData(hfont, fontDescription.compu
tedPixelSize(), synthesizeBold, synthesizeItalic, useGDI); |
578 | 578 |
579 #if USE(CG) | 579 #if USE(CG) |
580 bool fontCreationFailed = !result->cgFont(); | 580 bool fontCreationFailed = !result->cgFont(); |
581 #elif USE(CAIRO) | |
582 bool fontCreationFailed = !result->scaledFont(); | |
583 #endif | 581 #endif |
584 | 582 |
585 if (fontCreationFailed) { | 583 if (fontCreationFailed) { |
586 // The creation of the CGFontRef failed for some reason. We already ass
erted in debug builds, but to make | 584 // The creation of the CGFontRef failed for some reason. We already ass
erted in debug builds, but to make |
587 // absolutely sure that we don't use this font, go ahead and return 0 so
that we can fall back to the next | 585 // absolutely sure that we don't use this font, go ahead and return 0 so
that we can fall back to the next |
588 // font. | 586 // font. |
589 delete result; | 587 delete result; |
590 DeleteObject(hfont); | 588 DeleteObject(hfont); |
591 return 0; | 589 return 0; |
592 } | 590 } |
593 | 591 |
594 return result; | 592 return result; |
595 } | 593 } |
596 | 594 |
597 } | 595 } |
598 | 596 |
OLD | NEW |