Index: emit.c =================================================================== --- emit.c (revision 5688) +++ emit.c (working copy) @@ -50,6 +50,7 @@ #include #include "string.h" #include +#include "debug.h" #if defined(WIN32) || defined(__EMX__) # include @@ -111,6 +112,9 @@ ppd_choice_t **collect; /* Collected choices */ + DEBUG_printf(("ppdCollect2(ppd=%p, section=%d, min_order=%f, choices=%p)\n", + ppd, section, min_order, choices)); + if (ppd == NULL) return (0); @@ -132,6 +136,8 @@ for (k = o->num_choices, c = o->choices; k > 0; k --, c ++) if (c->marked && count < 1000) { + DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword, + c->choice)); collect[count] = c; count ++; } @@ -142,6 +148,8 @@ for (m = o->num_choices, c = o->choices; m > 0; m --, c ++) if (c->marked && count < 1000) { + DEBUG_printf(("ppdCollect2: %s=%s marked...\n", o->keyword, + c->choice)); collect[count] = c; count ++; } @@ -155,6 +163,8 @@ qsort(collect, count, sizeof(ppd_choice_t *), (int (*)(const void *, const void *))ppd_sort); + DEBUG_printf(("ppdCollect2: %d marked choices...\n", count)); + /* * Return the array and number of choices; if 0, free the array since * it isn't needed. @@ -492,6 +502,9 @@ struct lconv *loc; /* Locale data */ + DEBUG_printf(("ppdEmitString(ppd=%p, section=%d, min_order=%f)\n", + ppd, section, min_order)); + /* * Range check input... */ @@ -527,6 +540,8 @@ !strcasecmp(choices[i]->option->keyword, "PageRegion")) && !strcasecmp(choices[i]->choice, "Custom")) { + DEBUG_puts("ppdEmitString: Custom size set!"); + bufsize += 37; /* %%BeginFeature: *CustomPageSize True\n */ bufsize += 50; /* Five 9-digit numbers + newline */ } @@ -580,6 +595,8 @@ * Allocate memory... */ + DEBUG_printf(("ppdEmitString: Allocating %d bytes for string...\n", bufsize)); + if ((buffer = calloc(1, bufsize)) == NULL) { free(choices); @@ -608,6 +625,9 @@ * Send DSC comments with option... */ + DEBUG_printf(("Adding code for %s=%s...\n", choices[i]->option->keyword, + choices[i]->choice)); + if ((!strcasecmp(choices[i]->option->keyword, "PageSize") || !strcasecmp(choices[i]->option->keyword, "PageRegion")) && !strcasecmp(choices[i]->choice, "Custom")) @@ -800,6 +820,9 @@ strlcpy(bufptr, "%%EndFeature\n" "} stopped cleartomark\n", bufend - bufptr + 1); bufptr += strlen(bufptr); + + DEBUG_printf(("ppdEmitString: Offset in string is %d...\n", + bufptr - buffer)); } else { Index: mark.c =================================================================== --- mark.c (revision 5688) +++ mark.c (working copy) @@ -407,6 +407,7 @@ ppd_cparam_t *cparam; /* Custom parameter */ char *units; /* Custom points units */ + if ((coption = ppdFindCustomOption(ppd, option)) != NULL) { if ((cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) == NULL) @@ -455,6 +456,12 @@ } } } + + /* + * Make sure that we keep the option marked below... + */ + + choice = "Custom"; } else if (choice[0] == '{') { Index: testppd.c =================================================================== --- testppd.c (revision 5688) +++ testppd.c (working copy) @@ -72,8 +72,8 @@ static const char *custom_code = "[{\n" "%%BeginFeature: *CustomPageSize True\n" + "400\n" "500\n" - "400\n" "0\n" "0\n" "0\n"