Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: src/ports/SkFontHost_win.cpp

Issue 1221903004: SkAdvancedTypefaceMetrics zeroing constructor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkTypeface_win_dw.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkAdvancedTypefaceMetrics.h" 8 #include "SkAdvancedTypefaceMetrics.h"
9 #include "SkBase64.h" 9 #include "SkBase64.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 designFont = CreateFontIndirect(&lf); 1760 designFont = CreateFontIndirect(&lf);
1761 SelectObject(hdc, designFont); 1761 SelectObject(hdc, designFont);
1762 if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm)) { 1762 if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm)) {
1763 goto Error; 1763 goto Error;
1764 } 1764 }
1765 glyphCount = calculateGlyphCount(hdc, fLogFont); 1765 glyphCount = calculateGlyphCount(hdc, fLogFont);
1766 1766
1767 info = new SkAdvancedTypefaceMetrics; 1767 info = new SkAdvancedTypefaceMetrics;
1768 info->fEmSize = otm.otmEMSquare; 1768 info->fEmSize = otm.otmEMSquare;
1769 info->fLastGlyphID = SkToU16(glyphCount - 1); 1769 info->fLastGlyphID = SkToU16(glyphCount - 1);
1770 info->fStyle = 0;
1771 tchar_to_skstring(lf.lfFaceName, &info->fFontName); 1770 tchar_to_skstring(lf.lfFaceName, &info->fFontName);
1772 info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
1773 // If bit 1 is set, the font may not be embedded in a document. 1771 // If bit 1 is set, the font may not be embedded in a document.
1774 // If bit 1 is clear, the font can be embedded. 1772 // If bit 1 is clear, the font can be embedded.
1775 // If bit 2 is set, the embedding is read-only. 1773 // If bit 2 is set, the embedding is read-only.
1776 if (otm.otmfsType & 0x1) { 1774 if (otm.otmfsType & 0x1) {
1777 info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>( 1775 info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>(
1778 info->fFlags, 1776 info->fFlags,
1779 SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag); 1777 SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag);
1780 } 1778 }
1781 1779
1782 if (perGlyphInfo & kToUnicode_PerGlyphInfo) { 1780 if (perGlyphInfo & kToUnicode_PerGlyphInfo) {
1783 populate_glyph_to_unicode(hdc, glyphCount, &(info->fGlyphToUnicode)); 1781 populate_glyph_to_unicode(hdc, glyphCount, &(info->fGlyphToUnicode));
1784 } 1782 }
1785 1783
1786 if (glyphCount > 0 && 1784 if (glyphCount > 0 &&
1787 (otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) { 1785 (otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) {
1788 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font; 1786 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font;
1789 } else { 1787 } else {
1790 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
1791 info->fItalicAngle = 0;
1792 info->fAscent = 0;
1793 info->fDescent = 0;
1794 info->fStemV = 0;
1795 info->fCapHeight = 0;
1796 info->fBBox = SkIRect::MakeEmpty();
1797 goto ReturnInfo; 1788 goto ReturnInfo;
1798 } 1789 }
1799 1790
1800 // If this bit is clear the font is a fixed pitch font. 1791 // If this bit is clear the font is a fixed pitch font.
1801 if (!(otm.otmTextMetrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) { 1792 if (!(otm.otmTextMetrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) {
1802 info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style; 1793 info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style;
1803 } 1794 }
1804 if (otm.otmTextMetrics.tmItalic) { 1795 if (otm.otmTextMetrics.tmItalic) {
1805 info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style; 1796 info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style;
1806 } 1797 }
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 2512
2522 private: 2513 private:
2523 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2514 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2524 }; 2515 };
2525 2516
2526 /////////////////////////////////////////////////////////////////////////////// 2517 ///////////////////////////////////////////////////////////////////////////////
2527 2518
2528 SkFontMgr* SkFontMgr_New_GDI() { 2519 SkFontMgr* SkFontMgr_New_GDI() {
2529 return SkNEW(SkFontMgrGDI); 2520 return SkNEW(SkFontMgrGDI);
2530 } 2521 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkTypeface_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698