]> git.sesse.net Git - vlc/blob - modules/text_renderer/platform_fonts.h
mux: avi: fix leak on format failure
[vlc] / modules / text_renderer / platform_fonts.h
1 /*****************************************************************************
2  * freetype.c : Put text on the video, using freetype2
3  *****************************************************************************
4  * Copyright (C) 2002 - 2012 VLC authors and VideoLAN
5  * $Id$
6  *
7  * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
8  *          Gildas Bazin <gbazin@videolan.org>
9  *          Bernie Purcell <bitmap@videolan.org>
10  *          Jean-Baptiste Kempf <jb@videolan.org>
11  *          Felix Paul Kühne <fkuehne@videolan.org>
12  *
13  * This program is free software; you can redistribute it and/or modify it
14  * under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation; either version 2.1 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with this program; if not, write to the Free Software Foundation, Inc.,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  *****************************************************************************/
27
28 /*****************************************************************************
29  * Preamble
30  *****************************************************************************/
31
32 #ifdef HAVE_CONFIG_H
33 # include "config.h"
34 #endif
35
36 /* Default fonts */
37 #ifdef __APPLE__
38 # define SYSTEM_DEFAULT_FONT_FILE "/Library/Fonts/Arial Unicode.ttf"
39 # define SYSTEM_DEFAULT_FAMILY "Arial Unicode MS"
40 # define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/System/Library/Fonts/Monaco.dfont"
41 # define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Monaco"
42 #elif defined( _WIN32 )
43 # define SYSTEM_DEFAULT_FONT_FILE "arial.ttf" /* Default path font found at run-time */
44 # define SYSTEM_DEFAULT_FAMILY "Arial"
45 # define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "cour.ttf"
46 # define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Courier New"
47 #elif defined( __OS2__ )
48 # define SYSTEM_DEFAULT_FONT_FILE "/psfonts/tnrwt_k.ttf"
49 # define SYSTEM_DEFAULT_FAMILY "Times New Roman WT K"
50 # define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/psfonts/mtsansdk.ttf"
51 # define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Monotype Sans Duospace WT K"
52 #elif defined( __ANDROID__ )
53 # define SYSTEM_DEFAULT_FONT_FILE "/system/fonts/DroidSans-Bold.ttf"
54 # define SYSTEM_DEFAULT_FAMILY "Droid Sans Bold"
55 # define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/system/fonts/DroidSansMono.ttf"
56 # define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Droid Sans Mono"
57 #else
58 # define SYSTEM_DEFAULT_FONT_FILE "/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf"
59 # define SYSTEM_DEFAULT_FAMILY "Serif Bold"
60 # define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/usr/share/fonts/truetype/freefont/FreeMono.ttf"
61 # define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Monospace"
62 #endif
63
64 #ifndef DEFAULT_FONT_FILE
65 #define DEFAULT_FONT_FILE SYSTEM_DEFAULT_FONT_FILE
66 #endif
67
68 #ifndef DEFAULT_FAMILY
69 #define DEFAULT_FAMILY SYSTEM_DEFAULT_FAMILY
70 #endif
71
72 #ifndef DEFAULT_MONOSPACE_FONT_FILE
73 #define DEFAULT_MONOSPACE_FONT_FILE SYSTEM_DEFAULT_MONOSPACE_FONT_FILE
74 #endif
75
76 #ifndef DEFAULT_MONOSPACE_FAMILY
77 #define DEFAULT_MONOSPACE_FAMILY SYSTEM_DEFAULT_MONOSPACE_FAMILY
78 #endif
79
80
81 #ifdef HAVE_FONTCONFIG
82 char* FontConfig_Select( filter_t *p_filter, const char* family,
83                           bool b_bold, bool b_italic, int i_size, int *i_idx );
84 void FontConfig_BuildCache( filter_t *p_filter );
85 #endif
86
87
88 #if defined( _WIN32 ) && !VLC_WINSTORE_APP
89 char* Win32_Select( filter_t *p_filter, const char* family,
90                            bool b_bold, bool b_italic, int i_size, int *i_idx );
91
92 #endif /* _WIN32 */
93
94 #ifdef __APPLE__
95 #if !TARGET_OS_IPHONE
96 char* MacLegacy_Select( filter_t *p_filter, const char* psz_fontname,
97                           bool b_bold, bool b_italic, int i_size, int *i_idx );
98 #endif
99 #endif
100
101 char* Dummy_Select( filter_t *p_filter, const char* family,
102                     bool b_bold, bool b_italic, int i_size, int *i_idx );
103
104 #define File_Select(a) Dummy_Select(NULL, a, 0, 0, 0, NULL)