1 /* libmfl.h - This is the header file for the external interface of LibMFL
2  *            the minimal font library.  Programs using the
3  *            library should #include this file.
4  *
5  * Copyright (C) 2000 Boris Gjenero
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License, version 2.1, as published by the Free Software Foundation
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  * You may contact Boris Gjenero at bgjenero@sympatico.ca
21  */
22 
23 #ifndef _LIBMFL_USER_H_
24 #define _LIBMFL_USER_H_
25 
26 #if defined(__cplusplus) || defined(c_plusplus)
27 // This is a C library, and this allows it to be used in C++ programs
28 extern "C" {
29 #endif
30 
31 #define MFL_NORMAL 0
32 #define MFL_XOR 1
33 #define MFL_OR 2
34 #define MFL_SETALL 3
35 
36 struct mfl_font_s;
37 typedef struct mfl_font_s *mfl_font;
38 
39 struct mfl_context_s;
40 typedef struct mfl_context_s *mfl_context;
41 
42 /* Font management */
43 mfl_font mfl_LoadRawFont(const char *fname);
44 void mfl_DestroyFont(mfl_font f);
45 
46 /* Context management */
47 mfl_context mfl_CreateContext(void *buf, unsigned int bpp,
48 			      unsigned int bpl, unsigned int width,
49 			      unsigned int height);
50 void mfl_SetTextColor(mfl_context cx, unsigned long c);
51 void mfl_SetFont(mfl_context cx, mfl_font f);
52 void mfl_DestroyContext(mfl_context cx);
53 void mfl_SetDrawMode(mfl_context cx, int mode);
54 
55 /* Info */
56 inline unsigned int mfl_GetTextWidth(const mfl_context cx,
57 				     const char *s);
58 inline unsigned int mfl_GetTextWidthL(const mfl_context cx,
59 				      const char *s, int l);
60 
61 /* Character drawing */
62 void mfl_OutChar8(const mfl_context cx, int x, int y, char c);
63 
64 /* String drawing */
65 void mfl_OutText8L(const mfl_context cx, int x, int y,
66 		   const char *s, int l);
67 void mfl_OutText8(const mfl_context cx, int x, int y,
68 		  const char *s);
69 
70 #if defined(__cplusplus) || defined(c_plusplus)
71 // This is a C library, and this allows it to be used in C++ programs
72 }
73 #endif
74 
75 #endif
76