NetSurf
Data Fields
gui_layout_table Struct Reference

#include <layout.h>

Data Fields

nserror(* width )(const struct plot_font_style *fstyle, const char *string, size_t length, int *width)
 Measure the width of a string. More...
 
nserror(* position )(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)
 Find the position in a string where an x coordinate falls. More...
 
nserror(* split )(const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)
 Find where to split a string to make it fit a width. More...
 

Detailed Description

Definition at line 37 of file layout.h.

Field Documentation

◆ position

nserror(* gui_layout_table::position) (const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)

Find the position in a string where an x coordinate falls.

Parameters
[in]fstylestyle for this text
[in]stringUTF-8 string to measure
[in]lengthlength of string, in bytes
[in]xcoordinate to search for
[out]char_offsetupdated to offset in string of actual_x, [0..length]
[out]actual_xupdated to x coordinate of character closest to x
Returns
NSERROR_OK and char_offset and actual_x updated or appropriate error code on faliure

Definition at line 63 of file layout.h.

Referenced by default_mouse_action(), html_selection_drag_end(), mouse_action_drag_selection(), redraw_entry(), textarea_get_b_off_xy(), textplain_offset_from_coords(), and verify_layout_register().

◆ split

nserror(* gui_layout_table::split) (const struct plot_font_style *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x)

Find where to split a string to make it fit a width.

Parameters
[in]fstylestyle for this text
[in]stringUTF-8 string to measure
[in]lengthlength of string, in bytes
[in]xwidth available
[out]char_offsetupdated to offset in string of actual_x, [1..length]
[out]actual_xupdated to x coordinate of character closest to x
Returns
NSERROR_OK or appropriate error code on faliure

On exit, char_offset indicates first character after split point.

Note
char_offset of 0 must never be returned.

Returns: char_offset giving split point closest to x, where actual_x <= x else char_offset giving split point closest to x, where actual_x > x

Returning char_offset == length means no split possible

Definition at line 88 of file layout.h.

Referenced by layout_line(), textarea_reflow_multiline(), and verify_layout_register().

◆ width

nserror(* gui_layout_table::width) (const struct plot_font_style *fstyle, const char *string, size_t length, int *width)

Measure the width of a string.

Parameters
[in]fstyleplot style for this text
[in]stringUTF-8 string to measure
[in]lengthlength of string, in bytes
[out]widthupdated to width of string[0..length)
Returns
NSERROR_OK and width updated or appropriate error code on faliure

Definition at line 49 of file layout.h.

Referenced by html_redraw_box(), html_redraw_file(), layout_line(), layout_minmax_line(), layout_text_box_split(), page_info__measure_text_entry(), text_draw(), text_redraw(), textarea_redraw(), textarea_reflow_multiline(), textarea_reflow_singleline(), textarea_set_caret_internal(), textplain_coord_from_offset(), textplain_offset_from_coords(), textplain_redraw(), textplain_reformat(), treeview_create(), treeview_insert_node(), treeview_node_expand_internal(), treeview_update_node_entry(), treeview_update_node_folder(), and verify_layout_register().


The documentation for this struct was generated from the following file: