PeachPDF
PeachPDF
ClippedWord Struct
One word that was DRAWN into the content stream and then truncated by a clip.
public readonly record struct ClippedWord : System.IEquatable<PeachPDF.ClippedWord>
Implements System.IEquatable<ClippedWord>
Remarks
This exists because reading the finished PDF cannot detect this class of loss. A glyph that was emitted and then truncated by the PDF clip operator is still IN the content stream, so a reader that parses that stream finds it and reports the word present, while a renderer that honours the clip shows only part of it. Measured with the two as an oracle pair on a table cell narrower than its content: PdfPig reads every character back and reports the document complete; MuPDF cannot find the text at all. Both are correct — the difference is simply not recorded in the file. So the engine, at the moment it decides to draw, is the only thing that can report it.
It is deliberately ADDITIVE to reading the output back, never a replacement. A content-stream reader answers “did the glyph land in the file”; an engine-side collector answers “did the painter intend to emit it”, and the two catch different defects — a document declaring one image where the PDF contains zero is caught only by the former.
It UNDER-reports, and that is the safe direction but must not be mistaken for completeness.
The clip this is measured against is Canvas’s tracked rect stack, and two clips never
reach it: a border-radius or clip-path clip (the path-clip push deliberately
leaves the tracked bound over-wide, and the exclude-push is a no-op), and the page-level
PdfGraphics.IntersectClip the PDF generator applies outside the stack. So “nothing
reported” is a weaker statement than “nothing was clipped”.
| Constructors | |
|---|---|
| ClippedWord(string, double, double, double, double) | One word that was DRAWN into the content stream and then truncated by a clip. |
| Properties | |
|---|---|
| DrawnHeight | Height of the word’s own rect, before the clip was applied. |
| DrawnWidth | Width of the word’s own rect, before the clip was applied. |
| KeptFraction | The fraction of the word’s area that survived the clip, 0 to 1. A calibration handle: the threshold for what counts as material is a measurement over real documents, not a guess. |
| Text | The word as it was drawn. |
| VisibleHeight | Height that survived the clip. |
| VisibleWidth | Width that survived the clip. Less than DrawnWidth when width was a clipped dimension; EQUAL to it for a word clipped only vertically, which is recorded too — a box short enough to cut a line’s height but wide enough to keep the whole word is the same silent loss. |