1Introduction 2------------ 3 4Documentation is an extremely important part of any project, and it 5helps a lot if it uses consistent syntax and layout. 6 7The documentation for the FreeType library is maintained in header 8files in the `include/` directory in the form of code comments. These 9comments are extracted and organized by 'docwriter' (previously 10'docmaker'). The generated docs can be viewed in the 11`docs/reference/site/` directory after running `make refdoc`. 12 13Documentation comments follow a specific structure and format as 14described below. 15 16 17Documentation Structure 18----------------------- 19 20The documentation is divided into multiple chapters, which contain 21sections relevant to it. The chapter details and sections contained 22in them are listed in `include/freetype/ftchapters.h`. Any unlisted 23section is added to the 'Miscellaneous' chapter. 24 25Sections may contain sub-sections which consist of properties, 26enumerations, and other data types. 27 28 29Comment Blocks 30-------------- 31 32Documentation blocks follow a specific format: 33 34 /***************************** (should end on column 77) 35 * 36 * (1 asterisk, 1 space, then content) 37 * 38 */ (end of block) 39 40To make 'docwriter' recognize a comment block, there must be at least 41two asterisks in the first line. As a consequence, you should change 42the second asterisk to something else if you want to prevent a comment 43block being handled by 'docwriter' (for example, change `/****/` to 44`/*#**/`). 45 46 47Markup Tags 48----------- 49 50Markup tags are used to indicate what comes next. The syntax for a 51tag is: 52 53 @foo: 54 55An `@`, followed by the tag, and then `:`. 56 57 58Reserved Tags 59------------- 60 61There are some keywords that have a special meaning to docwriter. 62As a convention, all keywords are written in lowercase. 63 64* `chapter`: Defines a chapter. Usually the title with underscores. 65* `sections`: List of sections in the chapter, in order. 66* `section`: Defines the start or continuation of a section. 67* `title`: Title for a chapter or section. May contain spaces. 68* `abstract`: The abstract for a section, visible in the Table of 69 Contents (TOC). 70* `description`: Detailed description of a tag (except chapters), 71 shown as synopsis. 72* `values`: A list of 'values' for the tag. These values are used for 73 cross-referencing. 74 75 76Other Tags 77---------- 78 79Except the ones given above, any other tags will be added as a part of 80a subsection. All tags are lowercase by convention. 81 82 83Public Header Definitions 84------------------------- 85 86The public headers for FreeType have their names defined in 87`include/freetype/config/ftheader.h`. Any new public header file must 88be defined in this file, in the following format: 89 90 #define FT_NEWNAME_H <freetype/newname.h> 91 92Where `newname` is the name of the header file. 93 94This macro is combined with the file location of a sub-section and 95printed with the object. 96 97 98Note on code blocks captured after comments 99------------------------------------------- 100 101All non-documentation lines after a documentation comment block are 102captured to be displayed as the code for the sub-section. To stop 103collection, a line with `/* */` should be added. 104 105 106General Formatting Conventions 107------------------------------ 108 109* Use two spaces after a full stop ending a sentence. 110* Use appropriate uppercasing in titles. Refer 111 112 https://english.stackexchange.com/a/34 113 114 for more information. 115* Do not add trailing parentheses when citing a C function. 116 117 118Markdown Usage 119-------------- 120 121All tags, except the ones that define the name and title for a block 122support markdown in them. Docwriter uses a markdown parser that 123follows rules given in John Gruber's markdown guide: 124 125 https://daringfireball.net/projects/markdown/syntax 126 127with a few exceptions and extensions, detailed below. This may also 128be referred to as the **FreeType Flavored Markdown**. 129 130 131Headers 132------- 133 134Markdown headers should not be used directly, because these are added 135based on section titles, sub-section names, and tags. However, if a 136header needs to be added, note the following correspondence to HTML tags: 137 138* Section title on top of the page is `H1`. 139* Sub-section titles are `H2`. 140* Parts of sub-sections are `H4`. 141* Any header added will be visible in the Table of Contents (TOC) of 142 the page. 143 144 145Emphasis 146-------- 147 148* Use `_underscores_` for italics. 149* Use `**double asterisks**` for bold. 150 151Although the other notations (double underscore for bold, single 152asterisk for italics) are supported, it is recommended to use the 153above for consistency. 154 155Note that there may be cases where having two asterisks or underscores 156in a line may lead to text being picked up as italics or bold. 157Although unintentional, this is correct markdown behavior. 158 159For inline code, wrap the sequence with backticks (see below). This 160renders symbols correctly without modifications. If a symbol is 161absolutely required outside of an inline code block or code sequence, 162escape it with a backslash (like `\*` or `\_`). 163 164 165Lists 166----- 167 168Unordered lists can be created with asterisks: 169 170 * Unordered list items can use asterisks. 171 * Another list item. 172 173Ordered lists start with numbers: 174 175 1. This is an ordered list item. 176 2. Brackets after numbers won't work. 177 178To continue a list over multiple paragraphs, indent them with at least 179four spaces. For example: 180 181 1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 182 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi, 183 viverra nec, fringilla in, laoreet vitae, risus. 184 185 Donec sit amet nisl. Aliquam semper ipsum sit amet velit. 186 Suspendisse id sem consectetuer libero luctus adipiscing. 187 188 2. This is the second list item. 189 190 This paragraph is not a part of the list. 191 192More information on lists in markdown is available at 193 194 https://daringfireball.net/projects/markdown/syntax#list 195 196 197Cross-references 198---------------- 199 200Other sub-sections can be linked with the `@` symbol: 201 202 @description: 203 While FreeType's CFF driver doesn't expose API functions by 204 itself, it is possible to control its behaviour with 205 @FT_Property_Set and @FT_Property_Get. 206 207If a field in the `values` table of another sub-section is linked, the 208link leads to its parent sub-section. 209 210 211Links and Images 212---------------- 213 214All URLs are converted to links in the HTML documentation. 215 216Markdown syntax for links and images are fully supported. 217 218 219Inline Code 220----------- 221 222To indicate a span of code, wrap it with backtick quotes (`` ` ``): 223 224 Use the `printf()` function. 225 226Cross-references, markdown, and html styling do not work in inline code 227sequences. 228 229 230Code and Syntax Highlighting 231---------------------------- 232 233Blocks of code are fenced by lines with three back-ticks `` ``` `` 234followed by the language name, if any (used for syntax highlighting), 235as demonstrated in the following example. 236 237 ```c 238 x = y + z; 239 if ( zookoo == 2 ) 240 { 241 foobar(); 242 } 243 ``` 244 245Note that the indentation of the opening line and the closing line 246must be exactly the same. The code sequence itself should have a 247larger indentation than the surrounding back-ticks. 248 249Like inline code, markdown and html styling is *not* supported inside 250code blocks. 251 252 253Tables 254------ 255 256Tables are used to list values, input, and other fields. The FreeType 257Flavored Markdown adopts a simple approach to tables with two columns, 258or field definition tables. 259 260Field definition names may contain alphanumeric, underscore, and the 261`.` characters. This is followed by `::`. The following lines are 262the second column of the table. A field definition ends with the 263start of another field definition, or a markup tag. 264 265 @Input: 266 pathname :: 267 A path to the font file. 268 269 face_index :: 270 See @FT_Open_Face for a detailed description of this 271 parameter. 272 273 274Non-breaking Space 275------------------ 276 277A tilde can be used to create a non-breaking space. The example 278 279 The encoding value~0 is reserved. 280 281is converted to 282 283 The encoding value 0 is reserved. 284 285 286---------------------------------------------------------------------- 287 288Copyright (C) 2018-2020 by 289Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. 290 291This file is part of the FreeType project, and may only be used, 292modified, and distributed under the terms of the FreeType project 293license, LICENSE.TXT. By continuing to use, modify, or distribute 294this file you indicate that you have read the license and understand 295and accept it fully. 296 297 298--- end of DOCGUIDE --- 299