SkPdfImageDictionary* SkPdfImageDictionary::SMask(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("SMask", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary() && ((SkPdfImageDictionary*)ret)->valid()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfImageDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfDictionary* SkPdfStructureTreeRootDictionary::ClassMap(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("ClassMap", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfDictionary* SkPdfAppearanceCharacteristicsDictionary::IF(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("IF", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfDictionary* SkPdfEmbeddedFileStreamDictionary::Params(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("Params", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfDictionary* SkPdfFileTrailerDictionary::Info(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("Info", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfDictionary* SkPdfDeviceNColorSpaceDictionary::Colorants(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("Colorants", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfDictionary* SkPdfOpiVersionDictionary::version_number(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("version_number", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing required field, assert for known good pdfs
  return NULL;
}
bool SkPdfCMapDictionary::isCIDSystemInfoADictionary(SkPdfNativeDoc* doc) {
    SkPdfNativeObject* ret = get("CIDSystemInfo", "");
    if (doc) {
        ret = doc->resolveReference(ret);
    }
    return ret != NULL && ret->isDictionary();
}
SkPdfDictionary* SkPdfType2PatternDictionary::getShadingAsDictionary(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("Shading", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing required field, assert for known good pdfs
  return NULL;
}
SkPdfDictionary* SkPdfType2PatternDictionary::ExtGState(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("ExtGState", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfDictionary* SkPdfWebCaptureCommandSettingsDictionary::C(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("C", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
SkPdfResourceDictionary* SkPdfType1PatternDictionary::Resources(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("Resources", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary() && ((SkPdfResourceDictionary*)ret)->valid()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfResourceDictionary*)ret;
  // TODO(edisonn): warn about missing required field, assert for known good pdfs
  return NULL;
}
SkPdfDictionary* SkPdfCIDFontDescriptorDictionary::Style(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("Style", "");
  if (doc) {ret = doc->resolveReference(ret);}
  if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
  // TODO(edisonn): warn about missing default value for optional fields
  return NULL;
}
Exemple #14
0
SkPdfFont* fontFromName(SkPdfNativeDoc* doc, SkPdfNativeObject* obj, const char* fontName) {
    SkTypeface* typeface = SkTypefaceFromPdfStandardFont(fontName, false, false);
    if (typeface != NULL) {
        return new SkPdfStandardFont(typeface);
    }

    // TODO(edisonn): perf - make a map
    for (unsigned int i = 0 ; i < doc->objects(); i++) {
        SkPdfNativeObject* obj = doc->object(i);
        if (!obj || !obj->isDictionary()) {
            continue;
        }

        SkPdfFontDescriptorDictionary* fd = obj->asDictionary()->asFontDescriptorDictionary();

        if (!fd->valid()) {
            continue;
        }

        if (fd->has_FontName() && fd->FontName(doc).equals(fontName)) {
            SkPdfFont* font = SkPdfFont::fontFromFontDescriptor(doc, fd, false);
            if (font) {
                return font;
            } else {
                // failed to load font descriptor
                break;
            }
        }
    }

    // TODO(edisonn): warning/report issue
    return SkPdfFont::Default();
}
bool SkPdfType2PatternDictionary::isShadingADictionary(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("Shading", "");
  if (doc) {ret = doc->resolveReference(ret);}
  return ret != NULL && ret->isDictionary();
}
bool SkPdfAppearanceDictionary::isDADictionary(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("D", "");
  if (doc) {ret = doc->resolveReference(ret);}
  return ret != NULL && ret->isDictionary();
}
bool SkPdfThreadActionDictionary::isBADictionary(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("B", "");
  if (doc) {ret = doc->resolveReference(ret);}
  return ret != NULL && ret->isDictionary();
}
bool SkPdfSourceInformationDictionary::isAUADictionary(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("AU", "");
  if (doc) {ret = doc->resolveReference(ret);}
  return ret != NULL && ret->isDictionary();
}
bool SkPdfStructureTreeRootDictionary::isKADictionary(SkPdfNativeDoc* doc) {
  SkPdfNativeObject* ret = get("K", "");
  if (doc) {ret = doc->resolveReference(ret);}
  return ret != NULL && ret->isDictionary();
}