GUIDOLib  1.7.7
Guido Engine Internal Documentation
FontManager.h
1 #ifndef __FontManager__
2 #define __FontManager__
3 
4 /*
5  GUIDO Library
6  Copyright (C) 2002 Holger Hoos, Juergen Kilian, Kai Renz
7  Copyright (C) 2004 Grame
8 
9  This Source Code Form is subject to the terms of the Mozilla Public
10  License, v. 2.0. If a copy of the MPL was not distributed with this
11  file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 
13  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
14  research@grame.fr
15 
16 */
17 
18 #include <vector>
19 #include <string>
20 #include "VGSystem.h"
21 
22 #ifdef SMUFL
23 #define TIMESIGSPACE 6
24 #else
25 #define TIMESIGSPACE 0
26 #endif
27 
28 extern const char* kMusicFontStr;
29 
30 class VGFont;
31 class ARFontAble;
32 
37 class FontInfo
38 {
39  public:
40  FontInfo( const VGFont * fontRef, int size, const std::string& name, const std::string& attributes );
41  virtual ~FontInfo();
42  bool Compare( int size, const std::string& name, const std::string& attributes ) const;
43 
44  const VGFont * mFontRef;
45 
46  protected:
47  int mSize;
48  std::string mName;
49  std::string mAttrib;
50 };
51 
52 typedef std::vector<FontInfo *> FontInfoList;
56 {
57  static FontInfoList sFontList;
58 
59  public:
61  virtual ~FontManager();
62 
63  static const VGFont * FindOrCreateFont(VGSystem* sys, int size, const char* name = 0, const char * attributes = 0 );
64  static const VGFont * FindOrCreateFont( int size, const char * name = 0, const char * attributes = 0 );
65  static const VGFont * GetTextFont( const ARFontAble* ar, float lspace, unsigned int& textalign);
66  static void ReleaseAllFonts();
67 
68  static float ComputeSymbolsStrWidth (VGDevice* hdc, const std::string& str, float spacing=TIMESIGSPACE);
69 
70  static const VGFont * gFontScriab;
71  static const VGFont * gFontText;
72  static std::string kDefaultMusicFont;
73  static std::string kDefaultTextFont;
74 };
75 
76 #endif
FontInfo::mAttrib
std::string mAttrib
Definition: FontManager.h:49
FontInfo::Compare
bool Compare(int size, const std::string &name, const std::string &attributes) const
FontInfo::mFontRef
const VGFont * mFontRef
Definition: FontManager.h:44
FontManager::kDefaultMusicFont
static std::string kDefaultMusicFont
Definition: FontManager.h:72
FontInfo::mName
std::string mName
Definition: FontManager.h:48
FontManager::ReleaseAllFonts
static void ReleaseAllFonts()
FontInfo::FontInfo
FontInfo(const VGFont *fontRef, int size, const std::string &name, const std::string &attributes)
FontManager::FontManager
FontManager()
Definition: FontManager.h:60
ARFontAble
Definition: ARFontAble.h:21
FontManager::GetTextFont
static const VGFont * GetTextFont(const ARFontAble *ar, float lspace, unsigned int &textalign)
FontManager::gFontScriab
static const VGFont * gFontScriab
Definition: FontManager.h:70
FontInfo::mSize
int mSize
Definition: FontManager.h:47
VGSystem
Generic pure virtual class for manipulating platform independant drawing devices and fonts.
Definition: VGSystem.h:61
FontManager::~FontManager
virtual ~FontManager()
FontManager::ComputeSymbolsStrWidth
static float ComputeSymbolsStrWidth(VGDevice *hdc, const std::string &str, float spacing=TIMESIGSPACE)
FontManager::gFontText
static const VGFont * gFontText
Definition: FontManager.h:71
FontInfo::~FontInfo
virtual ~FontInfo()
VGDevice
Generic platform independant drawing device.
Definition: VGDevice.h:68
FontInfo
Description of a font: name, font size and attributes.
Definition: FontManager.h:37
VGFont
Generic pure virtual & device-independant font class.
Definition: VGFont.h:36
FontManager::FindOrCreateFont
static const VGFont * FindOrCreateFont(VGSystem *sys, int size, const char *name=0, const char *attributes=0)
FontManager
Handles the list of all fonts used by the Guido Library.
Definition: FontManager.h:55
FontManager::kDefaultTextFont
static std::string kDefaultTextFont
Definition: FontManager.h:73

Guido Project Copyright © 2019 Grame-CNCM