On Wed, 12 Feb 2025 19:32:31 GMT, Daniel Gredler <dgred...@openjdk.org> wrote:
> 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. This pull request has now been integrated. Changeset: 7ec2e148 Author: Daniel Gredler <dgred...@openjdk.org> Committer: SendaoYan <s...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/7ec2e14897e6dea0c7864a617ded0e33adf792f7 Stats: 317 lines in 2 files changed: 212 ins; 69 del; 36 mod 8349932: PSPrinterJob sometimes generates unnecessary PostScript commands Reviewed-by: achung, prr ------------- PR: https://git.openjdk.org/jdk/pull/23595