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

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

Issue 111893002: Revert "[PDF] Fix font embedding restrictions." (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontHost_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 /* 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 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 lf.lfHeight = -SkToS32(otm.otmEMSquare); 1844 lf.lfHeight = -SkToS32(otm.otmEMSquare);
1845 designFont = CreateFontIndirect(&lf); 1845 designFont = CreateFontIndirect(&lf);
1846 SelectObject(hdc, designFont); 1846 SelectObject(hdc, designFont);
1847 if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm)) { 1847 if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm)) {
1848 goto Error; 1848 goto Error;
1849 } 1849 }
1850 glyphCount = calculateGlyphCount(hdc, fLogFont); 1850 glyphCount = calculateGlyphCount(hdc, fLogFont);
1851 1851
1852 info = new SkAdvancedTypefaceMetrics; 1852 info = new SkAdvancedTypefaceMetrics;
1853 info->fEmSize = otm.otmEMSquare; 1853 info->fEmSize = otm.otmEMSquare;
1854 info->fMultiMaster = false;
1854 info->fLastGlyphID = SkToU16(glyphCount - 1); 1855 info->fLastGlyphID = SkToU16(glyphCount - 1);
1855 info->fStyle = 0; 1856 info->fStyle = 0;
1856 tchar_to_skstring(lf.lfFaceName, &info->fFontName); 1857 tchar_to_skstring(lf.lfFaceName, &info->fFontName);
1857 info->fFlags = SkAdvancedTypefaceMetrics::kEmpty_FontFlag;
1858 // If bit 1 is set, the font may not be embedded in a document.
1859 // If bit 1 is clear, the font can be embedded.
1860 // If bit 2 is set, the embedding is read-only.
1861 if (otm.otmfsType & 0x1) {
1862 info->fFlags = SkTBitOr<SkAdvancedTypefaceMetrics::FontFlags>(
1863 info->fFlags,
1864 SkAdvancedTypefaceMetrics::kNotEmbeddable_FontFlag);
1865 }
1866 1858
1867 if (perGlyphInfo & SkAdvancedTypefaceMetrics::kToUnicode_PerGlyphInfo) { 1859 if (perGlyphInfo & SkAdvancedTypefaceMetrics::kToUnicode_PerGlyphInfo) {
1868 populate_glyph_to_unicode(hdc, glyphCount, &(info->fGlyphToUnicode)); 1860 populate_glyph_to_unicode(hdc, glyphCount, &(info->fGlyphToUnicode));
1869 } 1861 }
1870 1862
1871 if (glyphCount > 0 && 1863 if (glyphCount > 0 &&
1872 (otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) { 1864 (otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)) {
1873 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font; 1865 info->fType = SkAdvancedTypefaceMetrics::kTrueType_Font;
1874 } else { 1866 } else {
1875 info->fType = SkAdvancedTypefaceMetrics::kOther_Font; 1867 info->fType = SkAdvancedTypefaceMetrics::kOther_Font;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 ABC abcWidths; 1908 ABC abcWidths;
1917 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) { 1909 if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) {
1918 int16_t width = abcWidths.abcB; 1910 int16_t width = abcWidths.abcB;
1919 if (width > 0 && width < min_width) { 1911 if (width > 0 && width < min_width) {
1920 min_width = width; 1912 min_width = width;
1921 info->fStemV = min_width; 1913 info->fStemV = min_width;
1922 } 1914 }
1923 } 1915 }
1924 } 1916 }
1925 1917
1926 if (perGlyphInfo & SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo) { 1918 // If bit 1 is set, the font may not be embedded in a document.
1919 // If bit 1 is clear, the font can be embedded.
1920 // If bit 2 is set, the embedding is read-only.
1921 if (otm.otmfsType & 0x1) {
1922 info->fType = SkAdvancedTypefaceMetrics::kNotEmbeddable_Font;
1923 } else if (perGlyphInfo &
1924 SkAdvancedTypefaceMetrics::kHAdvance_PerGlyphInfo) {
1927 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) { 1925 if (info->fStyle & SkAdvancedTypefaceMetrics::kFixedPitch_Style) {
1928 appendRange(&info->fGlyphWidths, 0); 1926 appendRange(&info->fGlyphWidths, 0);
1929 info->fGlyphWidths->fAdvance.append(1, &min_width); 1927 info->fGlyphWidths->fAdvance.append(1, &min_width);
1930 finishRange(info->fGlyphWidths.get(), 0, 1928 finishRange(info->fGlyphWidths.get(), 0,
1931 SkAdvancedTypefaceMetrics::WidthRange::kDefault); 1929 SkAdvancedTypefaceMetrics::WidthRange::kDefault);
1932 } else { 1930 } else {
1933 info->fGlyphWidths.reset( 1931 info->fGlyphWidths.reset(
1934 getAdvanceData(hdc, 1932 getAdvanceData(hdc,
1935 glyphCount, 1933 glyphCount,
1936 glyphIDs, 1934 glyphIDs,
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 2600
2603 private: 2601 private:
2604 SkTDArray<ENUMLOGFONTEX> fLogFontArray; 2602 SkTDArray<ENUMLOGFONTEX> fLogFontArray;
2605 }; 2603 };
2606 2604
2607 /////////////////////////////////////////////////////////////////////////////// 2605 ///////////////////////////////////////////////////////////////////////////////
2608 2606
2609 SkFontMgr* SkFontMgr_New_GDI() { 2607 SkFontMgr* SkFontMgr_New_GDI() {
2610 return SkNEW(SkFontMgrGDI); 2608 return SkNEW(SkFontMgrGDI);
2611 } 2609 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontHost_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698