From 7dab7cb43d4091648ceb40684ff70aff7091c648 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 13 Jan 2017 10:01:25 +0000 Subject: [PATCH] move plot style header to netsurf include directory move plotter style header and adjust all callers to use only what they actually require. --- Docs/core-window-interface | 2 +- content/handlers/css/select.c | 1 + desktop/browser_private.h | 3 +- desktop/font_haru.h | 1 - desktop/knockout.c | 2 +- desktop/options.h | 2 +- desktop/plot_style.c | 6 +- desktop/scrollbar.c | 6 +- desktop/system_colour.h | 2 +- desktop/textarea.h | 3 +- frontends/amiga/corewindow.c | 2 +- frontends/atari/plot/font_freetype.c | 2 +- frontends/atari/plot/font_internal.c | 2 +- frontends/atari/plot/fontplot.c | 2 +- frontends/atari/settings.c | 2 +- frontends/atari/toolbar.c | 1 - frontends/beos/font.h | 2 +- frontends/cocoa/font.h | 2 +- frontends/cocoa/plotter.h | 2 +- frontends/cocoa/plotter.m | 1 - frontends/framebuffer/convert_image.c | 2 +- frontends/framebuffer/fbtk.h | 2 +- frontends/framebuffer/fbtk/user.c | 1 - frontends/framebuffer/font_freetype.c | 1 + frontends/framebuffer/font_internal.c | 1 + frontends/gtk/corewindow.c | 2 +- frontends/gtk/layout_pango.c | 1 + frontends/monkey/layout.c | 2 +- frontends/riscos/configure/con_fonts.c | 2 +- frontends/riscos/font.c | 1 + frontends/riscos/font.h | 5 +- frontends/riscos/image.h | 2 +- frontends/windows/corewindow.c | 1 - frontends/windows/font.c | 1 + frontends/windows/font.h | 4 +- include/netsurf/clipboard.h | 2 +- include/netsurf/content.h | 2 +- {desktop => include/netsurf}/plot_style.h | 141 +++++++++++----------- include/netsurf/plotters.h | 2 +- include/netsurf/types.h | 2 + render/box_construct.c | 5 +- render/font.c | 1 + render/font.h | 4 +- render/form.c | 9 +- render/html.h | 5 +- utils/nsoption.c | 2 +- 46 files changed, 126 insertions(+), 123 deletions(-) rename {desktop => include/netsurf}/plot_style.h (94%) diff --git a/Docs/core-window-interface b/Docs/core-window-interface index 0267f3752..3dfbcaf47 100644 --- a/Docs/core-window-interface +++ b/Docs/core-window-interface @@ -259,7 +259,7 @@ frontends/example/corewindow.c #include "utils/utf8.h" #include "netsurf/keypress.h" #include "netsurf/mouse.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" /* extremely likely there will be additional headers required in a real frontend */ #include "example/corewindow.h" diff --git a/content/handlers/css/select.c b/content/handlers/css/select.c index aaede7727..daa3b4087 100644 --- a/content/handlers/css/select.c +++ b/content/handlers/css/select.c @@ -24,6 +24,7 @@ #include "utils/corestrings.h" #include "utils/log.h" #include "utils/nsurl.h" +#include "netsurf/plot_style.h" #include "netsurf/url_db.h" #include "desktop/system_colour.h" diff --git a/desktop/browser_private.h b/desktop/browser_private.h index 64c698beb..072a894d6 100644 --- a/desktop/browser_private.h +++ b/desktop/browser_private.h @@ -26,9 +26,10 @@ #include +#include "netsurf/types.h" #include "netsurf/browser_window.h" + #include "desktop/frame_types.h" -#include "desktop/plot_style.h" struct box; struct hlcache_handle; diff --git a/desktop/font_haru.h b/desktop/font_haru.h index 479f7deb0..988b9ba0a 100644 --- a/desktop/font_haru.h +++ b/desktop/font_haru.h @@ -26,7 +26,6 @@ #include -#include "desktop/plot_style.h" #include "desktop/font.h" bool haru_nsfont_apply_style(const plot_font_style_t *fstyle, diff --git a/desktop/knockout.c b/desktop/knockout.c index b930ef673..bcfc272eb 100644 --- a/desktop/knockout.c +++ b/desktop/knockout.c @@ -71,10 +71,10 @@ #include "utils/errors.h" #include "netsurf/bitmap.h" #include "content/content.h" +#include "netsurf/plotters.h" #include "desktop/gui_internal.h" #include "desktop/knockout.h" -#include "netsurf/plotters.h" /* Define to enable knockout debug */ #undef KNOCKOUT_DEBUG diff --git a/desktop/options.h b/desktop/options.h index 437d104e9..d91898c6e 100644 --- a/desktop/options.h +++ b/desktop/options.h @@ -30,7 +30,7 @@ #ifndef _NETSURF_DESKTOP_OPTIONS_H_ #define _NETSURF_DESKTOP_OPTIONS_H_ -#include "desktop/plot_style.h" +#include "netsurf/types.h" /* defines for system colour table */ #define NSOPTION_SYS_COLOUR_START NSOPTION_sys_colour_ActiveBorder diff --git a/desktop/plot_style.c b/desktop/plot_style.c index 1e6a9110e..1f0ac39cf 100644 --- a/desktop/plot_style.c +++ b/desktop/plot_style.c @@ -16,14 +16,14 @@ * along with this program. If not, see . */ -/** - * \file desktop/plot_style.c +/** + * \file * \brief Plotter global styles. * * These plot styles are globaly available and used in many places. */ -#include "netsurf/plotters.h" +#include "netsurf/plot_style.h" static plot_style_t plot_style_fill_white_static = { .fill_type = PLOT_OP_TYPE_SOLID, diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c index b9e963a26..9a4d70fe4 100644 --- a/desktop/scrollbar.c +++ b/desktop/scrollbar.c @@ -29,14 +29,12 @@ #include "utils/messages.h" #include "utils/utils.h" #include "utils/nsoption.h" - #include "netsurf/browser_window.h" -#include "desktop/system_colour.h" #include "netsurf/mouse.h" -#include "desktop/scrollbar.h" #include "netsurf/plotters.h" -#include "desktop/plot_style.h" +#include "desktop/system_colour.h" +#include "desktop/scrollbar.h" struct scrollbar { bool horizontal; /* Horizontal scrollbar if true, else vertical diff --git a/desktop/system_colour.h b/desktop/system_colour.h index b5d4baad4..8e82818aa 100644 --- a/desktop/system_colour.h +++ b/desktop/system_colour.h @@ -26,7 +26,7 @@ #include #include "utils/errors.h" -#include "desktop/plot_style.h" +#include "netsurf/types.h" /** css callback to obtain named system colours. */ css_error ns_system_colour(void *pw, lwc_string *name, css_color *color); diff --git a/desktop/textarea.h b/desktop/textarea.h index 74652f3a1..19162ff1b 100644 --- a/desktop/textarea.h +++ b/desktop/textarea.h @@ -28,8 +28,7 @@ #include #include "utils/utils.h" - -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "netsurf/mouse.h" struct textarea; diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c index d2bfbf982..0ed16d1ee 100644 --- a/frontends/amiga/corewindow.c +++ b/frontends/amiga/corewindow.c @@ -44,7 +44,7 @@ #include "utils/utf8.h" #include "netsurf/keypress.h" #include "netsurf/mouse.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include #include diff --git a/frontends/atari/plot/font_freetype.c b/frontends/atari/plot/font_freetype.c index 602820704..8b535e3a3 100644 --- a/frontends/atari/plot/font_freetype.c +++ b/frontends/atari/plot/font_freetype.c @@ -25,7 +25,7 @@ #include "utils/log.h" #include "utils/nsoption.h" #include "netsurf/mouse.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "atari/gui.h" #include "atari/bitmap.h" diff --git a/frontends/atari/plot/font_internal.c b/frontends/atari/plot/font_internal.c index b96f4c773..6a811e38b 100644 --- a/frontends/atari/plot/font_internal.c +++ b/frontends/atari/plot/font_internal.c @@ -25,7 +25,7 @@ #include "utils/utf8.h" #include "utils/log.h" #include "netsurf/mouse.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "atari/gui.h" #include "atari/bitmap.h" diff --git a/frontends/atari/plot/fontplot.c b/frontends/atari/plot/fontplot.c index d0a1fe16f..2e02b50b4 100644 --- a/frontends/atari/plot/fontplot.c +++ b/frontends/atari/plot/fontplot.c @@ -22,7 +22,7 @@ #include #include "netsurf/mouse.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "atari/bitmap.h" #include "atari/plot/fontplot.h" diff --git a/frontends/atari/settings.c b/frontends/atari/settings.c index b6df12760..5759a894a 100644 --- a/frontends/atari/settings.c +++ b/frontends/atari/settings.c @@ -32,7 +32,7 @@ #include "utils/dirent.h" #include "utils/nsoption.h" #include "utils/log.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "atari/gui.h" #include "atari/res/netsurf.rsh" diff --git a/frontends/atari/toolbar.c b/frontends/atari/toolbar.c index 66bd44b98..9ed87849c 100644 --- a/frontends/atari/toolbar.c +++ b/frontends/atari/toolbar.c @@ -35,7 +35,6 @@ #include "netsurf/mouse.h" #include "netsurf/plotters.h" #include "netsurf/keypress.h" -#include "desktop/plot_style.h" #include "desktop/browser_history.h" #include "desktop/hotlist.h" #include "desktop/textarea.h" diff --git a/frontends/beos/font.h b/frontends/beos/font.h index 63909efcf..285ba9c40 100644 --- a/frontends/beos/font.h +++ b/frontends/beos/font.h @@ -24,7 +24,7 @@ #ifndef NS_BEOS_FONT_H #define NS_BEOS_FONT_H -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" bool nsfont_paint(const plot_font_style_t *fstyle, const char *string, size_t length, diff --git a/frontends/cocoa/font.h b/frontends/cocoa/font.h index cabd2b933..ed0479765 100644 --- a/frontends/cocoa/font.h +++ b/frontends/cocoa/font.h @@ -19,7 +19,7 @@ #ifndef COCOA_FONT_H #define COCOA_FONT_H -#import "desktop/plot_style.h" +#import "netsurf/plot_style.h" void cocoa_draw_string( CGFloat x, CGFloat y, const char *bytes, size_t length, const struct plot_font_style *style ); diff --git a/frontends/cocoa/plotter.h b/frontends/cocoa/plotter.h index 88f9fcab6..ce4865336 100644 --- a/frontends/cocoa/plotter.h +++ b/frontends/cocoa/plotter.h @@ -20,7 +20,7 @@ #define COCOA_PLOTTER_H #import -#import "desktop/plot_style.h" +#import "netsurf/plot_style.h" extern const struct plotter_table cocoa_plotters; diff --git a/frontends/cocoa/plotter.m b/frontends/cocoa/plotter.m index 20b688414..dea3245bb 100644 --- a/frontends/cocoa/plotter.m +++ b/frontends/cocoa/plotter.m @@ -22,7 +22,6 @@ #import "utils/utils.h" #import "netsurf/browser_window.h" #import "netsurf/plotters.h" -#import "desktop/plot_style.h" #import "cocoa/font.h" #import "cocoa/coordinates.h" diff --git a/frontends/framebuffer/convert_image.c b/frontends/framebuffer/convert_image.c index 2608328ff..de772fc29 100644 --- a/frontends/framebuffer/convert_image.c +++ b/frontends/framebuffer/convert_image.c @@ -262,7 +262,7 @@ main(int argc, char **argv) fprintf(f, "#include \n\n"); fprintf(f, "#include \n\n"); fprintf(f, "#include \n\n"); - fprintf(f, "#include \"desktop/plot_style.h\"\n"); + fprintf(f, "#include \"netsurf/plot_style.h\"\n"); fprintf(f, "#include \"framebuffer/gui.h\"\n"); fprintf(f, "#include \"framebuffer/fbtk.h\"\n\n"); diff --git a/frontends/framebuffer/fbtk.h b/frontends/framebuffer/fbtk.h index fe4f5a564..3cc326cef 100644 --- a/frontends/framebuffer/fbtk.h +++ b/frontends/framebuffer/fbtk.h @@ -19,7 +19,7 @@ #ifndef NETSURF_FB_FBTK_H #define NETSURF_FB_FBTK_H -#include "desktop/plot_style.h" +#include "netsurf/types.h" #ifdef FBTK_LOGGING #define FBTK_LOG(x) LOG(x) diff --git a/frontends/framebuffer/fbtk/user.c b/frontends/framebuffer/fbtk/user.c index 2b9cc8768..de547ab46 100644 --- a/frontends/framebuffer/fbtk/user.c +++ b/frontends/framebuffer/fbtk/user.c @@ -22,7 +22,6 @@ #include #include -#include "desktop/plot_style.h" #include "framebuffer/gui.h" #include "framebuffer/fbtk.h" diff --git a/frontends/framebuffer/font_freetype.c b/frontends/framebuffer/font_freetype.c index 323982014..ccc60ea47 100644 --- a/frontends/framebuffer/font_freetype.c +++ b/frontends/framebuffer/font_freetype.c @@ -30,6 +30,7 @@ #include "netsurf/utf8.h" #include "netsurf/layout.h" #include "netsurf/browser_window.h" +#include "netsurf/plot_style.h" #include "framebuffer/gui.h" #include "framebuffer/font.h" diff --git a/frontends/framebuffer/font_internal.c b/frontends/framebuffer/font_internal.c index 3fd3ac6ef..3b8a1c43f 100644 --- a/frontends/framebuffer/font_internal.c +++ b/frontends/framebuffer/font_internal.c @@ -26,6 +26,7 @@ #include "utils/utf8.h" #include "netsurf/utf8.h" #include "netsurf/layout.h" +#include "netsurf/plot_style.h" #include "framebuffer/gui.h" #include "framebuffer/font.h" diff --git a/frontends/gtk/corewindow.c b/frontends/gtk/corewindow.c index 9f66ef1ca..8af19588f 100644 --- a/frontends/gtk/corewindow.c +++ b/frontends/gtk/corewindow.c @@ -42,9 +42,9 @@ #include "utils/utils.h" #include "utils/messages.h" #include "utils/utf8.h" +#include "netsurf/types.h" #include "netsurf/keypress.h" #include "netsurf/mouse.h" -#include "desktop/plot_style.h" #include "gtk/compat.h" #include "gtk/gui.h" /* just for gtk_gui_gdkkey_to_nskey */ diff --git a/frontends/gtk/layout_pango.c b/frontends/gtk/layout_pango.c index a0196df9b..7c7190982 100644 --- a/frontends/gtk/layout_pango.c +++ b/frontends/gtk/layout_pango.c @@ -31,6 +31,7 @@ #include "utils/log.h" #include "utils/nsoption.h" #include "netsurf/layout.h" +#include "netsurf/plot_style.h" #include "gtk/layout_pango.h" #include "gtk/plotters.h" diff --git a/frontends/monkey/layout.c b/frontends/monkey/layout.c index 00ed9dff3..4bcc51b68 100644 --- a/frontends/monkey/layout.c +++ b/frontends/monkey/layout.c @@ -24,7 +24,7 @@ #include #include "utils/utf8.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "netsurf/layout.h" #include "monkey/layout.h" diff --git a/frontends/riscos/configure/con_fonts.c b/frontends/riscos/configure/con_fonts.c index 280312843..ecbf396c2 100644 --- a/frontends/riscos/configure/con_fonts.c +++ b/frontends/riscos/configure/con_fonts.c @@ -21,7 +21,7 @@ #include "utils/nsoption.h" #include "utils/messages.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "riscos/gui.h" #include "riscos/font.h" diff --git a/frontends/riscos/font.c b/frontends/riscos/font.c index a7a394e2d..560afc785 100644 --- a/frontends/riscos/font.c +++ b/frontends/riscos/font.c @@ -35,6 +35,7 @@ #include "utils/messages.h" #include "utils/utils.h" #include "netsurf/layout.h" +#include "netsurf/plot_style.h" #include "riscos/gui.h" #include "riscos/font.h" diff --git a/frontends/riscos/font.h b/frontends/riscos/font.h index 0319a7ee3..a29bad83a 100644 --- a/frontends/riscos/font.h +++ b/frontends/riscos/font.h @@ -25,6 +25,7 @@ #include +struct plot_font_style; struct gui_layout_table *riscos_layout_table; /** desktop font, size and style being used */ @@ -35,9 +36,9 @@ extern rufl_style ro_gui_desktop_font_style; void nsfont_init(void); bool nsfont_exists(const char *font_family); const char *nsfont_fallback_font(void); -bool nsfont_paint(const plot_font_style_t *fstyle, const char *string, +bool nsfont_paint(const struct plot_font_style *fstyle, const char *string, size_t length, int x, int y); -void nsfont_read_style(const plot_font_style_t *fstyle, +void nsfont_read_style(const struct plot_font_style *fstyle, const char **font_family, unsigned int *font_size, rufl_style *font_style); void ro_gui_wimp_get_desktop_font(void); diff --git a/frontends/riscos/image.h b/frontends/riscos/image.h index a11388c13..2ed3e180d 100644 --- a/frontends/riscos/image.h +++ b/frontends/riscos/image.h @@ -20,7 +20,7 @@ #define _NETSURF_RISCOS_IMAGE_H_ #include -#include "desktop/plot_style.h" +#include "netsurf/types.h" #include "oslib/osspriteop.h" struct osspriteop_area; diff --git a/frontends/windows/corewindow.c b/frontends/windows/corewindow.c index 8d853fb23..ff89d9271 100644 --- a/frontends/windows/corewindow.c +++ b/frontends/windows/corewindow.c @@ -43,7 +43,6 @@ #include "utils/utf8.h" #include "netsurf/keypress.h" #include "netsurf/mouse.h" -#include "desktop/plot_style.h" #include "windows/windbg.h" #include "windows/corewindow.h" diff --git a/frontends/windows/font.c b/frontends/windows/font.c index 1e99a78d6..791b8cd5c 100644 --- a/frontends/windows/font.c +++ b/frontends/windows/font.c @@ -32,6 +32,7 @@ #include "utils/utf8.h" #include "netsurf/layout.h" #include "netsurf/utf8.h" +#include "netsurf/plot_style.h" #include "windows/font.h" diff --git a/frontends/windows/font.h b/frontends/windows/font.h index 0e867554a..a1077e041 100644 --- a/frontends/windows/font.h +++ b/frontends/windows/font.h @@ -25,6 +25,8 @@ #ifndef NETSURF_WINDOWS_FONT_H #define NETSURF_WINDOWS_FONT_H +struct plot_font_style; + extern HWND font_hwnd; struct font_desc { @@ -47,7 +49,7 @@ extern nserror utf8_to_font_encoding(const struct font_desc* font, * \param style The font style. * \return The win32 font handle */ -HFONT get_font(const plot_font_style_t *style); +HFONT get_font(const struct plot_font_style *style); #endif /* NETSURF_WINDOWS_FONT_H */ diff --git a/include/netsurf/clipboard.h b/include/netsurf/clipboard.h index d90ebc4cb..ab8d10aa7 100644 --- a/include/netsurf/clipboard.h +++ b/include/netsurf/clipboard.h @@ -28,7 +28,7 @@ #include #include "utils/errors.h" -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" typedef struct nsnsclipboard_styles { size_t start; /**< Start of run */ diff --git a/include/netsurf/content.h b/include/netsurf/content.h index 35b8b3365..5eee59acd 100644 --- a/include/netsurf/content.h +++ b/include/netsurf/content.h @@ -28,7 +28,7 @@ #include -#include "desktop/plot_style.h" /* color typedef */ +#include "netsurf/types.h" #include "netsurf/content_type.h" struct bitmap; diff --git a/desktop/plot_style.h b/include/netsurf/plot_style.h similarity index 94% rename from desktop/plot_style.h rename to include/netsurf/plot_style.h index 15327f372..30db3663e 100644 --- a/desktop/plot_style.h +++ b/include/netsurf/plot_style.h @@ -16,28 +16,88 @@ * along with this program. If not, see . */ -/** \file - * Plotter styles. +/** + * \file + * plotter style interfaces, generic styles and style colour helpers. */ -#ifndef _NETSURF_DESKTOP_PLOT_STYLE_H_ -#define _NETSURF_DESKTOP_PLOT_STYLE_H_ +#ifndef NETSURF_PLOT_STYLE_H +#define NETSURF_PLOT_STYLE_H #include #include "netsurf/types.h" -/* html widget colours */ /** light grey widget base colour */ #define WIDGET_BASEC 0xd9d9d9 /** black blob colour */ #define WIDGET_BLOBC 0x000000 -/** - * Transparent value - */ +/** Transparent colour value. */ #define NS_TRANSPARENT 0x01000000 +/** Scaling factor for font sizes */ +#define FONT_SIZE_SCALE 1024 + +/** + * Type of plot operation + */ +typedef enum { + PLOT_OP_TYPE_NONE = 0, /**< No operation */ + PLOT_OP_TYPE_SOLID, /**< Solid colour */ + PLOT_OP_TYPE_DOT, /**< Dotted plot */ + PLOT_OP_TYPE_DASH, /**< Dashed plot */ +} plot_operation_type_t; + + +/** + * Plot style for stroke/fill plotters + */ +typedef struct plot_style_s { + plot_operation_type_t stroke_type; /**< Stroke plot type */ + int stroke_width; /**< Width of stroke, in pixels */ + colour stroke_colour; /**< Colour of stroke */ + plot_operation_type_t fill_type; /**< Fill plot type */ + colour fill_colour; /**< Colour of fill */ +} plot_style_t; + + +/** + * Generic font family type + */ +typedef enum { + PLOT_FONT_FAMILY_SANS_SERIF = 0, + PLOT_FONT_FAMILY_SERIF, + PLOT_FONT_FAMILY_MONOSPACE, + PLOT_FONT_FAMILY_CURSIVE, + PLOT_FONT_FAMILY_FANTASY, + PLOT_FONT_FAMILY_COUNT /**< Number of generic families */ +} plot_font_generic_family_t; + + +/** + * Font plot flags + */ +typedef enum { + FONTF_NONE = 0, + FONTF_ITALIC = 1, + FONTF_OBLIQUE = 2, + FONTF_SMALLCAPS = 4, +} plot_font_flags_t; + +/** + * Font style for plotting + */ +typedef struct plot_font_style { + plot_font_generic_family_t family; /**< Generic family to plot with */ + int size; /**< Font size, in points * FONT_SIZE_SCALE */ + int weight; /**< Font weight: value in range [100,900] as per CSS */ + plot_font_flags_t flags; /**< Font flags */ + colour background; /**< Background colour to blend to, if appropriate */ + colour foreground; /**< Colour of text */ +} plot_font_style_t; + + /* Darken a colour by taking three quarters of each channel's intensity */ #define darken_colour(c1) \ ((((3 * (c1 & 0xff00ff)) >> 2) & 0xff00ff) | \ @@ -100,71 +160,6 @@ ((c >> 16) & 0xff) -/** - * Type of plot operation - */ -typedef enum { - PLOT_OP_TYPE_NONE = 0, /**< No operation */ - PLOT_OP_TYPE_SOLID, /**< Solid colour */ - PLOT_OP_TYPE_DOT, /**< Dotted plot */ - PLOT_OP_TYPE_DASH, /**< Dashed plot */ -} plot_operation_type_t; - - -/** - * Plot style for stroke/fill plotters - */ -typedef struct plot_style_s { - plot_operation_type_t stroke_type; /**< Stroke plot type */ - int stroke_width; /**< Width of stroke, in pixels */ - colour stroke_colour; /**< Colour of stroke */ - plot_operation_type_t fill_type; /**< Fill plot type */ - colour fill_colour; /**< Colour of fill */ -} plot_style_t; - - -/** - * Generic font family type - */ -typedef enum { - PLOT_FONT_FAMILY_SANS_SERIF = 0, - PLOT_FONT_FAMILY_SERIF, - PLOT_FONT_FAMILY_MONOSPACE, - PLOT_FONT_FAMILY_CURSIVE, - PLOT_FONT_FAMILY_FANTASY, - PLOT_FONT_FAMILY_COUNT /**< Number of generic families */ -} plot_font_generic_family_t; - - -/** - * Font plot flags - */ -typedef unsigned long plot_font_flags_t; -#define FONTF_NONE 0 -#define FONTF_ITALIC 1 -#define FONTF_OBLIQUE 2 -#define FONTF_SMALLCAPS 4 - - -/** - * Scaling factor for font sizes - */ -#define FONT_SIZE_SCALE 1024 - - -/** - * Font style for plotting - */ -typedef struct plot_font_style { - plot_font_generic_family_t family; /**< Generic family to plot with */ - int size; /**< Font size, in points * FONT_SIZE_SCALE */ - int weight; /**< Font weight: value in range [100,900] as per CSS */ - plot_font_flags_t flags; /**< Font flags */ - colour background; /**< Background colour to blend to, if appropriate */ - colour foreground; /**< Colour of text */ -} plot_font_style_t; - - /* global fill styles */ extern plot_style_t *plot_style_fill_white; extern plot_style_t *plot_style_fill_red; diff --git a/include/netsurf/plotters.h b/include/netsurf/plotters.h index b13c9b279..88cbbe560 100644 --- a/include/netsurf/plotters.h +++ b/include/netsurf/plotters.h @@ -27,7 +27,7 @@ #include #include -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" struct bitmap; struct rect; diff --git a/include/netsurf/types.h b/include/netsurf/types.h index a68013b9f..27f2e8f2a 100644 --- a/include/netsurf/types.h +++ b/include/netsurf/types.h @@ -27,6 +27,8 @@ #ifndef NETSURF_TYPES_H #define NETSURF_TYPES_H +#include + /** * Colour type: XBGR */ diff --git a/render/box_construct.c b/render/box_construct.c index 4b54a3075..d7de68c18 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -41,11 +41,12 @@ #include "utils/utils.h" #include "utils/string.h" #include "utils/ascii.h" +#include "netsurf/css.h" +#include "netsurf/misc.h" +#include "netsurf/plot_style.h" #include "content/content_protected.h" #include "css/hints.h" #include "css/select.h" -#include "netsurf/css.h" -#include "netsurf/misc.h" #include "desktop/gui_internal.h" #include "render/box.h" diff --git a/render/font.c b/render/font.c index 8128269fe..94ef877c7 100644 --- a/render/font.c +++ b/render/font.c @@ -23,6 +23,7 @@ */ #include "utils/nsoption.h" +#include "netsurf/plot_style.h" #include "css/utils.h" #include "render/font.h" diff --git a/render/font.h b/render/font.h index e4353df64..fba368a97 100644 --- a/render/font.h +++ b/render/font.h @@ -27,6 +27,8 @@ #ifndef _NETSURF_RENDER_FONT_H_ #define _NETSURF_RENDER_FONT_H_ +struct plot_font_style; + /** * Populate a font style using data from a computed CSS style * @@ -34,6 +36,6 @@ * \param fstyle Font style to populate */ void font_plot_style_from_css(const css_computed_style *css, - plot_font_style_t *fstyle); + struct plot_font_style *fstyle); #endif diff --git a/render/form.c b/render/form.c index 52e54e477..093b11fbc 100644 --- a/render/form.c +++ b/render/form.c @@ -40,17 +40,16 @@ #include "utils/utf8.h" #include "utils/utils.h" #include "utils/ascii.h" +#include "netsurf/browser_window.h" +#include "netsurf/mouse.h" +#include "netsurf/plotters.h" +#include "netsurf/misc.h" #include "content/fetch.h" #include "content/hlcache.h" #include "css/utils.h" -#include "netsurf/browser_window.h" -#include "netsurf/mouse.h" #include "desktop/knockout.h" -#include "desktop/plot_style.h" -#include "netsurf/plotters.h" #include "desktop/scrollbar.h" #include "desktop/textarea.h" -#include "netsurf/misc.h" #include "desktop/gui_internal.h" #include "render/box.h" diff --git a/render/html.h b/render/html.h index 871eb331e..b8429fd17 100644 --- a/render/html.h +++ b/render/html.h @@ -30,10 +30,10 @@ #include #include +#include "netsurf/types.h" #include "netsurf/content_type.h" #include "netsurf/browser_window.h" #include "netsurf/mouse.h" -#include "desktop/plot_style.h" #include "desktop/frame_types.h" struct fetch_multipart_data; @@ -52,6 +52,7 @@ struct scrollbar_msg_data; struct search_context; struct selection; struct nsurl; +struct plot_font_style; /** * Container for stylesheets used by an HTML document @@ -158,7 +159,7 @@ void html_overflow_scroll_drag_end(struct scrollbar *scrollbar, bool text_redraw(const char *utf8_text, size_t utf8_len, size_t offset, int space, - const plot_font_style_t *fstyle, + const struct plot_font_style *fstyle, int x, int y, const struct rect *clip, int height, diff --git a/utils/nsoption.c b/utils/nsoption.c index 9ac4778f1..8f05a911b 100644 --- a/utils/nsoption.c +++ b/utils/nsoption.c @@ -32,7 +32,7 @@ #include #include -#include "desktop/plot_style.h" +#include "netsurf/plot_style.h" #include "utils/errors.h" #include "utils/log.h" #include "utils/utils.h"