RFR: 8349932: PSPrinterJob sometimes generates unnecessary PostScript commands [v2]

Daniel Gredler dgredler at openjdk.org
Fri Feb 14 23:51:49 UTC 2025


> Trying to print text which is ignored (e.g. `\r` or `\n` or `\t`), or trying to print empty shapes generates PostScript graphics context setup commands which are not necessary. This can lead to unnecessarily large PostScript files, and can complicate analysis / comparison of these files.
> 
> Two methods are impacted:
> 
> `PSPrinterJob.textOut(...)`: The `prepDrawing()` method should only be called once all sanity checks have passed. Otherwise, it will add PS graphics context setup commands that may not be necessary.
> 
> `PSPrinterJob.deviceFill(...)`: This method should do nothing if the provided `PathIterator` is empty. Otherwise, it will add PS graphics context setup commands that are not necessary.
> 
> The changes in `PSPrinterJob.textOut(...)` eliminated a big `if` statement, therefore include some indentation changes. Checking the diff with whitespace ignored should be helpful here.
> 
> A test case is included.

Daniel Gredler has updated the pull request incrementally with one additional commit since the last revision:

  Consider OS line separator when inspecting PostScript

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/23595/files
  - new: https://git.openjdk.org/jdk/pull/23595/files/78d02b07..0d8009d7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23595&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23595&range=00-01

  Stats: 6 lines in 1 file changed: 5 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/23595.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23595/head:pull/23595

PR: https://git.openjdk.org/jdk/pull/23595


More information about the client-libs-dev mailing list