| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkAdvancedTypefaceMetrics.h" | 9 #include "SkAdvancedTypefaceMetrics.h" |
| 10 #include "SkBase64.h" | 10 #include "SkBase64.h" |
| (...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 // It has been verified that this does not involve a buffer overrun. | 1699 // It has been verified that this does not involve a buffer overrun. |
| 1700 if (GDI_ERROR == total_size || total_size > BUFFERSIZE) { | 1700 if (GDI_ERROR == total_size || total_size > BUFFERSIZE) { |
| 1701 // GDI_ERROR because the BUFFERSIZE was too small, or because the data w
as not accessible. | 1701 // GDI_ERROR because the BUFFERSIZE was too small, or because the data w
as not accessible. |
| 1702 // When the data is not accessable GetGlyphOutlineW fails rather quickly
, | 1702 // When the data is not accessable GetGlyphOutlineW fails rather quickly
, |
| 1703 // so just try to get the size. If that fails then ensure the data is ac
cessible. | 1703 // so just try to get the size. If that fails then ensure the data is ac
cessible. |
| 1704 total_size = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, 0, NULL, &fMa
t22); | 1704 total_size = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, 0, NULL, &fMa
t22); |
| 1705 if (GDI_ERROR == total_size) { | 1705 if (GDI_ERROR == total_size) { |
| 1706 LogFontTypeface::EnsureAccessible(this->getTypeface()); | 1706 LogFontTypeface::EnsureAccessible(this->getTypeface()); |
| 1707 total_size = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, 0, NULL,
&fMat22); | 1707 total_size = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, 0, NULL,
&fMat22); |
| 1708 if (GDI_ERROR == total_size) { | 1708 if (GDI_ERROR == total_size) { |
| 1709 SkASSERT(false); | 1709 // GetGlyphOutlineW is known to fail for some characters, such a
s spaces. |
| 1710 // In these cases, just return that the glyph does not have a sh
ape. |
| 1710 return 0; | 1711 return 0; |
| 1711 } | 1712 } |
| 1712 } | 1713 } |
| 1713 | 1714 |
| 1714 glyphbuf->reset(total_size); | 1715 glyphbuf->reset(total_size); |
| 1715 | 1716 |
| 1716 DWORD ret = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, total_size, gl
yphbuf->get(), &fMat22); | 1717 DWORD ret = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, total_size, gl
yphbuf->get(), &fMat22); |
| 1717 if (GDI_ERROR == ret) { | 1718 if (GDI_ERROR == ret) { |
| 1718 LogFontTypeface::EnsureAccessible(this->getTypeface()); | 1719 LogFontTypeface::EnsureAccessible(this->getTypeface()); |
| 1719 ret = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, total_size, glyp
hbuf->get(), &fMat22); | 1720 ret = GetGlyphOutlineW(fDDC, glyph.fID, flags, &gm, total_size, glyp
hbuf->get(), &fMat22); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 | 2619 |
| 2619 private: | 2620 private: |
| 2620 SkTDArray<ENUMLOGFONTEX> fLogFontArray; | 2621 SkTDArray<ENUMLOGFONTEX> fLogFontArray; |
| 2621 }; | 2622 }; |
| 2622 | 2623 |
| 2623 /////////////////////////////////////////////////////////////////////////////// | 2624 /////////////////////////////////////////////////////////////////////////////// |
| 2624 | 2625 |
| 2625 SkFontMgr* SkFontMgr_New_GDI() { | 2626 SkFontMgr* SkFontMgr_New_GDI() { |
| 2626 return SkNEW(SkFontMgrGDI); | 2627 return SkNEW(SkFontMgrGDI); |
| 2627 } | 2628 } |
| OLD | NEW |