2005-06-29 04:30:40 +00:00
|
|
|
//This file is part of Photon (http://photon.sourceforge.net)
|
|
|
|
//Copyright (C) 2004-2005 James Turk
|
|
|
|
//
|
|
|
|
// Author:
|
|
|
|
// James Turk (jpt2433@rit.edu)
|
|
|
|
//
|
|
|
|
// Version:
|
2005-08-08 21:39:40 +00:00
|
|
|
// $Id: FontResourceManager.hpp,v 1.5 2005/08/08 21:39:41 cozman Exp $
|
2005-06-29 04:30:40 +00:00
|
|
|
|
|
|
|
#ifndef PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP
|
|
|
|
#define PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP
|
|
|
|
|
|
|
|
#include "ResourceManager.hpp"
|
|
|
|
|
2005-08-08 21:39:40 +00:00
|
|
|
#include "ft2build.h"
|
2005-07-03 05:20:49 +00:00
|
|
|
#include FT_FREETYPE_H
|
2005-06-29 04:30:40 +00:00
|
|
|
|
|
|
|
namespace photon
|
|
|
|
{
|
|
|
|
namespace video
|
|
|
|
{
|
|
|
|
|
|
|
|
class FontResource : public Resource
|
|
|
|
{
|
|
|
|
public:
|
2005-07-03 05:20:49 +00:00
|
|
|
uint texID;
|
|
|
|
uint listBase;
|
|
|
|
std::vector<ubyte> widths;
|
|
|
|
ubyte height;
|
2005-06-29 04:30:40 +00:00
|
|
|
};
|
|
|
|
|
2005-07-03 06:33:19 +00:00
|
|
|
class FontResourceDescriptor : public ResourceDescriptor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FontResourceDescriptor(const std::string& str, uint sz) :
|
|
|
|
ResourceDescriptor(str), size(sz)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
public:
|
|
|
|
uint size;
|
|
|
|
};
|
|
|
|
|
|
|
|
class FontResourceManager : public ResourceManager<FontResource,
|
|
|
|
FontResourceDescriptor>
|
2005-06-29 04:30:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-07-03 05:20:49 +00:00
|
|
|
FontResourceManager();
|
|
|
|
~FontResourceManager();
|
|
|
|
|
|
|
|
void getFontData(const std::string& name, uint& texID, uint& listBase,
|
|
|
|
std::vector<ubyte>& widths, ubyte& height);
|
2005-06-29 04:30:40 +00:00
|
|
|
|
|
|
|
private:
|
2005-07-03 05:20:49 +00:00
|
|
|
|
2005-07-03 06:33:19 +00:00
|
|
|
virtual void loadResourceData(FontResource &res,
|
|
|
|
const FontResourceDescriptor& desc);
|
|
|
|
virtual void freeResourceData(FontResource &res);
|
2005-07-03 05:20:49 +00:00
|
|
|
|
|
|
|
private:
|
2005-07-18 07:19:48 +00:00
|
|
|
FT_Library library_; // only need one FT_Library, so manager owns it
|
2005-07-03 05:20:49 +00:00
|
|
|
public:
|
2005-07-18 07:19:48 +00:00
|
|
|
static const uint SPACE = 32;
|
|
|
|
static const uint NUM_CHARS = 96;
|
2005-06-29 04:30:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif //PHOTON_VIDEO_FONTRESOURCEMANAGER_HPP
|