Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| TextSpan | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Reader; |
| 6 | |
| 7 | /** |
| 8 | * A positioned span of text extracted from a PDF page. |
| 9 | * |
| 10 | * Coordinates are in PDF user space (origin at bottom-left of page). |
| 11 | * Width and height are computed from font metrics and the current |
| 12 | * text/graphics state at the time the text was rendered. |
| 13 | */ |
| 14 | final class TextSpan |
| 15 | { |
| 16 | public function __construct( |
| 17 | /** The Unicode text content of this span. */ |
| 18 | public readonly string $text, |
| 19 | /** X coordinate of the span origin (left edge) in user space points. */ |
| 20 | public readonly float $x, |
| 21 | /** Y coordinate of the span baseline in user space points. */ |
| 22 | public readonly float $y, |
| 23 | /** Width of the span in user space points. */ |
| 24 | public readonly float $width, |
| 25 | /** Height of the span in user space points (based on font size). */ |
| 26 | public readonly float $height, |
| 27 | /** Font size in points at the time of rendering. */ |
| 28 | public readonly float $fontSize, |
| 29 | /** PDF resource name of the font (e.g., "F1", "F2"). */ |
| 30 | public readonly string $fontName, |
| 31 | ) {} |
| 32 | } |