OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
9 #undef GetGlyphIndices | 9 #undef GetGlyphIndices |
10 | 10 |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 | 1480 |
1481 HRESULT hr = S_OK; | 1481 HRESULT hr = S_OK; |
1482 | 1482 |
1483 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount(); | 1483 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount(); |
1484 | 1484 |
1485 DWRITE_FONT_METRICS dwfm; | 1485 DWRITE_FONT_METRICS dwfm; |
1486 fDWriteFontFace->GetMetrics(&dwfm); | 1486 fDWriteFontFace->GetMetrics(&dwfm); |
1487 | 1487 |
1488 info = new SkAdvancedTypefaceMetrics; | 1488 info = new SkAdvancedTypefaceMetrics; |
1489 info->fEmSize = dwfm.designUnitsPerEm; | 1489 info->fEmSize = dwfm.designUnitsPerEm; |
1490 info->fMultiMaster = false; | |
1491 info->fLastGlyphID = SkToU16(glyphCount - 1); | 1490 info->fLastGlyphID = SkToU16(glyphCount - 1); |
1492 info->fStyle = 0; | 1491 info->fStyle = 0; |
1493 | 1492 info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_Flag; |
1494 | 1493 |
1495 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; | 1494 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; |
1496 SkTScopedComPtr<IDWriteLocalizedStrings> faceNames; | 1495 SkTScopedComPtr<IDWriteLocalizedStrings> faceNames; |
1497 hr = fDWriteFontFamily->GetFamilyNames(&familyNames); | 1496 hr = fDWriteFontFamily->GetFamilyNames(&familyNames); |
1498 hr = fDWriteFont->GetFaceNames(&faceNames); | 1497 hr = fDWriteFont->GetFaceNames(&faceNames); |
1499 | 1498 |
1500 UINT32 familyNameLength; | 1499 UINT32 familyNameLength; |
1501 hr = familyNames->GetStringLength(0, &familyNameLength); | 1500 hr = familyNames->GetStringLength(0, &familyNameLength); |
1502 | 1501 |
1503 UINT32 faceNameLength; | 1502 UINT32 faceNameLength; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { | 1590 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { |
1592 int16_t width = abcWidths.abcB; | 1591 int16_t width = abcWidths.abcB; |
1593 if (width > 0 && width < min_width) { | 1592 if (width > 0 && width < min_width) { |
1594 min_width = width; | 1593 min_width = width; |
1595 info->fStemV = min_width; | 1594 info->fStemV = min_width; |
1596 } | 1595 } |
1597 } | 1596 } |
1598 } | 1597 } |
1599 */ | 1598 */ |
1600 | 1599 |
1601 // If Restricted, the font may not be embedded in a document. | 1600 if (perGlyphInfo & SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo) { |
1602 // If not Restricted, the font can be embedded. | |
1603 // If PreviewPrint, the embedding is read-only. | |
1604 if (os2Table->version.v0.fsType.field.Restricted) { | |
1605 info->fType = SkAdvancedTypefaceMetrics::kNotEmbeddable_Font; | |
1606 } else if (perGlyphInfo & SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo)
{ | |
1607 if (fixedWidth) { | 1601 if (fixedWidth) { |
1608 appendRange(&info->fGlyphWidths, 0); | 1602 appendRange(&info->fGlyphWidths, 0); |
1609 int16_t advance; | 1603 int16_t advance; |
1610 getWidthAdvance(fDWriteFontFace.get(), 1, &advance); | 1604 getWidthAdvance(fDWriteFontFace.get(), 1, &advance); |
1611 info->fGlyphWidths->fAdvance.append(1, &advance); | 1605 info->fGlyphWidths->fAdvance.append(1, &advance); |
1612 finishRange(info->fGlyphWidths.get(), 0, | 1606 finishRange(info->fGlyphWidths.get(), 0, |
1613 SkAdvancedTypefaceMetrics::WidthRange::kDefault); | 1607 SkAdvancedTypefaceMetrics::WidthRange::kDefault); |
1614 } else { | 1608 } else { |
1615 info->fGlyphWidths.reset( | 1609 info->fGlyphWidths.reset( |
1616 getAdvanceData(fDWriteFontFace.get(), | 1610 getAdvanceData(fDWriteFontFace.get(), |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); | 1892 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); |
1899 } else { | 1893 } else { |
1900 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 1894 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
1901 if (localeNameLen) { | 1895 if (localeNameLen) { |
1902 localeName = localeNameStorage; | 1896 localeName = localeNameStorage; |
1903 }; | 1897 }; |
1904 } | 1898 } |
1905 | 1899 |
1906 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); | 1900 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); |
1907 } | 1901 } |
OLD | NEW |