mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-30 02:34: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;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
|
Loading…
Reference in a new issue