PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
FontTest.cpp
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: FontTest.cpp
4// Purpose: Tests the PFont Class
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2003 Shane T. Mueller <smueller@umich.edu>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL 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 General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#include "../objects/PFont.h"
28#include "../objects/PColor.h"
29#include "../base/Variant.h"
30
31//#include "../objects/PObject.h"
32
33#include <iostream>
34
35using std::cout;
36using std::endl;
37using std::flush;
38
39//The following is the entry point for the command-line version
40int main(int argc, char **argv)
41{
42
43 cout << "\n\n\n==========================================================\n";
44 cout << "Testing the PFont Class\n";
45 cout << "==========================================================\n";
46
47 cout << "==========================================================\n";
48 cout << "Constructing Colors\n";
49
50 PColor fgColor = PColor();
51 PColor bgColor = PColor(222,222,222,222);
52
53 cout << "\n\n\n==========================================================\n";
54 cout << "Constructing Fonts\n";
55 PFont myFont1 = PFont();
56 PFont myFont2 = PFont("VeraSe.ttf", PFS_Italic | PFS_Underline, 22, PColor("red"), PColor("black"), false );
57
58
59 cout << "\n\n==========================================================\n";
60 cout << "Printing standard font output." << endl;
61
62 cout << myFont1 << endl;
63 cout << myFont2 << endl;
64
65
66
67 cout << "\n\n==========================================================\n";
68 cout << "Printing font information:" << endl;
69
70
71 cout << "Font Name : " << myFont1.GetFontFileName() << endl;
72 cout << "Font Style: " << myFont1.GetFontStyle() << endl;
73 cout << " IsNormal? " << myFont1.IsNormalFont() << endl;
74 cout << " IsBold? " << myFont1.IsBoldFont() << endl;
75 cout << " IsItalic? " << myFont1.IsItalicFont() << endl;
76 cout << " IsUnderlined? " << myFont1.IsUnderlineFont() << endl;
77 cout << "AntiAliased? " << myFont1.GetAntiAliased() << endl;
78 cout << "FGColor: " << myFont1.GetFontColor() << endl;
79 cout << "BGColor: " << myFont1.GetBackgroundColor() << endl;
80 cout << "Font Size: " << myFont1.GetFontSize() << endl;
81
82
83
84 cout << "Finished" << endl;
85 return 0;
86}
87
int main(int argc, char **argv)
Definition FontTest.cpp:40
@ PFS_Underline
Definition PFont.h:48
@ PFS_Italic
Definition PFont.h:47
Definition PFont.h:53
virtual PColor GetBackgroundColor() const
Definition PFont.cpp:296
virtual int GetFontStyle() const
Definition PFont.h:84
virtual bool IsItalicFont() const
Definition PFont.cpp:373
virtual PColor GetFontColor() const
Definition PFont.cpp:289
virtual std::string GetFontFileName() const
Definition PFont.h:83
virtual bool IsUnderlineFont() const
Definition PFont.cpp:379
virtual bool IsBoldFont() const
Definition PFont.cpp:367
virtual bool GetAntiAliased() const
Definition PFont.h:88
virtual int GetFontSize() const
Definition PFont.h:85
virtual bool IsNormalFont() const
Definition PFont.cpp:362