NetSurf
browser.c
Go to the documentation of this file.
1/*
2 * Copyright 2019 Vincent Sanders <vince@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 *
22 * Browser core functionality
23 */
24
25#include "utils/errors.h"
26#include "utils/log.h"
27#include "utils/utils.h"
28#include "netsurf/browser.h"
29#include "css/utils.h"
30
31/* exported interface documented in netsurf/browser.h */
33{
34 if (dpi < 72 || dpi > 250) {
35 int bad = dpi;
36 dpi = min(max(dpi, 72), 250);
37 NSLOG(netsurf, INFO, "Clamping invalid DPI %d to %d", bad, dpi);
38 }
39 nscss_screen_dpi = INTTOFIX(dpi);
40
41 return NSERROR_OK;
42}
43
44/* exported interface documented in netsurf/browser.h */
46{
47 return FIXTOINT(nscss_screen_dpi);
48}
css_fixed nscss_screen_dpi
Screen DPI in fixed point units: defaults to 90, which RISC OS uses.
Definition: css.c:44
int browser_get_dpi(void)
Get the browser DPI.
Definition: browser.c:45
nserror browser_set_dpi(int dpi)
Set the DPI of the browser.
Definition: browser.c:32
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_OK
No error.
Definition: errors.h:30
Browser interfaces.
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
Interface to a number of general purpose functionality.
#define min(x, y)
Definition: utils.h:46
#define max(x, y)
Definition: utils.h:50