https://bugs.kde.org/show_bug.cgi?id=353401

Dileep Sankhla <sankhla.dilee...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sankhla.dilee...@gmail.com

--- Comment #18 from Dileep Sankhla <sankhla.dilee...@gmail.com> ---
On Thu, Mar 22, 2018 at 4:13 AM, Tobias Deiminger <haxti...@posteo.de> wrote:

Okular already let's you create FreeText annotations. The confusing thing is
that they're called "inline notes" in Okulars manual, and they're represented
as class TextAnnotation (with m_textType == TextAnnotation::InPlace) in Okular
and Popplers QT5 frontend. Under the hood poppler generates a real FreeText
annotation:

# qt5/src/poppler-annotation.cc
Annot* TextAnnotationPrivate::createNativeAnnot(::Page *destPage, DocumentData
*doc)
{
    // ...
    PDFRectangle rect = boundaryToPdfRectangle(boundary, flags);
    if (textType == TextAnnotation::Linked)
    {
        pdfAnnot = new AnnotText(destPage->getDoc(), &rect);
    }
    else
    {
        GooString * da = toAppearanceString(textFont);
        pdfAnnot = new AnnotFreeText(destPage->getDoc(), &rect, da); // Here it
is :-)
        delete da;
    }
    // ...
}

I assume that what really is missing is the FreeTextTypeWriter behavior. You
can check the ISO 32000 PDF standard for FreeTextTypeWriter (IT entry of the
FreeText object).

You can also fire up okular in gdb and convince yourself

$ gdb okular
(gdb) b AnnotFreeText::AnnotFreeText
(gdb) r

# load document, create inline note => we hit popplers
AnnotFreeText::AnnotFreeText constructor

Thread 1 "okular" hit Breakpoint 1, 0x00007fffce304220 in
AnnotFreeText::AnnotFreeText(PDFDoc*, PDFRectangle*, GooString*)@plt () from
/tmp/usr/lib/libpoppler-qt5.so.1
(gdb) bt
#0  0x00007fffce304220 in AnnotFreeText::AnnotFreeText(PDFDoc*, PDFRectangle*,
GooString*)@plt () from /tmp/usr/lib/libpoppler-qt5.so.1
#1  0x00007fffce30d689 in Poppler::TextAnnotationPrivate::createNativeAnnot (
    this=0x7fffdc00ccb0, destPage=<optimized out>, doc=<optimized out>)
    at
/home/tobias/workspace/OSScontrib/poppler/qt5/src/poppler-annotation.cc:1880
... backtrace shortened ...

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to