GSoC/2018/StatusReports/DileepSankhla: Difference between revisions

From KDE Community Wiki
< GSoC‎ | 2018‎ | StatusReports
mNo edit summary
(Reduced file size for optimized page load)
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Implementing the FreeText annotation with FreeTextTypewriter behavior==
==Implementing the FreeText annotation with FreeTextTypewriter behavior==


Okular is a KDE universal document viewer. It allows reviewing and annotating the PDF documents and supports various text and graphic annotations. FreeText is one of them but the FreeTextTypewriter behavior is still missing to write directly on PDF page. This project focus on implementing this missing FreeText annotation feature and adding a new ‘Typewriter’ entry in the annotation toolbar.
Okular is a KDE universal document viewer. It allows reviewing and annotating the PDF documents and supports various text and graphic annotations. FreeText is one of them but the FreeTextTypewriter behavior is still missing to write directly on a PDF page. This project focus on implementing this missing FreeText annotation feature and adding a new ‘Typewriter’ entry in the annotation toolbar.


'''Mentor:''' Tobias Deiminger
'''Mentor:''' Tobias Deiminger
Line 11: Line 11:
* Font color implementation in both Okular and Poppler for the FreeText Annotation.
* Font color implementation in both Okular and Poppler for the FreeText Annotation.
* Font family implementation in Poppler for the FreeText Annotation.
* Font family implementation in Poppler for the FreeText Annotation.
===What's Left===
The experimental font family implementation for the base-14 fonts is quite buggy and is not an accurate solution. It is also not nicely structured and requires the proper implementation to write the streams and embed fonts into the PDF document and we need to create an in-memory Appearance with an in-memory Resource Dictionary, where the /Font entry points out to the on-disk Font Subdictionary inside AcroForm->DR.
It would actually be good to save the in-memory appearance as /AP into the document (PDF 2.0 requires this, and a number of existing Okular issues arise from not saving AP). But that's unrelated to the font family issue.


==Work Report==
==Work Report==
Line 20: Line 16:
===Community Bonding Period===
===Community Bonding Period===


During Community Bonding period, I've been in communication with my mentor, discussing various implementation ideas and learning more about the PDF format and the codebase of Okular and Poppler. In the meantime, I have got a KDE developer account, set up a scratch repository to discuss the ideas and share experimental code and explored pertinent bug reports on Bugzilla by taking part in the conversation. As I didn't mention any particular approach for click-to-type typewriter WYSIWYG editing in my GSoC proposal, we had to discuss, experiment and present a couple of ideas to the okular-devel list and would agree upon the community selected one. Further, I set up the working environment and built the project and I'm reading the Qt TextEdit and Poppler Qt5 frontend documentation while consulting with my mentor for the optimal approach to implement the proposed features.
During the Community Bonding period, I've been in communication with my mentor, discussing various implementation ideas and learning more about the PDF format and the codebase of Okular and Poppler. In the meantime, I got a KDE developer account, set up a scratch repository to discuss the ideas and share experimental codes and explored pertinent bug reports on Bugzilla by taking part in the conversation. As I didn't mention any particular approach for click-to-type typewriter WYSIWYG editing in my GSoC proposal, we had to discuss, experiment and present a couple of ideas to the okular-devel list and would agree upon the community selected one. Further, I set up the working environment and built the project and I'm reading the Qt TextEdit and Poppler Qt5 frontend documentation while consulting with my mentor for the optimal approach to implement the proposed features.


===Coding Period - Phase One (May 14th to June 12th)===
===Coding Period - Phase One (May 14th to June 12th)===
Line 34: Line 30:


