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 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 | 1483 |
1484 HRESULT hr = S_OK; | 1484 HRESULT hr = S_OK; |
1485 | 1485 |
1486 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount(); | 1486 const unsigned glyphCount = fDWriteFontFace->GetGlyphCount(); |
1487 | 1487 |
1488 DWRITE_FONT_METRICS dwfm; | 1488 DWRITE_FONT_METRICS dwfm; |
1489 fDWriteFontFace->GetMetrics(&dwfm); | 1489 fDWriteFontFace->GetMetrics(&dwfm); |
1490 | 1490 |
1491 info = new SkAdvancedTypefaceMetrics; | 1491 info = new SkAdvancedTypefaceMetrics; |
1492 info->fEmSize = dwfm.designUnitsPerEm; | 1492 info->fEmSize = dwfm.designUnitsPerEm; |
1493 info->fMultiMaster = false; | |
1494 info->fLastGlyphID = SkToU16(glyphCount - 1); | 1493 info->fLastGlyphID = SkToU16(glyphCount - 1); |
1495 info->fStyle = 0; | 1494 info->fStyle = 0; |
1496 | 1495 info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag; |
1497 | 1496 |
1498 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; | 1497 SkTScopedComPtr<IDWriteLocalizedStrings> familyNames; |
1499 SkTScopedComPtr<IDWriteLocalizedStrings> faceNames; | 1498 SkTScopedComPtr<IDWriteLocalizedStrings> faceNames; |
1500 hr = fDWriteFontFamily->GetFamilyNames(&familyNames); | 1499 hr = fDWriteFontFamily->GetFamilyNames(&familyNames); |
1501 hr = fDWriteFont->GetFaceNames(&faceNames); | 1500 hr = fDWriteFont->GetFaceNames(&faceNames); |
1502 | 1501 |
1503 UINT32 familyNameLength; | 1502 UINT32 familyNameLength; |
1504 hr = familyNames->GetStringLength(0, &familyNameLength); | 1503 hr = familyNames->GetStringLength(0, &familyNameLength); |
1505 | 1504 |
1506 UINT32 faceNameLength; | 1505 UINT32 faceNameLength; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { | 1593 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { |
1595 int16_t width = abcWidths.abcB; | 1594 int16_t width = abcWidths.abcB; |
1596 if (width > 0 && width < min_width) { | 1595 if (width > 0 && width < min_width) { |
1597 min_width = width; | 1596 min_width = width; |
1598 info->fStemV = min_width; | 1597 info->fStemV = min_width; |
1599 } | 1598 } |
1600 } | 1599 } |
1601 } | 1600 } |
1602 */ | 1601 */ |
1603 | 1602 |
1604 // If Restricted, the font may not be embedded in a document. | 1603 if (perGlyphInfo & SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo) { |
1605 // If not Restricted, the font can be embedded. | |
1606 // If PreviewPrint, the embedding is read-only. | |
1607 if (os2Table->version.v0.fsType.field.Restricted) { | |
1608 info->fType = SkAdvancedTypefaceMetrics::kNotEmbeddable_Font; | |
1609 } else if (perGlyphInfo & SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo)
{ | |
1610 if (fixedWidth) { | 1604 if (fixedWidth) { |
1611 appendRange(&info->fGlyphWidths, 0); | 1605 appendRange(&info->fGlyphWidths, 0); |
1612 int16_t advance; | 1606 int16_t advance; |
1613 getWidthAdvance(fDWriteFontFace.get(), 1, &advance); | 1607 getWidthAdvance(fDWriteFontFace.get(), 1, &advance); |
1614 info->fGlyphWidths->fAdvance.append(1, &advance); | 1608 info->fGlyphWidths->fAdvance.append(1, &advance); |
1615 finishRange(info->fGlyphWidths.get(), 0, | 1609 finishRange(info->fGlyphWidths.get(), 0, |
1616 SkAdvancedTypefaceMetrics::WidthRange::kDefault); | 1610 SkAdvancedTypefaceMetrics::WidthRange::kDefault); |
1617 } else { | 1611 } else { |
1618 info->fGlyphWidths.reset( | 1612 info->fGlyphWidths.reset( |
1619 getAdvanceData(fDWriteFontFace.get(), | 1613 getAdvanceData(fDWriteFontFace.get(), |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); | 1897 SK_TRACEHR(hr, "Could not get GetUserDefaultLocaleName."); |
1904 } else { | 1898 } else { |
1905 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); | 1899 localeNameLen = getUserDefaultLocaleNameProc(localeNameStorage, LOCALE_N
AME_MAX_LENGTH); |
1906 if (localeNameLen) { | 1900 if (localeNameLen) { |
1907 localeName = localeNameStorage; | 1901 localeName = localeNameStorage; |
1908 }; | 1902 }; |
1909 } | 1903 } |
1910 | 1904 |
1911 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); | 1905 return SkNEW_ARGS(SkFontMgr_DirectWrite, (sysFontCollection.get(), localeNam
e, localeNameLen)); |
1912 } | 1906 } |
OLD | NEW |