D12672: Use a target in FindDiscount (modern cmake) rather than variables

2018-05-07 Thread Aleix Pol Gonzalez
apol accepted this revision.
apol added a comment.
This revision is now accepted and ready to land.


  It's actually fixing the build when discount is in its own prefix.
  
  Also I agree that it's better using targets.

REPOSITORY
  R223 Okular

BRANCH
  Applications/18.04

REVISION DETAIL
  https://phabricator.kde.org/D12672

To: svuorela, kde-buildsystem, apol
Cc: apol, aacid, #okular, ngraham


D12672: Use a target in FindDiscount (modern cmake) rather than variables

2018-05-07 Thread Albert Astals Cid
aacid added a comment.


  If noone disagrees i guess you can commit this in one week or so, i don't 
really have enough knowledge to discuss if this is better or worse.

REPOSITORY
  R223 Okular

REVISION DETAIL
  https://phabricator.kde.org/D12672

To: svuorela, kde-buildsystem
Cc: aacid, #okular, ngraham


[okular] [Bug 393972] New: Okular Does not print PDF 1:1 scale

2018-05-07 Thread Ted Becker
https://bugs.kde.org/show_bug.cgi?id=393972

Bug ID: 393972
   Summary: Okular Does not print PDF 1:1 scale
   Product: okular
   Version: 1.3.3
  Platform: Kubuntu Packages
OS: Linux
Status: UNCONFIRMED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: okular-devel@kde.org
  Reporter: rail.b...@att.net
  Target Milestone: ---

Created attachment 112488
  --> https://bugs.kde.org/attachment.cgi?id=112488&action=edit
PDF Template that should print to proper scale.

PDF printed image is approximately 92% of full size.  PDF is displayed properly
to scale on screen.  Margins are are adequate for printer.  Paper size and
orientation are set properly. Setting margins to 0.0 in printer properties has
no effect.

Printer is Brother HL-L2300D
Driver is current.
OS  Kubuntu 18.04
KDE Plasman 5.12.4
Okular 1.3.3
Paper set to Letter, Lanscape

-- 
You are receiving this mail because:
You are the assignee for the bug.

Re: Queries regarding terminologies used in Okular PDF annotation rendering

2018-05-07 Thread Tobias Deiminger

Hi Dileep,

Am 07.05.2018 13:30 schrieb Dileep Sankhla:

Hi there,

Please try to answer my following queries:

1. What is "viewport"?


the viewport is a child widget of the PageView widget and contains the 
visible part of the content area. Look at okular_ui_areas.png [0] which 
should make it all clear. PageView inherits from QAbstractScrollArea, so 
find viewport documented in Qt docs [1].



2. What is "pageview"?


It's the heart of the desktop document UI (btw, there's also an 
unrelated mobile UI in mobile/*). class PageView is defined in 
ui/pageview.{h,cc}. It's a custom QWidget that makes data and logic from 
the core model (core/*) visible und usable. PageView receives most user 
input events (mouse click, key stroke, ...) and handles how pages are 
drawn, scrolled and scaled. It handles also a lot of additional features 
like tooltips and selections. Some functions are delegated to aggregated 
objects like PageViewItem (one per page) or child widgets. But most of 
the UI stuff is directly handled and painted by PageView.



3. How does PDF save an annotation in the document?


The question is quite broad and unspecific, can you please rework it?

We both already did an example program that composed a PDF and you 
analysed the decompressed PDF at low level and saw the annotation 
dictionaries. You also have the PDF standard and Leonards book [2] at 
hand. I bet you could mostly answer your own question ;-) You have to 
understand some basic PDF constructs like direct and indirect objects, 
the types (dictionaries, arrays, ...), content streams, resource 
dictionaries and what the cross reference table is. Then the 
decompressed output becomes meaningful in your mind.



4. What is "generator" and how does generator render the annotation in


See [3]. class Generator is a (almost pure virtual) Okular interface 
that abstracts the various file formats (pdf, djvu, epub, dvi, txt, 
...). The various concrete generators are implemented in 
generators//*. Each is compiled into a separate shared 
object that can be loaded as QT plugin at runtime. Often generators just 
forward calls to external libraries like poppler and DjVuLibre where the 
heavy lifting is done. The Generator interface is used by class 
Document. E.g. class Document calls Generator::loadDocument and 
Generator::generatePixmap. So Document doesn't need to know about the 
file format, but only about the Generator interface.



PDF page? What is the meaning of "rendering" here?


A PDF file contains various kinds of drawing instructions and objects of 
well defined types. You could say PDF is something like a programming 
language. Rendering here means interpreting this "PDF program" (poppler 
has actually Lexer.cc and Parser.cc) and perform all calculations, so 
that finally a bitmap gets constructed, pixel by pixel.


Use gdb to break into Poppler::renderToImage and watch what's going on. 
Within, you should sometime reach Annot::draw which is about rendering 
one Annotation.



5. Now how does poppler render the annotation on the PDF page? Is it
same as the working of the Okular generator?


I'm not sure if I understand the question. Document::requestPixmaps 
requests a pixmap from the Generator. It sets up a PixmapRequest and 
calls Generator::generatePixmap therefore. In the case of PDF Generator, 
the generator then calls Poppler::rednerPageToImage which returns a 
QImage that shows one page. The generator turns this QImage into a 
QPixmap and then signals to Document that generation has been finished 
by means of calling Document::requestDone(). There QPixmap is extracted 
from the PixmapRequest and stored in Document::m_allocatedPixmaps. With 
the next PageView::paintEvent the new Document pixmaps are painted. This 
was a really simplified description. Requests can be asynchronous, and 
instead of rendering the whole page a page can be rendered as several 
smaller images by means of a TilesManager.



6. What does "painting" actually mean? And so what does
"PageView::paintevent" do?


Painting here means to call methods on a QPainter, like 
QPainter::drawPath or QPainter::drawPixmap. It results in graphics on 
the screen, or in a buffer, or somewhere else.


PageView inherits from QWidget. One of the most popular methods of each 
QWidget is QWidget::paintEvent, see Qt docs [4]. This method is called 
by Qt (or your own code), every time a repaint is required. Qt's off the 
shelf widgets have this method readily implemented. But PageView paints 
highly customized and so PageView overrides QWidget::paintEvent to 
provide its own implementation. In the longish path through 
PageView::paintEvent, PageView::drawDocumentOnPainter and 
PagePainter::paintCroppedPageOnPainter we paint the page tiles received 
from generator. We also mix in other graphical items that are not 
delivered by generators (tooltip, move/selection rectangle, ...). If you 
stumble upon "double buffered" or "backbuffering", this just means that 
Okular draws a b

Queries regarding terminologies used in Okular PDF annotation rendering

2018-05-07 Thread Dileep Sankhla
Hi there,

Please try to answer my following queries:

1. What is "viewport"?

2. What is "pageview"?

3. How does PDF save an annotation in the document?

4. What is "generator" and how does generator render the annotation in PDF
page? What is the meaning of "rendering" here?

5. Now how does poppler render the annotation on the PDF page? Is it same
as the working of the Okular generator?

6. What does "painting" actually mean? And so what does
"PageView::paintevent" do?

I have a messed up knowledge of these subjects and I want a clarity in my
mind so that I can understand my work and can continue to develop.

Thanks and Regards
Dileep



‌