====Implementation of font color in Poppler and Okular====
====Implementation of font color in Poppler and Okular====
I have patched the poppler-qt5 with the font color by introducing the ‘rg’ operator in the GooString which formats the font color in the RGB color model. In Okular, the font color chooser is introduced in the typewriter annotation setting dialogue which sets both the text annotation’s color and the engine color and hence colorize the typewriter icon color accordingly. The generator side and the doctype XML metadata for saving text color are also adapted. It is well supported in PagePainter too. This is how it works:
I have patched the poppler-qt5 with the font color by introducing the ‘rg’ operator in the GooString which formats the font color in the RGB color model. In Okular, the font color chooser is introduced in the typewriter annotation setting dialogue which sets both the text annotation’s color and the engine color and hence colorizes the typewriter icon color accordingly. The generator side and the doctype XML metadata for saving text color are also adapted. It is well supported in PagePainter too. This is how it works:


[[File:font_color.gif]]
[[File:font_color.gif]]
Patch: [https://bugs.freedesktop.org/attachment.cgi?id=140512 https://bugs.freedesktop.org/attachment.cgi?id=140512]
Patch: [https://bugs.freedesktop.org/attachment.cgi?id=140512 https://bugs.freedesktop.org/attachment.cgi?id=140512]


Line 44: Line 41:


====Create and parse DA string in Poppler Core and font family implementation====
====Create and parse DA string in Poppler Core and font family implementation====
According to my [https://dileepsankhla.com/blog/gsoc-coding-period-phase-three-july-8th-to-august-6th-create-and-parse-da-string-in-poppler-core-and-font-family-implementation blog post], I had to shift the creation and parsing of DA string in poppler-core and so the font color after the second evaluation. So in the final days of GSoC, I worked on font family implementation in Poppler and came up with an [https://bugs.freedesktop.org/attachment.cgi?id=140969 experimental patch] that shows the Base-14 fonts correctly for all the typewriter annotations in the same document. It is just a demo rather than an accurate solution and is very promising for the intuition of accurate solution and the support for the embedded fonts.  
According to my [https://dileep2018gsoc.wordpress.com/2018/08/09/gsoc-coding-period-phase-three-july-8th-to-august-6th-create-and-parse-da-string-in-poppler-core-and-font-family-implementation blog post], I had to shift the creation and parsing of DA string in poppler-core and so the font color after the second evaluation. So in the final days of GSoC, I worked on font-family implementation in Poppler and came up with an [https://bugs.freedesktop.org/attachment.cgi?id=140969 experimental patch] that shows the Base-14 fonts correctly for all the typewriter annotations in the same document. It is just a demo rather than an accurate solution and is very promising for the intuition of accurate solutions and the support for embedded fonts.  
This is how it works:
This is how it works:


[[File:typewriter_final.gif]]
[[File:typewriter_annot_final.gif]]
 
Bug Report: [https://bugs.freedesktop.org/show_bug.cgi?id=81748 https://bugs.freedesktop.org/show_bug.cgi?id=81748]
Bug Report: [https://bugs.freedesktop.org/show_bug.cgi?id=81748 https://bugs.freedesktop.org/show_bug.cgi?id=81748]


Line 55: Line 53:


== Important Links ==
== Important Links ==
=== Proposal Link ===
* [https://dileepsankhla.com/GSoC%20Proposal%20-%20Okular.pdf Project Proposal]


=== Blog Posts ===
=== Blog Posts ===


* [https://dileepsankhla.com/blog/beginning-gsoc-2018 The beginning of GSoC 2018 with KDE]
* [https://dileep2018gsoc.wordpress.com/2018/05/11/freetext-typewriter-annotation-wysiwyg-implementation-ideas FreeText typewriter annotation WYSIWYG implementation ideas]
* [https://dileepsankhla.com/blog/freetext-typewriter-annotation-wysiwyg-implementation-ideas FreeText typewriter annotation WYSIWYG implementation ideas]
* [https://dileep2018gsoc.wordpress.com/2018/06/12/gsoc-coding-period-phase-one-may-14th-to-june-12th-initial-implementation-of-typewriter-annotation-tool-in-okular GSoC Coding Period - Phase One (May 14th to June 12th): Initial implementation of typewriter annotation tool in Okular]
* [https://dileepsankhla.com/blog/gsoc-coding-period-phase-one-may-14th-to-june-12th-initial-implementation-of-typewriter-annotation-tool-in-okular GSoC Coding Period - Phase One (May 14th to June 12th): Initial implementation of typewriter annotation tool in Okular]
* [https://dileep2018gsoc.wordpress.com/2018/07/07/gsoc-coding-period-phase-two-june-13th-to-july-7th-font-color-implementation-in-poppler-and-okular GSoC Coding Period - Phase Two (June 13th to July 7th): Font color implementation in Poppler and Okular]
* [https://dileepsankhla.com/blog/gsoc-coding-period-phase-one-june-13th-to-july-7th-font-color-implementation-in-poppler-and-okular GSoC Coding Period - Phase Two (June 13th to July 7th): Font color implementation in Poppler and Okular]
* [https://dileep2018gsoc.wordpress.com/2018/08/04/im-going-to-akademy-2018-vienna-austria I'm going to Akademy 2018 - Vienna, Austria]
* [https://dileepsankhla.com/blog/im-going-to-akademy-2018-vienna-austria I'm going to Akademy 2018 - Vienna, Austria]
* [https://dileep2018gsoc.wordpress.com/2018/08/09/freetext-annotation-font-family-implementation-in-poppler FreeText Annotation :: Font family implementation in Poppler]
*[https://dileepsankhla.com/blog/freetext-annotation-font-family-implementation-in-poppler FreeText Annotation :: Font family implementation in Poppler]
* [https://dileep2018gsoc.wordpress.com/2018/08/09/gsoc-coding-period-phase-three-july-8th-to-august-6th-create-and-parse-da-string-in-poppler-core-and-font-family-implementation GSoC Coding Period - Phase Three (July 8th to August 6th): Create and parse DA string in Poppler Core and font family implementation]
*[https://dileepsankhla.com/blog/gsoc-coding-period-phase-three-july-8th-to-august-6th-create-and-parse-da-string-in-poppler-core-and-font-family-implementation GSoC Coding Period - Phase Three (July 8th to August 6th): Create and parse DA string in Poppler Core and font family implementation]
* [https://dileep2018gsoc.wordpress.com/2019/03/20/gsoc-2020-for-beginners GSoC 2020 for beginners]
 
=== Youtube Presentation ===
 
* [https://www.youtube.com/watch?v=kdfQs-LgOKo Implementing the FreeText annotation with FreeTextTypewriter behavior | Akademy 2018 Vienna]


== Patches / Published Code ==
=== Patches / Published Code ===


* [https://phabricator.kde.org/D13203 Add Typewriter Annotation Tool in Okular]
* [https://phabricator.kde.org/D13203 Add Typewriter Annotation Tool in Okular]
Line 80: Line 70:
* [https://bugs.freedesktop.org/attachment.cgi?id=140969 (Experimental) Patch to display Base-14 font in typewriter annotations]
* [https://bugs.freedesktop.org/attachment.cgi?id=140969 (Experimental) Patch to display Base-14 font in typewriter annotations]


==  Bug Reports where I'm working ==
===  Bug Reports where I'm working ===


*[https://bugs.freedesktop.org/show_bug.cgi?id=107151 Add font color in Poppler]
*[https://bugs.freedesktop.org/show_bug.cgi?id=107151 Add font color in Poppler]
*[https://bugs.freedesktop.org/show_bug.cgi?id=81748 FreeText annotation ignores font]
*[https://bugs.freedesktop.org/show_bug.cgi?id=81748 FreeText annotation ignores font]


== Scratch GIT repos ==
=== Scratch GIT repos ===


* [https://cgit.kde.org/scratch/dileepsankhla/okular-gsoc2018-typewriter.git okular-gsoc2018-typewriter]
* [https://cgit.kde.org/scratch/dileepsankhla/okular-gsoc2018-typewriter.git okular-gsoc2018-typewriter]
Line 91: Line 81:
== Contact ==
== Contact ==


'''IRC:''' robstat7
'''Email:''' dileepsankhla.ds[at]gmail[dot]com
 
'''Github:''' robstat7

Latest revision as of 22:33, 16 April 2020

Implementing the FreeText annotation with FreeTextTypewriter behavior

Okular is a KDE universal document viewer. It allows reviewing and annotating the PDF documents and supports various text and graphic annotations. FreeText is one of them but the FreeTextTypewriter behavior is still missing to write directly on a PDF page. This project focus on implementing this missing FreeText annotation feature and adding a new ‘Typewriter’ entry in the annotation toolbar.

Mentor: Tobias Deiminger

Project Goals

  • Add a new typewriter icon and settings dialogue to the annotation toolbar.
  • Setting annotation background to transparent, and /IT set to FreeTextTypewriter.
  • Font color implementation in both Okular and Poppler for the FreeText Annotation.
  • Font family implementation in Poppler for the FreeText Annotation.

Work Report

Community Bonding Period

During the Community Bonding period, I've been in communication with my mentor, discussing various implementation ideas and learning more about the PDF format and the codebase of Okular and Poppler. In the meantime, I got a KDE developer account, set up a scratch repository to discuss the ideas and share experimental codes and explored pertinent bug reports on Bugzilla by taking part in the conversation. As I didn't mention any particular approach for click-to-type typewriter WYSIWYG editing in my GSoC proposal, we had to discuss, experiment and present a couple of ideas to the okular-devel list and would agree upon the community selected one. Further, I set up the working environment and built the project and I'm reading the Qt TextEdit and Poppler Qt5 frontend documentation while consulting with my mentor for the optimal approach to implement the proposed features.

Coding Period - Phase One (May 14th to June 12th)

Initial Implementation of Typewriter Annotation Tool in Okular

This phase was devoted to implementing the fully functional typewriter tool that creates the annotation with the transparent background in all the supported document formats and the text input UI in the current implementation is the popup QInputDialog window which is in accordance with the inline note. This is how it works:

A number of integration tests have also been written and the tasks for this phase are completed as planned. For the next phase, I'm aiming at fixing the minor bugs and implementing font color in Poppler where it should also respect the font family.

Coding Period - Phase Two (June 13th to July 7th)

Implementation of font color in Poppler and Okular

I have patched the poppler-qt5 with the font color by introducing the ‘rg’ operator in the GooString which formats the font color in the RGB color model. In Okular, the font color chooser is introduced in the typewriter annotation setting dialogue which sets both the text annotation’s color and the engine color and hence colorizes the typewriter icon color accordingly. The generator side and the doctype XML metadata for saving text color are also adapted. It is well supported in PagePainter too. This is how it works:

Patch: https://bugs.freedesktop.org/attachment.cgi?id=140512

Bug Report: https://bugs.freedesktop.org/show_bug.cgi?id=107151

Coding Period - Phase Three (July 8th to August 6th)

Create and parse DA string in Poppler Core and font family implementation

According to my blog post, I had to shift the creation and parsing of DA string in poppler-core and so the font color after the second evaluation. So in the final days of GSoC, I worked on font-family implementation in Poppler and came up with an experimental patch that shows the Base-14 fonts correctly for all the typewriter annotations in the same document. It is just a demo rather than an accurate solution and is very promising for the intuition of accurate solutions and the support for embedded fonts. This is how it works:

Bug Report: https://bugs.freedesktop.org/show_bug.cgi?id=81748

Branch where I'm working

Important Links

Blog Posts

Patches / Published Code

Bug Reports where I'm working

Scratch GIT repos

Contact

Email: dileepsankhla.ds[at]gmail[dot]com