<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add font color in Poppler"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107151#c12">Comment # 12</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add font color in Poppler"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107151">bug 107151</a>
              from <span class="vcard"><a class="email" href="mailto:haxtibal@posteo.de" title="Tobias Deiminger <haxtibal@posteo.de>"> <span class="fn">Tobias Deiminger</span></a>
</span></b>
        <pre>(In reply to Dileep Sankhla from <a href="show_bug.cgi?id=107151#c11">comment #11</a>)
<span class="quote">> I have created a draft patch here:
> <a href="https://cgit.kde.org/scratch/dileepsankhla/okular-gsoc2018-typewriter.git/">https://cgit.kde.org/scratch/dileepsankhla/okular-gsoc2018-typewriter.git/</a>
> tree/font_color_poppler_core/font_color.patch</span >
I changed your patch to make it work, see
<a href="https://cgit.kde.org/scratch/dileepsankhla/okular-gsoc2018-typewriter.git/plain/font_color_poppler_core/0001-Create-and-parse-DA-string-in-AnnotFreeText.patch">https://cgit.kde.org/scratch/dileepsankhla/okular-gsoc2018-typewriter.git/plain/font_color_poppler_core/0001-Create-and-parse-DA-string-in-AnnotFreeText.patch</a>

<span class="quote">> 1) Whenever I create a typewriter annotation in the modified okular,
> I get "SIGABRT Error"</span >
The crash was because pointers inside apStr were not yet initalized when
createNativeAnnot was called.

<span class="quote">> 2) I have hardcoded textElement.setAttribute( QStringLiteral("font")</span >
Ah, noted this too late. With my patch textFont() reads from core. So you can
revert your line to 
textElement.setAttribute( QStringLiteral("font"), textFont().toString() )
However, because font family is not yet saved in the PDF (only "Invalid_font"
is saved) and just a default QFont is constructed, QFont::family() is probably
lost on document reload. This is independent from this patch and probably
happens also with released poppler versions. Did not check it.

<span class="quote">> 3) What do you say about the patch? Is it neat and promising</span >
There were some problems, like globals should be avoided almost always in C++,
and you should use automatic memory management where possible (here we can do
it by putting variables on stack), and the getters for text and color had been
removed but we still need them. There's still something to do, grep for "TODO"
in my patch.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>