68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
diff --git a/frontends/monkey/plot.c b/frontends/monkey/plot.c
|
|
--- a/frontends/monkey/plot.c
|
|
+++ b/frontends/monkey/plot.c
|
|
@@ -20,13 +20,21 @@
|
|
|
|
#include "utils/utils.h"
|
|
#include "utils/errors.h"
|
|
+#include "netsurf/browser.h"
|
|
#include "netsurf/plotters.h"
|
|
|
|
#include "monkey/output.h"
|
|
#include "monkey/browser.h"
|
|
|
|
#if defined(__montauk__)
|
|
#include "content/fetchers/montauk_bridge.h"
|
|
+
|
|
+static int native_font_px(plot_style_fixed point_size)
|
|
+{
|
|
+ int pixels = (int)(((int64_t)point_size * browser_get_dpi() +
|
|
+ 36 * PLOT_STYLE_SCALE) / (72 * PLOT_STYLE_SCALE));
|
|
+ return pixels > 0 ? pixels : 1;
|
|
+}
|
|
|
|
struct bitmap {
|
|
void *ptr;
|
|
@@ -70,6 +78,6 @@ static void native_text(struct gui_window *gw, int x, int baseline,
|
|
const char *text, size_t length, const struct plot_font_style *style)
|
|
{
|
|
- int px = plot_style_fixed_to_int(style->size);
|
|
+ int px = native_font_px(style->size);
|
|
if (gw == NULL || gw->pixels == NULL) return;
|
|
mtk_netsurf_font_draw(gw->pixels, gw->width, gw->height,
|
|
gw->clip_x0, gw->clip_y0, gw->clip_x1, gw->clip_y1,
|
|
diff --git a/frontends/monkey/layout.c b/frontends/monkey/layout.c
|
|
--- a/frontends/monkey/layout.c
|
|
+++ b/frontends/monkey/layout.c
|
|
@@ -25,13 +25,21 @@
|
|
#include <stddef.h>
|
|
|
|
#include "utils/utf8.h"
|
|
+#include "netsurf/browser.h"
|
|
#include "netsurf/plot_style.h"
|
|
#include "netsurf/layout.h"
|
|
|
|
#include "monkey/layout.h"
|
|
|
|
#if defined(__montauk__)
|
|
#include "content/fetchers/montauk_bridge.h"
|
|
+
|
|
+static int native_font_px(plot_style_fixed point_size)
|
|
+{
|
|
+ int pixels = (int)(((int64_t)point_size * browser_get_dpi() +
|
|
+ 36 * PLOT_STYLE_SCALE) / (72 * PLOT_STYLE_SCALE));
|
|
+ return pixels > 0 ? pixels : 1;
|
|
+}
|
|
#endif
|
|
|
|
static int font_width(const plot_font_style_t *fstyle,
|
|
@@ -38,7 +46,7 @@ static int font_width(const plot_font_style_t *fstyle,
|
|
{
|
|
#if defined(__montauk__)
|
|
return mtk_netsurf_font_width(fstyle->family, fstyle->weight,
|
|
- fstyle->flags, plot_style_fixed_to_int(fstyle->size), string, length);
|
|
+ fstyle->flags, native_font_px(fstyle->size), string, length);
|
|
#else
|
|
return (fstyle->size * utf8_bounded_length(string, length)) / PLOT_STYLE_SCALE;
|
|
#endif
|