204 | | * You will need to link with the [http://www.freetype.org FreeType2] and [http://sourceforge.net/projects/ftgl/files/FTGL%20Source/ FTGL] libraries. Depending on how you build the FreeType2 library, FreeType2 may require the libz and libbz2 libraries. For Windows, prebuilt libraries are available in the `boinc_depends_win_vs2005` repository. To build these libraries on the Mac, please see MacBuild. |
205 | | * We have put copies of the free [https://fedorahosted.org/liberation-fonts Liberation fonts] in the `api/ttf/` directory. If you wish to use other !TrueType fonts, you will need to adjust the list of font names in `ttfont.cpp`. (Another source of free fonts is the [http://www.gnu.org/software/freefont GNU Freefont project].) |
206 | | * Download the desired !TrueType fonts to the client where they are available to your graphics application. |
207 | | |
208 | | For examples, please see the `clientscr/ss_app.cpp` and `samples/exampple_app/uc2_graphics.cpp` in the BOINC SVN trunk. |
209 | | |
210 | | If your graphics application currently uses the older ''texture fonts'', note that the ttf_load_fonts() and txf_render_string() APIs are slightly different from the old txf_load_fonts() and txf_render_string() APIs, which have been eliminated. Please see the `ttfont.cpp` and `ttfont.h` files for details. |
| 209 | * Link with the [http://www.freetype.org FreeType2] |
| 210 | and [http://sourceforge.net/projects/ftgl/files/FTGL%20Source/ FTGL] libraries. |
| 211 | Depending on how you build the FreeType2 library, FreeType2 may require the libz and libbz2 libraries. |
| 212 | For Windows, prebuilt libraries are available in the `boinc_depends_win_vs2005` repository. |
| 213 | To build these libraries on the Mac, please see MacBuild. |
| 214 | * Include the desired !TrueType fonts in your [AppVersionNew app versions]. |
| 215 | The set of free [https://fedorahosted.org/liberation-fonts Liberation fonts] in included the `api/ttf/` directory. |
| 216 | If you wish to use other !TrueType fonts, |
| 217 | you'll need to adjust the list of font names in `ttfont.cpp`. |
| 218 | (Another source of free fonts is the [http://www.gnu.org/software/freefont GNU Freefont project].) |
| 219 | * To display text, use the following API functions: |
| 220 | {{{ |
| 221 | float white[4] = {1., 1., 1., 1.}; |
| 222 | APP_INIT_DATA aid; |
| 223 | boinc_get_init_data(aid); |
| 224 | |
| 225 | // read font files; they're in the project directory |
| 226 | // |
| 227 | ttf_load_fonts(aid.project_dir); |
| 228 | ... |
| 229 | ttf_render_string( |
| 230 | x, y, z, // where to display string |
| 231 | 500, // size |
| 232 | white, // color |
| 233 | "App suspended" // the text |
| 234 | 0, // which font (see ttfont.cpp) |
| 235 | // default is Sans-Regular (0) |
| 236 | ); |
| 237 | |
| 238 | }}} |
| 239 | |
| 240 | Other parameters to '''ttf_render_string()''' let you specify rotation; see ttfont.h. |
| 241 | For examples, see the `clientscr/ss_app.cpp` and `samples/exampple_app/uc2_graphics.cpp` in the BOINC trunk. |