Skip to content

Commit

Permalink
Bug 707449: Fall back to "usecmap" declaration for embedded CMaps.
Browse files Browse the repository at this point in the history
CMap objects in PDF _must_ also set the UseCMap dictionary entry,
but in case they violate the spec by not doing so we can still
try to respect the "usecmap" directive in embedded cmap streams.
  • Loading branch information
ccxvii committed Jan 3, 2024
1 parent 1a08853 commit 89df69b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/pdf/pdf-cmap-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ pdf_load_embedded_cmap_imp(fz_context *ctx, pdf_document *doc, pdf_obj *stmobj,
usecmap = pdf_load_embedded_cmap_imp(ctx, doc, obj, &cycle);
pdf_set_usecmap(ctx, cmap, usecmap);
}
else if (strlen(cmap->usecmap_name) > 0)
{
fz_try(ctx)
{
usecmap = pdf_load_system_cmap(ctx, cmap->usecmap_name);
pdf_set_usecmap(ctx, cmap, usecmap);
}
fz_catch(ctx)
{
fz_rethrow_if(ctx, FZ_ERROR_SYSTEM);
fz_report_error(ctx);
fz_warn(ctx, "cannot load system CMap: %s", pdf_to_name(ctx, obj));
}
}

pdf_store_item(ctx, stmobj, cmap, pdf_cmap_size(ctx, cmap));
}
Expand Down

0 comments on commit 89df69b

Please sign in to comment.