Fix calculation of TextAnnotation size
... so that select/move rectangle fits exactly around icons regardless of PDF page size and DPI settings
I'd consider it only as partial fix. Poppler forces us to use 24x24 pts, else we'd never get a match. Poppler silently ignores what size applications set in Poppler::Annotation::setBoundary or what comes from the PDF objects /Rect entry, in the case of an external writer. This should IMHO get fixed at Poppler side, or at least it should be clarified why forcing 24x24 pts was necessary. The PDF standard just says "readers shall provide predefined icon appearances for standard names: Comment, Key, Note, Help, NewParagraph, Paragraph, Insert" [18.104.22.168]. It doesn't say anything about a predefined size. It says, the /Rect entry defines position and size [12.5.2, 12.5.3].
Patch in https://phabricator.kde.org/F5620896 shows how poppler could help out.
Some further references to get an idea why 24x24 enforcement was done in Poppler:
- commit of 24 x 24 enforcement: https://cgit.freedesktop.org/poppler/poppler/commit/poppler/Annot.cc?id=7684c325929493ad9de01a891de0aef197e176dd
- introduction of appearance streams for default icons: https://bugs.freedesktop.org/show_bug.cgi?id=23108
- related thread on poppler mailing list: https://lists.freedesktop.org/archives/poppler/2012-October/009592.html
Add TextAnnotations (the ones from the top entry of the annotation toolbar) to PDF documents with various page sizes (e.g. A3, A4, letter, ...).
- Select the icon by left-click. The size of the drawn rectangle shall match with the rendered icon.
- Move the icon around by left-click + dragging. The size of the drawn rectangle shall match with the rendered icon.
Open a file with externally created (e.g. LaTeX) text annotation, and repeat steps from above.
Start Okular with different hidpi setting, e.g.
$ QT_SCREEN_SCALE_FACTORS='DVI-I-1=2' okular
Repeat steps from above.