Conversation
…the text box A near-infinite placeholder rectangle (±10,000,000 units) was used to build the even-odd clip path that cuts the leader line where it enters the text box. Ghostscript's pdfwrite device (used by psconvert for PDF/EPS output) miscomputes that clip when the outer/inner rectangle size ratio is this extreme, dropping the entire line instead of just the part inside the box. Size the outer rectangle from the actual text box and line length instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
joa-quim
left a comment
There was a problem hiding this comment.
Federico, I fear when I see changes like this that I don't understand. And specially when done with lower models (yes, Sonnet is a lower model). Please use Opus for things like this.
Yes, sorry. Claude created this PR directly even though I've asked him never to open a PR directly. Now I will revised it with Opus. |
The outer rectangle summed PSL_dim_h signed, but that value is negative for text sitting entirely below the baseline (an all-subscript label such as "@-,@-"), and PSL_dx/PSL_dy are negative for a negative -C. A signed sum could then shrink the rectangle below the hole it has to contain: for 200p all-subscript text the bound came out 183 units against a hole reaching 1175, leaving the two disjoint, so even-odd yielded outer OR hole and the leader line was drawn through the label unclipped. Sum absolute values instead, so the bound depends only on the magnitudes of the same quantities the hole is built from and cannot shrink. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
I have had that battle myself too. The bloody thing keeps insisting in having opinions and free will. You have to make loose that privilege. |
|
Now it works for me. I personally tested and I got the desire map. Done by Sonnet and reviewed with Claude Opus 5. |
joa-quim
left a comment
There was a problem hiding this comment.
OK, let's see if this doesn't bite back some day.
pstext -D...+v<pen>leader lines render fine when the PostScript is rasterized directly, but vanish once Ghostscript converts it —pdfwrite,eps2writeandps2writeare all affected, i.e. every vector targetpsconverthas. The even-odd clip path that cuts the line where it enters the text box used a ±10,000,000-unit placeholder for "infinity"; Ghostscript miscomputes the clip at that magnitude and drops the whole line. Sized the outer rectangle from the actual text box and line length instead.Regression from #9035 (
6e9b4f7001), which replacedPSL_plotsegmentwith the clipped version. Bisected with three builds, same command and pipeline:6f5fced743(parent of #9035)6e9b4f7001(#9035)Ghostscript's cliff is between ±3,000,000 (drawn) and ±10,000,000 (dropped), so the new bound sits ~3 orders of magnitude clear. Shipped in 6.7.0; 6.6.0 and earlier are clean.
The second commit sums absolute values:
PSL_dim_his negative for an all-subscript label (andPSL_dx/dyfor a negative-C), which could otherwise shrink the rectangle below the hole it must contain.Tested with:
Also rotated labels, all nine justify codes, long strings, 200p all-subscript text, boxless
+v. Fullpstext/postscriptlightctest suites pass.Note the existing harness can't catch this class of bug:
gmtestcompares GraphicsMagick's own rasterization of the.ps, so it never renders through a Ghostscript vector device.Fixes #9209
Generated with Claude Sonnet 5, reviewed and hardened with Claude Opus 5.
🤖 Generated with Claude Code