mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-30 17:14:56 +01:00
Assume PPI=100 (typical value) if info unavailable
This commit is contained in:
parent
b4eca29d3a
commit
55055758fa
3 changed files with 9 additions and 12 deletions
|
@ -417,15 +417,14 @@ zathura_document_get_scale(zathura_document_t* document)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If monitor PPI information is available, use it to match 100% zoom to
|
double ppi = document->view_ppi;
|
||||||
* physical page size */
|
if (ppi < DBL_EPSILON) {
|
||||||
if (document->view_ppi > DBL_EPSILON) {
|
/* No PPI information -> use a typical value */
|
||||||
/* scale = pixels per point, and there are 72 points in one inch */
|
ppi = 100;
|
||||||
return document->zoom * document->view_ppi / 72.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No PPI information -> scale == zoom */
|
/* scale = pixels per point, and there are 72 points in one inch */
|
||||||
return document->zoom;
|
return document->zoom * ppi / 72.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
|
|
|
@ -154,7 +154,7 @@ double zathura_document_get_zoom(zathura_document_t* document);
|
||||||
* PPI)
|
* PPI)
|
||||||
*
|
*
|
||||||
* @param document The document
|
* @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);
|
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);
|
const double width = zathura_page_get_width(page);
|
||||||
|
|
||||||
/* page size in user pixels based on document zoom: if PPI information is
|
/* 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
|
* correct, 100% zoom will result in 72 documents points per inch of screen
|
||||||
* (i.e. document size on screen matching the physical paper size). If PPI
|
* (i.e. document size on screen matching the physical paper size). */
|
||||||
* information is unavailable, the page size in pixels will be 1 pixel per
|
|
||||||
* document point. */
|
|
||||||
const double real_scale = page_calc_height_width(document, height, width,
|
const double real_scale = page_calc_height_width(document, height, width,
|
||||||
&page_height, &page_width,
|
&page_height, &page_width,
|
||||||
false);
|
false);
|
||||||
|
|
Loading…
Reference in a new issue