Mercurial > mplayer.hg
annotate gui/skin/font.h @ 32835:19cc523b8e15
Enlarge uchar buffer, because GLib implements 31-bit UTF-8,
and define length of an UTF-8 encoding sequence allowed in
the font definition file as a constant.
author | ib |
---|---|
date | Thu, 17 Feb 2011 13:35:58 +0000 |
parents | d55d0bb7d00f |
children | fe8f9b5d3ba2 |
rev | line source |
---|---|
26458 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
18 | |
26029 | 19 #ifndef MPLAYER_GUI_FONT_H |
20 #define MPLAYER_GUI_FONT_H | |
23077 | 21 |
32734
cc58a1e919d9
Allow character in the font description file to be in UTF-8.
ib
parents:
28051
diff
changeset
|
22 #include <gtk/gtk.h> |
26365
10dfbc523184
Add gui/ prefix to some #include paths so that compilation from the
diego
parents:
26029
diff
changeset
|
23 #include "gui/bitmap.h" |
10dfbc523184
Add gui/ prefix to some #include paths so that compilation from the
diego
parents:
26029
diff
changeset
|
24 #include "gui/app.h" |
23077 | 25 |
32734
cc58a1e919d9
Allow character in the font description file to be in UTF-8.
ib
parents:
28051
diff
changeset
|
26 #define ASCII_CHRS 128 // number of ASCII characters |
cc58a1e919d9
Allow character in the font description file to be in UTF-8.
ib
parents:
28051
diff
changeset
|
27 #define EXTRA_CHRS 128 // (arbitrary) number of non-ASCII characters |
32835
19cc523b8e15
Enlarge uchar buffer, because GLib implements 31-bit UTF-8,
ib
parents:
32787
diff
changeset
|
28 #define UTF8LENGTH 4 // length of an UTF-8 encoding according to RFC 3629 |
32734
cc58a1e919d9
Allow character in the font description file to be in UTF-8.
ib
parents:
28051
diff
changeset
|
29 |
32786 | 30 #define MAX_FONT_NAME 128 |
31 #define MAX_FONTS 25 | |
32 | |
23077 | 33 #define fntAlignLeft 0 |
34 #define fntAlignCenter 1 | |
35 #define fntAlignRight 2 | |
36 | |
37 typedef struct | |
38 { | |
39 int x,y; // location | |
40 int sx,sy; // size | |
41 } fntChar; | |
42 | |
43 typedef struct | |
44 { | |
32734
cc58a1e919d9
Allow character in the font description file to be in UTF-8.
ib
parents:
28051
diff
changeset
|
45 fntChar Fnt[ASCII_CHRS + EXTRA_CHRS]; |
32835
19cc523b8e15
Enlarge uchar buffer, because GLib implements 31-bit UTF-8,
ib
parents:
32787
diff
changeset
|
46 unsigned char nonASCIIidx[EXTRA_CHRS][UTF8LENGTH]; |
32734
cc58a1e919d9
Allow character in the font description file to be in UTF-8.
ib
parents:
28051
diff
changeset
|
47 txSample Bitmap; |
32786 | 48 char name[MAX_FONT_NAME]; |
23077 | 49 } bmpFont; |
50 | |
32787 | 51 extern bmpFont * Fonts[MAX_FONTS]; |
23077 | 52 |
28051 | 53 int fntAddNewFont( char * name ); |
54 void fntFreeFont( void ); | |
55 int fntFindID( char * name ); | |
32734
cc58a1e919d9
Allow character in the font description file to be in UTF-8.
ib
parents:
28051
diff
changeset
|
56 int fntGetCharIndex( int id, unsigned char **str, gboolean utf8, int direction ); |
28051 | 57 int fntTextHeight( int id, char * str ); |
58 int fntTextWidth( int id, char * str ); | |
23077 | 59 |
28051 | 60 int fntRead( char * path, char * fname ); |
32759 | 61 txSample * fntRender( wItem * item, int px, char * txt ); |
23077 | 62 |
26029 | 63 #endif /* MPLAYER_GUI_FONT_H */ |