static void pdf_load_system_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname, char *collection, int has_encoding) { int bold = 0; int italic = 0; int serif = 0; int mono = 0; if (strstr(fontname, "Bold")) bold = 1; if (strstr(fontname, "Italic")) italic = 1; if (strstr(fontname, "Oblique")) italic = 1; /* cf. https://code.google.com/p/sumatrapdf/issues/detail?id=2280 */ if (strstr(fontname, "Courier")) mono = 1; if (fontdesc->flags & PDF_FD_FIXED_PITCH) mono = 1; if (fontdesc->flags & PDF_FD_SERIF) serif = 1; if (fontdesc->flags & PDF_FD_ITALIC) italic = 1; if (fontdesc->flags & PDF_FD_FORCE_BOLD) bold = 1; if (collection) { if (!strcmp(collection, "Adobe-CNS1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_CNS, serif); else if (!strcmp(collection, "Adobe-GB1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_GB, serif); else if (!strcmp(collection, "Adobe-Japan1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_JAPAN, serif); else if (!strcmp(collection, "Adobe-Korea1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_KOREA, serif); else { if (strcmp(collection, "Adobe-Identity") != 0) fz_warn(ctx, "unknown cid collection: %s", collection); pdf_load_substitute_font(ctx, fontdesc, fontname, mono, serif, bold, italic); } } else { /* cf. http://bugs.ghostscript.com/show_bug.cgi?id=691690 */ if ((fontdesc->flags & PDF_FD_SYMBOLIC) && !has_encoding) fz_throw(ctx, FZ_ERROR_GENERIC, "encoding-less symbolic font '%s' is missing", fontname); pdf_load_substitute_font(ctx, fontdesc, fontname, mono, serif, bold, italic); } }
static void pdf_load_system_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname, char *collection) { int bold = 0; int italic = 0; int serif = 0; int mono = 0; if (strstr(fontname, "Bold")) bold = 1; if (strstr(fontname, "Italic")) italic = 1; if (strstr(fontname, "Oblique")) italic = 1; if (fontdesc->flags & PDF_FD_FIXED_PITCH) mono = 1; if (fontdesc->flags & PDF_FD_SERIF) serif = 1; if (fontdesc->flags & PDF_FD_ITALIC) italic = 1; if (fontdesc->flags & PDF_FD_FORCE_BOLD) bold = 1; if (collection) { if (!strcmp(collection, "Adobe-CNS1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_CNS, serif); else if (!strcmp(collection, "Adobe-GB1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_GB, serif); else if (!strcmp(collection, "Adobe-Japan1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_JAPAN, serif); else if (!strcmp(collection, "Adobe-Korea1")) pdf_load_substitute_cjk_font(ctx, fontdesc, fontname, PDF_ROS_KOREA, serif); else { if (strcmp(collection, "Adobe-Identity") != 0) fz_warn(ctx, "unknown cid collection: %s", collection); pdf_load_substitute_font(ctx, fontdesc, fontname, mono, serif, bold, italic); } } else { pdf_load_substitute_font(ctx, fontdesc, fontname, mono, serif, bold, italic); } }