diff options
| author | Emulator000 | 2020-09-26 21:56:20 +0200 |
|---|---|---|
| committer | Emulator000 | 2020-09-26 21:56:20 +0200 |
| commit | 96f39fea9921292d5aa67f478bd3d8e947f127be (patch) | |
| tree | 99593e8121655c125d326ceb105701c5226c6885 | |
| parent | 9c7a675498ed4d83a924e963cf9a610116e6db7e (diff) | |
| download | pdf_form-96f39fea9921292d5aa67f478bd3d8e947f127be.tar.bz2 | |
Bugfix in textfield Y position calculation
| -rw-r--r-- | src/lib.rs | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -554,7 +554,14 @@ impl Form { // Calcolate the text offset let x = 2.0; // Suppose this fixed offset as we should have known the border here - let y = 0.5 * (rect[3] - rect[1]) - 0.4 * font_size as f32; // Formula picked up from Poppler + + // Formula picked up from Poppler + let dy = rect[1] - rect[3]; + let y = if dy > 0.0 { + 0.5 * dy - 0.4 * font_size as f32 + } else { + 0.5 * font_size as f32 + }; // Set the text bounds, first are fixed at "1 0 0 1" and then the calculated x,y content.operations.append(&mut vec