GUIDOLib  1.7.7
Guido Engine Internal Documentation
NullGFont.h
1 #ifndef __NullGFont__
2 #define __NullGFont__
3 
4 /*
5  GUIDO Library
6  Copyright (C) 2006 Grame
7 
8  This Source Code Form is subject to the terms of the Mozilla Public
9  License, v. 2.0. If a copy of the MPL was not distributed with this
10  file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 
12  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
13  research@grame.fr
14 
15 */
16 
17 #include <string>
18 #include "VGFont.h"
19 #include "VGDevice.h"
20 
21 // --------------------------------------------------------------
22 // Null Graphic Font class
23 // --------------------------------------------------------------
27 class NullGFont : public VGFont
28 {
29  protected:
30  std::string fName;
31  int fSize;
33  public:
34  NullGFont(std::string name, int size, int prop)
35  : fName(name), fSize(size), fProperties(prop) {}
36  virtual ~NullGFont() {}
37 
38  // - VGFont services ---------------------------------------------
39  virtual const char * GetName() const { return fName.c_str(); }
40  virtual int GetSize() const { return fSize; }
41  virtual int GetProperties() const { return fProperties; }
42 
43  // - Symbol services ---------------------------------------------
44  virtual void GetExtent( const char * s, int inCharCount, float * outWidth, float * outHeight, VGDevice * context = 0) const
45  { *outWidth = float(fSize*inCharCount); *outHeight = float(fSize); }
46  virtual void GetExtent( int c, float * outWidth, float * outHeight, VGDevice * context = 0) const
47  { *outWidth = *outHeight = float(fSize); }
48 };
49 
50 
51 #endif
NullGFont::GetExtent
virtual void GetExtent(int c, float *outWidth, float *outHeight, VGDevice *context=0) const
Definition: NullGFont.h:46
NullGFont::~NullGFont
virtual ~NullGFont()
Definition: NullGFont.h:36
NullGFont::fProperties
int fProperties
Definition: NullGFont.h:32
NullGFont::GetExtent
virtual void GetExtent(const char *s, int inCharCount, float *outWidth, float *outHeight, VGDevice *context=0) const
Definition: NullGFont.h:44
VGDevice
Generic platform independant drawing device.
Definition: VGDevice.h:68
NullGFont::fSize
int fSize
Definition: NullGFont.h:31
NullGFont::GetName
virtual const char * GetName() const
Returns the current object's name (as a string)
Definition: NullGFont.h:39
NullGFont::fName
std::string fName
Definition: NullGFont.h:30
VGFont
Generic pure virtual & device-independant font class.
Definition: VGFont.h:36
NullGFont::GetSize
virtual int GetSize() const
Returns the current object's size (as an int)
Definition: NullGFont.h:40
NullGFont
Generic pure virtual & device-independant font class.
Definition: NullGFont.h:27
NullGFont::GetProperties
virtual int GetProperties() const
Returns the current object's property value(s) (see enum above)
Definition: NullGFont.h:41
NullGFont::NullGFont
NullGFont(std::string name, int size, int prop)
Definition: NullGFont.h:34

Guido Project Copyright © 2019 Grame-CNCM