4 All parts of Pango other than modules should use the following formatting
5 style; for modules, it is up to the discretion of the module
6 author / maintainer, though they are encouraged to follow the following.
8 The Pango formatting style is basically the GNU style of formatting
9 (see http://www.gnu.org/prep/standards.html), with a few additions.
12 - Two character indents are used; braces go on a separate line, and
13 get a separate indentation level, so the total indent for an
14 enclosed block is 4 characters.
28 - Spaces should be present between function name and argument block,
33 - In pointer types, the '*' is grouped with the variable name,
34 not with the base type.
40 In cases where there is no variable name, for instance, return
41 values, there should be a single space between the base type
44 - function and variable names are lower_case_with_underscores
45 type names are StudlyCaps, macro names are UPPER_CASE_WITH_UNDERSCORES
48 Documentation comments
49 ======================
51 All public API functions should have inline documentation headers
52 in the gtk-doc / gnome-doc style. For instance:
55 * pango_layout_get_line:
56 * @layout: a #PangoLayout
57 * @line: the index of a line, which must be between 0 and
58 * pango_layout_get_line_count(layout) - 1, inclusive.
60 * Retrieves a particular line from a #PangoLayout (or @layout.)
62 * Return value: the requested #PangoLayoutLine, or %NULL if the
63 * index is out of range. This layout line can
64 * be ref'ed and retained, but will become invalid
65 * if changes are made to the #PangoLayout.
70 pango_layout_get_line (PangoLayout *layout,
75 Choosing Function Names
76 =======================
78 - Don't abbreviate in unexpected ways:
80 pango_layout_get_line_count ()
84 pango_layout_ln_cnt ()
86 - function that retrieve a value in a side-effect free fashion, should
87 include "get" in the name.
89 int pango_layout_get_line_count (PangoLayout *layout)
93 pango_layout_line_count ()
96 - functions that set a single parameter in a side-effect free fashion
97 should include "set" in the name, for instance:
99 void pango_layout_set_width (PangoLayout *layout,
105 - Avoid unsigned values for all but flags fields. This is because
106 the way C handles unsigned values generates bugs like crazy:
108 If width is unsigned and 10, then:
110 int new_width = MAX (width - 15, 1);
112 produces 4294967291, not 1.