Commit 5f3abad
committed
pdf_io: add partial parsing of 'config' special
In upstream dvipdfmx the `dvidpfmx:config` DVI special can be used to
pass arguments to dvipdfmx. This has seen some use in XeTeX packages.
For example, the ubiqitous package "hyperref" uses:
\special{dvipdfmx:config C 0x0010}
This is normally parsed by dvipdfmx as command line arguments, i.e. as
if xdvipdfmx was ran as:
xdvipdfmx -C 0x0010
The `C` option is a bitset of compatibility flags. In this case hyperref
needs the option `OPT_PDFDOC_NO_DEST_REMOVE`, which makes dvipdfmx
handle PDF destinations differently (I didn't check thoroughly how).
The `opt_flags` global variable used to hold these bitflags and the
`dvipdfmx:config` special could be used to set them. #92 removed that
option.
While passing arbitrary command line arguments to dvidpfmx is probably
not what we want, I definitely know, that we at least need the
compatibility flags to work, and there is probably no other way packages
can set them.
The code that does the option parsing is mostly port from the 'C' option
parsing from dvipdfmx's `read_config_special` and `do_args_second_pass`.
IMHO the way `opt_flags` gets modified is undefined behaviour and does
other weird things with negative values, but the purpose of this commit
is to increase compatibility with upstream, not to fix things (which
should preferably be done upstream IMO).
Like with other options, instead of having a global variable, the
pointer to the value in `dvipdfmx_main` is passed around instead.
While at it, I also added `z` and `g` options which also seem to be used
by LaTeX, so this should be enough for a while.
Hopefully fixes #904.1 parent 34afff0 commit 5f3abad
3 files changed
Lines changed: 96 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | 77 | | |
83 | 78 | | |
84 | 79 | | |
| |||
248 | 243 | | |
249 | 244 | | |
250 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
251 | 252 | | |
252 | | - | |
| 253 | + | |
253 | 254 | | |
254 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
255 | 258 | | |
256 | 259 | | |
257 | 260 | | |
| |||
369 | 372 | | |
370 | 373 | | |
371 | 374 | | |
372 | | - | |
373 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
374 | 381 | | |
375 | 382 | | |
376 | 383 | | |
| |||
397 | 404 | | |
398 | 405 | | |
399 | 406 | | |
| 407 | + | |
| 408 | + | |
400 | 409 | | |
401 | | - | |
| 410 | + | |
402 | 411 | | |
403 | 412 | | |
404 | 413 | | |
| |||
518 | 527 | | |
519 | 528 | | |
520 | 529 | | |
521 | | - | |
| 530 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2490 | 2490 | | |
2491 | 2491 | | |
2492 | 2492 | | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
2493 | 2553 | | |
2494 | 2554 | | |
2495 | 2555 | | |
| 2556 | + | |
| 2557 | + | |
2496 | 2558 | | |
2497 | 2559 | | |
2498 | 2560 | | |
| 2561 | + | |
2499 | 2562 | | |
2500 | 2563 | | |
2501 | 2564 | | |
| |||
2626 | 2689 | | |
2627 | 2690 | | |
2628 | 2691 | | |
2629 | | - | |
| 2692 | + | |
2630 | 2693 | | |
2631 | 2694 | | |
2632 | 2695 | | |
| |||
2648 | 2711 | | |
2649 | 2712 | | |
2650 | 2713 | | |
| 2714 | + | |
| 2715 | + | |
2651 | 2716 | | |
2652 | 2717 | | |
2653 | | - | |
| 2718 | + | |
| 2719 | + | |
2654 | 2720 | | |
2655 | 2721 | | |
2656 | 2722 | | |
| |||
2694 | 2760 | | |
2695 | 2761 | | |
2696 | 2762 | | |
| 2763 | + | |
| 2764 | + | |
2697 | 2765 | | |
2698 | 2766 | | |
| 2767 | + | |
2699 | 2768 | | |
2700 | 2769 | | |
2701 | 2770 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | | - | |
| 81 | + | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
| |||
0 commit comments