R7.4: an unembedded font is no damage (#5)
The warning watch skips MuPDF's non-embedded font notice and its repeat counts. Text and search reads are watched too: damage they meet is kept on the document, told by the next draw or picture check, and fails image and text exports until then. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
969cb67c96
commit
6b676e06e6
9 files changed
+191
-9
No files matched your search
@@ -56,10 +56,21 @@ typedef struct
|
||||
void *user;
|
||||
} passing;
|
||||
|
||||
/* MuPDF draws an unembedded font with another. */
|
||||
static const char notice[] = "non-embedded font using identity encoding:";
|
||||
|
||||
/* 1 while the last warning was that notice. */
|
||||
static int substituted;
|
||||
|
||||
static void keep_warning(void *user, const char *message)
|
||||
{
|
||||
passing *p = user;
|
||||
if (strlen(warned) + strlen(message) + 2 < sizeof warned)
|
||||
/* An unembedded font drawn by another is no damage. */
|
||||
if (!strncmp(message, notice, sizeof notice - 1))
|
||||
substituted = 1;
|
||||
else if (strncmp(message, "... repeated ", 13))
|
||||
substituted = 0;
|
||||
if (!substituted && strlen(warned) + strlen(message) + 2 < sizeof warned)
|
||||
{
|
||||
fz_strlcat(warned, message, sizeof warned);
|
||||
fz_strlcat(warned, "\n", sizeof warned);
|
||||
@@ -74,6 +85,8 @@ static int watched;
|
||||
/* Collects MuPDF's warnings until `ely_watch_end`. */
|
||||
void ely_watch_begin(fz_context *ctx)
|
||||
{
|
||||
/* A pending repeat is of MuPDF's last warning. */
|
||||
substituted = !strncmp(ctx->warn.message, notice, sizeof notice - 1);
|
||||
watching.next = fz_warning_callback(ctx, &watching.user);
|
||||
warned[0] = 0;
|
||||
watched = 1;
|
||||
|
||||
Reference in new issue
Block a user