From 1bc9a86109da9c5b675e24af566febf6be72e71c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Fri, 22 Apr 2011 16:48:29 +0000 Subject: Aspect-corrected font DPI. Needs testing on a mode with non-square pixels and on a widescreen monitor. svn path=/trunk/netsurf/; revision=12230 --- amiga/font.c | 55 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 15 deletions(-) (limited to 'amiga') diff --git a/amiga/font.c b/amiga/font.c index d40726440..86429ee4b 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -17,26 +17,31 @@ */ #include -#include "css/css.h" -#include "render/font.h" -#include "amiga/gui.h" -#include -#include -#include + #include "amiga/font.h" -#include "desktop/options.h" +#include "amiga/gui.h" #include "amiga/utf8.h" +#include "amiga/options.h" +#include "css/css.h" +#include "css/utils.h" +#include "render/font.h" +#include "utils/log.h" #include "utils/utf8.h" +#include "utils/utils.h" + +#include +#include +#include +#include +#include + #include #include -#include -#include +#include + #ifdef __amigaos4__ #include #endif -#include "amiga/options.h" -#include -#include "utils/utils.h" #define NSA_UNICODE_FONT PLOT_FONT_FAMILY_COUNT @@ -613,9 +618,29 @@ void ami_close_fonts(void) } } -ULONG ami_font_setdevicedpi(int dpi) +void ami_font_setdevicedpi(int id) { - ami_devicedpi = (dpi<<16) | dpi; + DisplayInfoHandle dih; + struct DisplayInfo dinfo; + Point dinfo_res; + ULONG ydpi = FIXTOINT(nscss_screen_dpi); + ULONG xdpi = ydpi; + + if(id) + { + if(dih = FindDisplayInfo(id)) + { + if(GetDisplayInfoData(dih, &dinfo, sizeof(struct DisplayInfo), + DTAG_DISP, 0)) + { + dinfo_res = dinfo.Resolution; + xdpi = (dinfo_res.y / dinfo_res.x) * ydpi; + + LOG(("XDPI = %ld, YDPI = %ld (DisplayInfo resolution %ld x %ld)", + xdpi, ydpi, dinfo_res.x , dinfo_res.y)); + } + } + } - return ami_devicedpi; + ami_devicedpi = (xdpi << 16) | ydpi; } -- cgit v1.2.3