Commit 55055758 authored by Jeremie Knuesel's avatar Jeremie Knuesel

Assume PPI=100 (typical value) if info unavailable

parent b4eca29d
......@@ -417,15 +417,14 @@ zathura_document_get_scale(zathura_document_t* document)
return 0;
}
/* If monitor PPI information is available, use it to match 100% zoom to
* physical page size */
if (document->view_ppi > DBL_EPSILON) {
/* scale = pixels per point, and there are 72 points in one inch */
return document->zoom * document->view_ppi / 72.0;
double ppi = document->view_ppi;
if (ppi < DBL_EPSILON) {
/* No PPI information -> use a typical value */
ppi = 100;
}
/* No PPI information -> scale == zoom */
return document->zoom;
/* scale = pixels per point, and there are 72 points in one inch */
return document->zoom * ppi / 72.0;
}
unsigned int
......
......@@ -154,7 +154,7 @@ double zathura_document_get_zoom(zathura_document_t* document);
* PPI)
*
* @param document The document
* @return The current scale value
* @return The current scale value, in pixels per point
*/
double zathura_document_get_scale(zathura_document_t* document);
......
......@@ -741,10 +741,8 @@ render(render_job_t* job, ZathuraRenderRequest* request, ZathuraRenderer* render
const double width = zathura_page_get_width(page);
/* page size in user pixels based on document zoom: if PPI information is
* available, 100% zoom results in 72 documents points per inch of screen
* (i.e. document size on screen matching the physical paper size). If PPI
* information is unavailable, the page size in pixels will be 1 pixel per
* document point. */
* correct, 100% zoom will result in 72 documents points per inch of screen
* (i.e. document size on screen matching the physical paper size). */
const double real_scale = page_calc_height_width(document, height, width,
&page_height, &page_width,
false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment