Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5131 | clevermous | 1 | SDL_bdf version 1.2 |
2 | |||
3 | http://www.geocities.com/andre_leiradella/ |
||
4 | |||
5 | For copyright information see the source files. |
||
6 | |||
7 | SDL_bdf is a small library that renders BDF fonts. As of version 1.2, SDL_bdf |
||
8 | doesn't depend on SDL anymore, you can use it with any graphics library throgh |
||
9 | it's API, but the bundled exampled uses SDL to show a text with a BDF font on |
||
10 | the screen. |
||
11 | |||
12 | The library has been tested with SDL under Windows but should work on any |
||
13 | platform/graphics library. The functions provided are: |
||
14 | |||
15 | . BDF_Font *BDF_OpenFont(BDF_ReadByte getbyte, void *info, int *error): Opens a |
||
16 | BDF font, it receives the function that will produce the stream of bytes, the |
||
17 | user defined void pointer that will be passed to getbyte and a pointer to an |
||
18 | int that will receive the error code. Returns the BDF font. |
||
19 | . void BDF_CloseFont(BDF_Font *font): Closes the font and frees all associated |
||
20 | memory. |
||
21 | . void BDF_SizeH(BDF_Font *font, char *text, int *x0, int *y0, int *width, |
||
22 | int *height): Determines the size of the horizontal text, returns the width |
||
23 | and height of the smallest rectangle that can acomodate the rendered text and |
||
24 | the start position in x0 and y0 on where the text must be rendered to exactly |
||
25 | fit the rectangle. This is because the render functions take the y parameter |
||
26 | as the baseline of the text to allow different fonts (e.g. normal and italic) |
||
27 | to be mixed in the same line. It handles NULL pointers for pieces of |
||
28 | information you don't want. |
||
29 | . void BDF_SizeEntitiesH(BDF_Font *font, char *text, int *x0, int *y0, |
||
30 | int *width, int *height): Same as above but accepts entities in the |
||
31 | form &...; (e.g. André) |
||
32 | . int BDF_DrawH(void *surface, BDF_PutPixel putpixel, BDF_Font *font, |
||
33 | char *text, int x, int y, unsigned int color): Draws the text at the given |
||
34 | surface starting at position (x, y). It calls putpixel with the surface, |
||
35 | coordinates and color to draw the pixel (doesn't clip). Returns the next x |
||
36 | coordinate to continue to render more text. Only accepts characters in the |
||
37 | range [0..255]. |
||
38 | . int BDF_DrawEntitiesH(void *, BDF_PutPixel, BDF_Font *, char *, int, int, |
||
39 | unsigned int): Same as above but accepts entities in the form &...; |
||
40 | |||
41 | TODO: |
||
42 | |||
43 | . Handle vertical writing. |
||
44 | . Use a hash table instead of an ordered array to access the glyphs by name. |
||
45 | . What else? Tell me: leiradella@bigfoot.com |
||
46 |