Panda3D
default_font.cxx
1 // Filename: default_font.cxx
2 // Created by: drose (31Jan03)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "default_font.h"
16 
17 // The binary data included here was generated from an existing font
18 // file via the utility program bin2c (defined in pandatool). It is
19 // used as the default font when no font file is specified by the
20 // user.
21 
22 // The particular font we use may come from either of two possible
23 // sources:
24 
25 // If we have the Freetype library available, we use persans.ttf, part
26 // of the "Perspective Sans" font family downloaded from
27 // http://www.fontsquirrel.com/fonts/Perspective-Sans, which appears
28 // to be freeware.
29 //
30 // If Freetype is not available, we use cmss12.bam, which was in turn
31 // generated from cmss12.720pk, and defines "Computer Modern Sans
32 // Serif", a basic Metafont-generated font supplied with TeX. This
33 // egg file, by the way, is also distributed with Panda in the models
34 // tree.
35 
36 #if defined(COMPILE_IN_DEFAULT_FONT) && !defined(CPPPARSER)
37 
38 #ifdef HAVE_FREETYPE
39 
40 // If we have FreeType available, include the ttf font; it's superior
41 // because it's dynamic. See above.
42 #include "persans.ttf_src.c"
43 
44 #elif defined(HAVE_ZLIB)
45 
46 // If we don't have FreeType, we have to include the bam font, which
47 // is kind of bulky but at least we can compress it if we have zlib.
48 
49 // Regenerate this file with (cmss12.egg can be loaded from the models tree):
50 
51 // egg2bam -rawtex -o cmss12.bam cmss12.egg
52 // pzip cmss12.bam
53 // bin2c -n default_font_data -o cmss12.bam.pz_src.c cmss12.bam.pz
54 
55 #include "cmss12.bam.pz_src.c"
56 
57 #else
58 
59 // If we don't even have zlib, just include the whole uncompressed bam
60 // file.
61 
62 // Regenerate this file with (cmss12.egg can be loaded from the models tree):
63 
64 // egg2bam -rawtex -o cmss12.bam cmss12.egg
65 // bin2c -n default_font_data -o cmss12.bam_src.c cmss12.bam
66 
67 #include "cmss12.bam_src.c"
68 
69 #endif
70 
71 const int default_font_size = sizeof(default_font_data);
72 
73 #endif // COMPILE_IN_DEFAULT_FONT && !CPPPARSER