103 family = FF_ROMAN | DEFAULT_PITCH;
108 family = FF_MODERN | DEFAULT_PITCH;
113 family = FF_SCRIPT | DEFAULT_PITCH;
118 family = FF_DECORATIVE | DEFAULT_PITCH;
124 family = FF_SWISS | DEFAULT_PITCH;
134 font = CreateFont(nHeight,
155 font = (HFONT) GetStockObject(ANSI_FIXED_FONT);
157 font = (HFONT) GetStockObject(ANSI_VAR_FONT);
162 font = (HFONT) GetStockObject(SYSTEM_FONT);
203 fontbak = SelectObject(hdc, font);
205 wclen = MultiByteToWideChar(CP_UTF8, 0, utf8str, utf8len, wstr,
WSTRLEN);
207 wres = GetTextExtentPoint32W(hdc, wstr, wclen, &sizl);
217 font = SelectObject(hdc, fontbak);
219 ReleaseDC(NULL, hdc);
253 if ((utf8len == 0) || (x < 1)) {
261 fontbak = SelectObject(hdc, font);
263 if ((GetTextExtentExPointA(hdc, utf8str, utf8len, x, &offset, NULL, &s) != 0) &&
264 (GetTextExtentPoint32A(hdc, utf8str, offset, &s) != 0)) {
265 *char_offset = (size_t)offset;
271 font = SelectObject(hdc, fontbak);
273 ReleaseDC(NULL, hdc);
313 if (*offset == length) {
320 while ((
string[*offset] !=
' ') &&
328 while ((*offset < length) &&
329 (
string[*offset] !=
' ')) {
337 NSLOG(netsurf, DEEPDEBUG,
338 "ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s",
339 res, length, x, *offset, *actual_x, *offset,
string);
char * strndup(const char *s, size_t n)
Duplicate up to n characters of a string.
nserror
Enumeration of error codes.
@ NSERROR_NOSPACE
Insufficient space.
@ NSERROR_UNKNOWN
Unknown error - DO NOT USE.
@ NSERROR_INVALID
Invalid data.
@ NSERROR_NOMEM
Memory exhaustion.
static nserror win32_font_width(const plot_font_style_t *style, const char *utf8str, size_t utf8len, int *width)
Measure the width of a string.
static nserror utf8_from_local_encoding(const char *string, size_t len, char **result)
Convert a string to UTF8 from local encoding.
static nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
Convert a string to UCS2 from UTF8.
static struct gui_utf8_table utf8_table
win32 utf8 encoding operations table
struct gui_utf8_table * win32_utf8_table
nserror utf8_to_font_encoding(const struct font_desc *font, const char *string, size_t len, char **result)
convert from utf-8 to win32 font encoding.
static nserror win32_font_position(const plot_font_style_t *style, const char *utf8str, size_t utf8len, int x, size_t *char_offset, int *actual_x)
Find the position in a string where an x coordinate falls.
struct gui_layout_table * win32_layout_table
HFONT get_font(const plot_font_style_t *style)
static struct gui_layout_table layout_table
win32 font operations table
static nserror win32_font_split(const plot_font_style_t *style, const char *string, size_t length, int x, size_t *offset, int *actual_x)
Find where to split a string to make it fit a width.
The interface to the win32 font and utf8 handling.
Interface to platform-specific layout operation table.
Interface to platform-specific utf8 operations.
Netsurf additional integer type formatting macros.
#define NSLOG(catname, level, logmsg, args...)
plotter style interfaces, generic styles and style colour helpers.
@ PLOT_FONT_FAMILY_CURSIVE
@ PLOT_FONT_FAMILY_SANS_SERIF
@ PLOT_FONT_FAMILY_FANTASY
@ PLOT_FONT_FAMILY_MONOSPACE
#define PLOT_STYLE_SCALE
Scaling factor for plot styles.
nserror(* width)(const struct plot_font_style *fstyle, const char *string, size_t length, int *width)
Measure the width of a string.
User interface utf8 characterset conversion routines.
nserror(* utf8_to_local)(const char *string, size_t len, char **result)
Convert a UTF-8 encoded string into the system local encoding.
plot_font_generic_family_t family
Generic family to plot with.
plot_font_flags_t flags
Font flags.
plot_style_fixed size
Font size, in pt.
int weight
Font weight: value in range [100,900] as per CSS.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
nserror utf8_to_enc(const char *string, const char *encname, size_t len, char **result)
Convert a UTF8 string into the named encoding.
UTF-8 manipulation functions (interface).