[PDF] Always set the symbolic Flag for Fonts.
authorvandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 13 Mar 2013 20:01:51 +0000 (20:01 +0000)
committervandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 13 Mar 2013 20:01:51 +0000 (20:01 +0000)
This should fix Chrome bug 124572

Review URL: https://codereview.appspot.com/7631045

git-svn-id: http://skia.googlecode.com/svn/trunk@8136 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkAdvancedTypefaceMetrics.h
src/pdf/SkPDFFont.cpp
src/ports/SkFontHost_FreeType.cpp
src/ports/SkFontHost_mac.cpp
src/ports/SkFontHost_win.cpp
src/ports/SkFontHost_win_dw.cpp

index d326379a5096d5fab17fe594c5f991d1db1d67bd..acfd86e218dafd808c0a17864d4772678af03981 100755 (executable)
@@ -52,9 +52,7 @@ public:
     enum StyleFlags {
         kFixedPitch_Style  = 0x00001,
         kSerif_Style       = 0x00002,
-        kSymbolic_Style    = 0x00004,
         kScript_Style      = 0x00008,
-        kNonsymbolic_Style = 0x00020,
         kItalic_Style      = 0x00040,
         kAllCaps_Style     = 0x10000,
         kSmallCaps_Style   = 0x20000,
index a38510ceb0615f17fd8de38e9b79f5aa41a1f3b8..10252ad52a27d97d245c8aae12765f4db6c47bb7 100644 (file)
 #include SK_SFNTLY_SUBSETTER
 #endif
 
+// PDF's notion of symbolic vs non-symbolic is related to the character set, not
+// symbols vs. characters.  Rarely is a font the right character set to call it
+// non-symbolic, so always call it symbolic.  (PDF 1.4 spec, section 5.7.1)
+static const int kPdfSymbolic = 4;
+
 namespace {
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -945,7 +950,7 @@ bool SkPDFFont::addCommonFontDescriptorEntries(int16_t defaultWidth) {
     const uint16_t emSize = fFontInfo->fEmSize;
 
     fDescriptor->insertName("FontName", fFontInfo->fFontName);
-    fDescriptor->insertInt("Flags", fFontInfo->fStyle);
+    fDescriptor->insertInt("Flags", fFontInfo->fStyle | kPdfSymbolic);
     fDescriptor->insertScalar("Ascent",
             scaleFromFontUnits(fFontInfo->fAscent, emSize));
     fDescriptor->insertScalar("Descent",
index 9422cf99d32abc8cde9f554e6efe5cb004bd948b..40d939c17c45a073d4e7bbdeeac9fb75125da48a 100644 (file)
@@ -499,9 +499,6 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
         info->fStyle |= SkAdvancedTypefaceMetrics::kFixedPitch_Style;
     if (face->style_flags & FT_STYLE_FLAG_ITALIC)
         info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style;
-    // We should set either Symbolic or Nonsymbolic; Nonsymbolic if the font's
-    // character set is a subset of 'Adobe standard Latin.'
-    info->fStyle |= SkAdvancedTypefaceMetrics::kSymbolic_Style;
 
     PS_FontInfoRec ps_info;
     TT_Postscript* tt_info;
index 83c811a684e0aafb6f8d1566969434e02b260079..4a6b8d8b6803f399d321c2f8755b4473d334ce24 100755 (executable)
@@ -1520,9 +1520,6 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
         info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style;
     }
     CTFontStylisticClass stylisticClass = symbolicTraits & kCTFontClassMaskTrait;
-    if (stylisticClass & kCTFontSymbolicClass) {
-        info->fStyle |= SkAdvancedTypefaceMetrics::kSymbolic_Style;
-    }
     if (stylisticClass >= kCTFontOldStyleSerifsClass && stylisticClass <= kCTFontSlabSerifsClass) {
         info->fStyle |= SkAdvancedTypefaceMetrics::kSerif_Style;
     } else if (stylisticClass & kCTFontScriptsClass) {
index 0f7295f5a084946c40217d342c891e93625f0791..d0fbd47e2d8882982110b86d881fc832e93a1941 100755 (executable)
@@ -1406,8 +1406,6 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
     if (otm.otmTextMetrics.tmItalic) {
         info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style;
     }
-    // Setting symbolic style by default for now.
-    info->fStyle |= SkAdvancedTypefaceMetrics::kSymbolic_Style;
     if (otm.otmTextMetrics.tmPitchAndFamily & FF_ROMAN) {
         info->fStyle |= SkAdvancedTypefaceMetrics::kSerif_Style;
     } else if (otm.otmTextMetrics.tmPitchAndFamily & FF_SCRIPT) {
index 1f257eb3d1485079e2cc64b4bba9dea8bade18e6..4bf91511c135e3ca658d1ceb6acec4565171141f 100644 (file)
@@ -1488,8 +1488,6 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
     if (os2Table->version.v0.fsSelection.field.Italic) {
         info->fStyle |= SkAdvancedTypefaceMetrics::kItalic_Style;
     }
-    //Symbolic (uses more than base latin).
-    info->fStyle |= SkAdvancedTypefaceMetrics::kSymbolic_Style;
     //Script
     if (SkPanose::FamilyType::Script == os2Table->version.v0.panose.bFamilyType.value) {
         info->fStyle |= SkAdvancedTypefaceMetrics::kScript_Style;