diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2018-05-23 15:46:39 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2018-05-23 15:46:39 +0100 |
commit | a40dca49e8493802d7064bd8e6aaab03436568ee (patch) | |
tree | 5a036a8ddc33423d3564b046837ff42bd46d8f61 /include/netsurf/plot_style.h | |
parent | 6cabd4cd628833afa32aeb7c614ef153b4a1c985 (diff) | |
parent | 8a931f01b958ad5862433ece6024bbde0aa4ecb8 (diff) | |
download | netsurf-a40dca49e8493802d7064bd8e6aaab03436568ee.tar.gz netsurf-a40dca49e8493802d7064bd8e6aaab03436568ee.tar.bz2 |
Merge branch 'tlsa/plotter-polish'
Diffstat (limited to 'include/netsurf/plot_style.h')
-rw-r--r-- | include/netsurf/plot_style.h | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/include/netsurf/plot_style.h b/include/netsurf/plot_style.h index 30db3663e..f1b617231 100644 --- a/include/netsurf/plot_style.h +++ b/include/netsurf/plot_style.h @@ -25,6 +25,8 @@ #define NETSURF_PLOT_STYLE_H #include <stdint.h> +#include <stdint.h> +#include <libwapcaplet/libwapcaplet.h> #include "netsurf/types.h" /** light grey widget base colour */ @@ -36,8 +38,26 @@ /** Transparent colour value. */ #define NS_TRANSPARENT 0x01000000 -/** Scaling factor for font sizes */ -#define FONT_SIZE_SCALE 1024 +/** 22:10 fixed point */ +#define PLOT_STYLE_RADIX (10) + +/** Scaling factor for plot styles */ +#define PLOT_STYLE_SCALE (1 << PLOT_STYLE_RADIX) + +/* type for fixed point numbers */ +typedef int32_t plot_style_fixed; + +/* Convert an int to fixed point */ +#define plot_style_int_to_fixed(v) ((v) << PLOT_STYLE_RADIX) + +/* Convert fixed point to int */ +#define plot_style_fixed_to_int(v) ((v) >> PLOT_STYLE_RADIX) + +/* Convert fixed point to float */ +#define plot_style_fixed_to_float(v) (((float)v) / PLOT_STYLE_SCALE) + +/* Convert fixed point to double */ +#define plot_style_fixed_to_double(v) (((double)v) / PLOT_STYLE_SCALE) /** * Type of plot operation @@ -55,7 +75,7 @@ typedef enum { */ typedef struct plot_style_s { plot_operation_type_t stroke_type; /**< Stroke plot type */ - int stroke_width; /**< Width of stroke, in pixels */ + plot_style_fixed 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 */ @@ -89,8 +109,14 @@ typedef enum { * Font style for plotting */ typedef struct plot_font_style { + /** + * Array of pointers to font families. + * + * May be NULL. Array is NULL terminated. + */ + lwc_string * const * families; plot_font_generic_family_t family; /**< Generic family to plot with */ - int size; /**< Font size, in points * FONT_SIZE_SCALE */ + plot_style_fixed size; /**< Font size, in pt */ 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 */ |