Skip to content

Commit

Permalink
Refactor|Fonts|Resources|Client: Continued remodeling Fonts collection
Browse files Browse the repository at this point in the history
Note that it does not yet build and is presently a rather messy...
  • Loading branch information
danij-deng committed Nov 15, 2013
1 parent 488563e commit 66ce9a3
Show file tree
Hide file tree
Showing 15 changed files with 1,211 additions and 1,165 deletions.
24 changes: 16 additions & 8 deletions doomsday/client/include/resource/abstractfont.h
Expand Up @@ -20,13 +20,17 @@
#ifndef CLIENT_RESOURCE_ABSTRACTFONT_H
#define CLIENT_RESOURCE_ABSTRACTFONT_H

#include "dd_types.h" // fontid_t
#include <de/Observers>
#include <de/Rectangle>
#include <de/Vector>
#include <QFlags>

#define MAX_CHARS 256 // Normal 256 ANSI characters.

namespace de {
class FontManifest;
}

/**
* Abstract font resource.
*
Expand All @@ -35,23 +39,30 @@
class AbstractFont
{
public:
DENG2_DEFINE_AUDIENCE(Deletion, void fontBeingDeleted(AbstractFont const &font))

enum Flag {
Colorize = 0x1, ///< Can be colored.
Shadowed = 0x2 ///< A shaodw is embedded in the font.
};
Q_DECLARE_FLAGS(Flags, Flag)

public:
/// Unique identifier of the primary binding in the owning collection.
fontid_t _primaryBind;
/// Resource manifest for the font.
de::FontManifest &_manifest;

Flags _flags;

AbstractFont(fontid_t bindId = 0);
virtual ~AbstractFont() {}
AbstractFont(de::FontManifest &manifest);
virtual ~AbstractFont();

DENG2_AS_IS_METHODS()

/**
* Returns the resource manifest for the font.
*/
de::FontManifest &manifest() const;

/// @return Returns a copy of the font's flags.
Flags flags() const;

Expand All @@ -64,9 +75,6 @@ class AbstractFont

virtual de::Rectanglei const &glyphPosCoords(uchar ch) = 0;
virtual de::Rectanglei const &glyphTexCoords(uchar ch) = 0;

fontid_t primaryBind() const;
void setPrimaryBind(fontid_t bindId);
};

Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractFont::Flags)
Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/resource/bitmapfont.h
Expand Up @@ -34,9 +34,9 @@
class BitmapFont : public AbstractFont
{
public:
BitmapFont(fontid_t bindId);
BitmapFont(de::FontManifest &manifest);

static BitmapFont *fromFile(fontid_t bindId, de::String resourcePath);
static BitmapFont *fromFile(de::FontManifest &manifest, de::String resourcePath);

void setFilePath(de::String resourcePath);

Expand Down
4 changes: 2 additions & 2 deletions doomsday/client/include/resource/compositebitmapfont.h
Expand Up @@ -45,9 +45,9 @@ class CompositeBitmapFont : public AbstractFont
};

public:
CompositeBitmapFont(fontid_t bindId);
CompositeBitmapFont(de::FontManifest &manifest);

static CompositeBitmapFont *fromDef(fontid_t bindId, ded_compositefont_t *def);
static CompositeBitmapFont *fromDef(de::FontManifest &manifest, ded_compositefont_t const &def);

ded_compositefont_t *definition() const;
void setDefinition(ded_compositefont_t *newDef);
Expand Down

0 comments on commit 66ce9a3

Please sign in to comment.