Patryk Konopka 10 years ago
parent
commit
443bbb5c66

+ 1 - 1
Build/cmake/FileList.cmake

@@ -41,7 +41,7 @@ set(Core_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFace.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFace.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFaceHandle.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFaceHandle.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFamily.h
     ${PROJECT_SOURCE_DIR}/Source/Core/FreeType/FontFamily.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/BM_Font.h
+    ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/BitmapFontDefinitions.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontParser.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontParser.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFace.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFace.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFaceHandle.h
     ${PROJECT_SOURCE_DIR}/Source/Core/BitmapFont/FontFaceHandle.h

+ 2 - 39
Source/Core/BitmapFont/BM_Font.h → Source/Core/BitmapFont/BitmapFontDefinitions.h

@@ -37,36 +37,14 @@ namespace Rocket {
 namespace Core {
 namespace Core {
 namespace BitmapFont {
 namespace BitmapFont {
 
 
-    struct Padding
-    {
-        int Up,
-            Right,
-            Down,
-            Left;
-    };
-
-    struct Spacing
-    {
-        int Horizontal,
-            Vertical;
-    };
-
     struct FontInfo
     struct FontInfo
     {
     {
         String FamilyName;
         String FamilyName;
         String Source;
         String Source;
-        String Directory;
+        String BitmapSource;
         int Size;
         int Size;
         Font::Style Style;
         Font::Style Style;
         Font::Weight Weight;
         Font::Weight Weight;
-        String CharsetName;
-        bool IsUnicode;
-        int StretchHeight;
-        bool IsSmoothed;
-        int SuperSamplingLevel;
-        Padding FontPadding;
-        Spacing FontSpacing;
-        int Outline;
     };
     };
 
 
     struct CharacterCommonInfo
     struct CharacterCommonInfo
@@ -75,22 +53,10 @@ namespace BitmapFont {
         int BaseLine;
         int BaseLine;
         int ScaleWidth;
         int ScaleWidth;
         int ScaleHeight;
         int ScaleHeight;
-        int PageCount;
-        bool IsPacked;
-        int AlphaChanelUsage;
-        int RedChanelUsage;
-        int GreenChanelUsage;
-        int BlueChanelUsage;
         int CharacterCount;
         int CharacterCount;
         int KerningCount;
         int KerningCount;
     };
     };
 
 
-    struct PageInfo
-    {
-        int Id;
-        String FileName;
-    };
-
     struct CharacterInfo
     struct CharacterInfo
     {
     {
         int Id;
         int Id;
@@ -101,8 +67,6 @@ namespace BitmapFont {
         int XOffset;
         int XOffset;
         int YOffset;
         int YOffset;
         int Advance;
         int Advance;
-        int PageId;
-        int ChannelUsed;
     };
     };
 
 
     struct KerningInfo
     struct KerningInfo
@@ -112,12 +76,11 @@ namespace BitmapFont {
         int KerningAmount;
         int KerningAmount;
     };
     };
 
 
-    class BM_Font
+    class BitmapFontDefinitions
     {
     {
     public:
     public:
         FontInfo Face;
         FontInfo Face;
         CharacterCommonInfo CommonCharactersInfo;
         CharacterCommonInfo CommonCharactersInfo;
-        PageInfo *PagesInfo;
         CharacterInfo *CharactersInfo;
         CharacterInfo *CharactersInfo;
         KerningInfo *KerningsInfo;
         KerningInfo *KerningsInfo;
 
 

+ 1 - 1
Source/Core/BitmapFont/FontFace.cpp

@@ -34,7 +34,7 @@ namespace Rocket {
 namespace Core {
 namespace Core {
 namespace BitmapFont {
 namespace BitmapFont {
 
 
-FontFace::FontFace(BM_Font *_face, Font::Style _style, Font::Weight _weight, bool _release_stream) : Rocket::Core::FontFace(_style, _weight, _release_stream)
+FontFace::FontFace(BitmapFontDefinitions *_face, Font::Style _style, Font::Weight _weight, bool _release_stream) : Rocket::Core::FontFace(_style, _weight, _release_stream)
 {
 {
     face = _face;
     face = _face;
 }
 }

+ 3 - 3
Source/Core/BitmapFont/FontFace.h

@@ -29,7 +29,7 @@
 #define ROCKETCOREBITMAPFONTFACE_H
 #define ROCKETCOREBITMAPFONTFACE_H
 
 
 #include "../../../Include/Rocket/Core/FontFace.h"
 #include "../../../Include/Rocket/Core/FontFace.h"
-#include "BM_Font.h"
+#include "BitmapFontDefinitions.h"
 
 
 namespace Rocket {
 namespace Rocket {
 namespace Core {
 namespace Core {
@@ -44,7 +44,7 @@ class FontFaceHandle;
 class FontFace : public Rocket::Core::FontFace
 class FontFace : public Rocket::Core::FontFace
 {
 {
 public:
 public:
-    FontFace(BM_Font *_face, Font::Style style, Font::Weight weight, bool release_stream);
+    FontFace(BitmapFontDefinitions *_face, Font::Style style, Font::Weight weight, bool release_stream);
     ~FontFace();
     ~FontFace();
 
 
     /// Returns a handle for positioning and rendering this face at the given size.
     /// Returns a handle for positioning and rendering this face at the given size.
@@ -58,7 +58,7 @@ public:
     void ReleaseFace();
     void ReleaseFace();
 
 
 private:
 private:
-    BM_Font *face;
+    BitmapFontDefinitions *face;
 };
 };
 
 
 }
 }

+ 21 - 16
Source/Core/BitmapFont/FontFaceHandle.cpp

@@ -63,16 +63,28 @@ FontFaceHandle::~FontFaceHandle()
 }
 }
 
 
 // Initialises the handle so it is able to render text.
 // Initialises the handle so it is able to render text.
-bool FontFaceHandle::Initialise(BM_Font *bm_face, const String& _charset, int _size)
+bool FontFaceHandle::Initialise(BitmapFontDefinitions *bm_face, const String& _charset, int _size)
 {
 {
-    ROCKET_ASSERT( bm_face->CommonCharactersInfo.ScaleHeight == bm_face->CommonCharactersInfo.ScaleWidth );
-
     size = _size;
     size = _size;
-    TextureBaseName = bm_face->Face.Source;
-    TextureDirectory = bm_face->Face.Directory;
-    TextureSize = bm_face->CommonCharactersInfo.ScaleHeight;
+    TextureWidth = bm_face->CommonCharactersInfo.ScaleWidth;
+    TextureHeight = bm_face->CommonCharactersInfo.ScaleHeight;
     raw_charset = _charset;
     raw_charset = _charset;
 
 
+    URL fnt_source = bm_face->Face.Source;
+    URL bitmap_source = bm_face->Face.BitmapSource;
+    if(bitmap_source.GetPath().Empty())
+    {
+        TextureSource = fnt_source.GetPath() + bitmap_source.GetFileName();
+        if(!bitmap_source.GetExtension().Empty())
+        {
+            TextureSource += "." + bitmap_source.GetExtension();
+        }
+    }
+    else
+    {
+        TextureSource = bitmap_source.GetPathedFileName();
+    }
+
     if (!UnicodeRange::BuildList(charset, raw_charset))
     if (!UnicodeRange::BuildList(charset, raw_charset))
     {
     {
         Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", raw_charset.CString());
         Log::Message(Log::LT_ERROR, "Invalid font charset '%s'.", raw_charset.CString());
@@ -86,13 +98,11 @@ bool FontFaceHandle::Initialise(BM_Font *bm_face, const String& _charset, int _s
     // Generate the metrics for the handle.
     // Generate the metrics for the handle.
     GenerateMetrics(bm_face);
     GenerateMetrics(bm_face);
 
 
-
     // Generate the default layer and layer configuration.
     // Generate the default layer and layer configuration.
     base_layer = GenerateLayer(NULL);
     base_layer = GenerateLayer(NULL);
     layer_configurations.push_back(LayerConfiguration());
     layer_configurations.push_back(LayerConfiguration());
     layer_configurations.back().push_back(base_layer);
     layer_configurations.back().push_back(base_layer);
 
 
-
     return true;
     return true;
 }
 }
 
 
@@ -288,7 +298,7 @@ void FontFaceHandle::OnReferenceDeactivate()
     delete this;
     delete this;
 }
 }
 
 
-void FontFaceHandle::GenerateMetrics(BM_Font *bm_face)
+void FontFaceHandle::GenerateMetrics(BitmapFontDefinitions *bm_face)
 {
 {
     line_height = bm_face->CommonCharactersInfo.LineHeight;
     line_height = bm_face->CommonCharactersInfo.LineHeight;
     baseline = bm_face->CommonCharactersInfo.BaseLine;
     baseline = bm_face->CommonCharactersInfo.BaseLine;
@@ -316,7 +326,7 @@ void FontFaceHandle::GenerateMetrics(BM_Font *bm_face)
         x_height = 0;
         x_height = 0;
 }
 }
 
 
-void FontFaceHandle::BuildGlyphMap(BM_Font *bm_face, const UnicodeRange& unicode_range)
+void FontFaceHandle::BuildGlyphMap(BitmapFontDefinitions *bm_face, const UnicodeRange& unicode_range)
 {
 {
     glyphs.resize(unicode_range.max_codepoint + 1);
     glyphs.resize(unicode_range.max_codepoint + 1);
 
 
@@ -349,11 +359,6 @@ void Rocket::Core::BitmapFont::FontFaceHandle::BuildGlyph(FontGlyph& glyph, Char
     // Set the glyph's advance.
     // Set the glyph's advance.
     glyph.advance = bm_glyph->Advance;
     glyph.advance = bm_glyph->Advance;
 
 
-    if ( bm_glyph->PageId > 0 )
-    {
-        Log::Message( Log::LT_WARNING, "Multiple page not supported" );
-    }
-
     // Set the glyph's bitmap position.
     // Set the glyph's bitmap position.
     glyph.bitmap_dimensions.x = bm_glyph->X;
     glyph.bitmap_dimensions.x = bm_glyph->X;
     glyph.bitmap_dimensions.y = bm_glyph->Y;
     glyph.bitmap_dimensions.y = bm_glyph->Y;
@@ -361,7 +366,7 @@ void Rocket::Core::BitmapFont::FontFaceHandle::BuildGlyph(FontGlyph& glyph, Char
     glyph.bitmap_data = NULL;
     glyph.bitmap_data = NULL;
 }
 }
 
 
-void Rocket::Core::BitmapFont::FontFaceHandle::BuildKerning(BM_Font *bm_face)
+void Rocket::Core::BitmapFont::FontFaceHandle::BuildKerning(BitmapFontDefinitions *bm_face)
 {
 {
     // Compile the kerning information for this character if the font includes it.
     // Compile the kerning information for this character if the font includes it.
 //    if ( bm_face->CommonCharactersInfo.KerningCount > 0 )
 //    if ( bm_face->CommonCharactersInfo.KerningCount > 0 )

+ 14 - 14
Source/Core/BitmapFont/FontFaceHandle.h

@@ -36,7 +36,7 @@
 #include "../../../Include/Rocket/Core/String.h"
 #include "../../../Include/Rocket/Core/String.h"
 #include "../../../Include/Rocket/Core/Texture.h"
 #include "../../../Include/Rocket/Core/Texture.h"
 #include "../FontFaceHandle.h"
 #include "../FontFaceHandle.h"
-#include "BM_Font.h"
+#include "BitmapFontDefinitions.h"
 
 
 namespace Rocket {
 namespace Rocket {
 namespace Core {
 namespace Core {
@@ -57,7 +57,7 @@ public:
     /// @param[in] charset The comma-separated list of unicode ranges this handle must support.
     /// @param[in] charset The comma-separated list of unicode ranges this handle must support.
     /// @param[in] size The size, in points, of the face this handle should render at.
     /// @param[in] size The size, in points, of the face this handle should render at.
     /// @return True if the handle initialised successfully and is ready for rendering, false if an error occured.
     /// @return True if the handle initialised successfully and is ready for rendering, false if an error occured.
-    bool Initialise(BM_Font *ft_face, const String& charset, int size);
+    bool Initialise(BitmapFontDefinitions *ft_face, const String& charset, int size);
 
 
     /// Returns the width a string will take up if rendered with this handle.
     /// Returns the width a string will take up if rendered with this handle.
     /// @param[in] string The string to measure.
     /// @param[in] string The string to measure.
@@ -93,41 +93,41 @@ public:
     /// @param[in] colour The colour to draw the line in.
     /// @param[in] colour The colour to draw the line in.
     void GenerateLine(Geometry* geometry, const Vector2f& position, int width, Font::Line height, const Colourb& colour) const;
     void GenerateLine(Geometry* geometry, const Vector2f& position, int width, Font::Line height, const Colourb& colour) const;
 
 
-    const String & GetTextureBaseName() const
+    const String & GetTextureSource() const
     {
     {
-        return TextureBaseName;
+        return TextureSource;
     }
     }
 
 
-    const String & GetTextureDirectory() const
+    unsigned int GetTextureWidth() const
     {
     {
-        return TextureDirectory;
+        return TextureWidth;
     }
     }
 
 
-    int GetTextureSize() const
+    unsigned int GetTextureHeight() const
     {
     {
-        return TextureSize;
+        return TextureHeight;
     }
     }
 
 
-
 protected:
 protected:
     /// Destroys the handle.
     /// Destroys the handle.
     virtual void OnReferenceDeactivate();
     virtual void OnReferenceDeactivate();
 
 
 private:
 private:
-    void GenerateMetrics(BM_Font *bm_face);
+    void GenerateMetrics(BitmapFontDefinitions *bm_face);
 
 
-    void BuildGlyphMap(BM_Font *bm_face, const UnicodeRange& unicode_range);
+    void BuildGlyphMap(BitmapFontDefinitions *bm_face, const UnicodeRange& unicode_range);
     void BuildGlyph(FontGlyph& glyph, CharacterInfo *ft_glyph);
     void BuildGlyph(FontGlyph& glyph, CharacterInfo *ft_glyph);
 
 
-    void BuildKerning(BM_Font *bm_face);
+    void BuildKerning(BitmapFontDefinitions *bm_face);
     int GetKerning(word lhs, word rhs) const;
     int GetKerning(word lhs, word rhs) const;
 
 
     // Generates (or shares) a layer derived from a font effect.
     // Generates (or shares) a layer derived from a font effect.
     virtual FontFaceLayer* GenerateLayer(FontEffect* font_effect);
     virtual FontFaceLayer* GenerateLayer(FontEffect* font_effect);
 
 
-    String TextureBaseName;
+    String TextureSource;
     String TextureDirectory;
     String TextureDirectory;
-    int TextureSize;
+    unsigned int TextureWidth;
+    unsigned int TextureHeight;
 };
 };
 
 
 }
 }

+ 11 - 11
Source/Core/BitmapFont/FontFaceLayer.cpp

@@ -76,6 +76,13 @@ bool FontFaceLayer::Initialise(const Rocket::Core::FontFaceHandle* _handle, Font
     }
     }
     else
     else
     {
     {
+        // Load texture from file
+        Texture texture;
+        if (!texture.Load( bm_font_face_handle->GetTextureSource() ))
+            return false;
+
+        textures.push_back(texture);
+
         // Initialise the texture layout for the glyphs.
         // Initialise the texture layout for the glyphs.
         characters.resize(glyphs.size(), Character());
         characters.resize(glyphs.size(), Character());
         for (FontGlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i)
         for (FontGlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i)
@@ -96,16 +103,15 @@ bool FontFaceLayer::Initialise(const Rocket::Core::FontFaceHandle* _handle, Font
             character.texture_index = 0;
             character.texture_index = 0;
 
 
             // Generate the character's texture coordinates.
             // Generate the character's texture coordinates.
-            character.texcoords[0].x = float(glyph_origin.x) / float(bm_font_face_handle->GetTextureSize());
-            character.texcoords[0].y = float(glyph_origin.y) / float(bm_font_face_handle->GetTextureSize());
-            character.texcoords[1].x = float(glyph_origin.x + character.dimensions.x) / float(bm_font_face_handle->GetTextureSize());
-            character.texcoords[1].y = float(glyph_origin.y + character.dimensions.y) / float(bm_font_face_handle->GetTextureSize());
+            character.texcoords[0].x = float(glyph_origin.x) / float(bm_font_face_handle->GetTextureWidth());
+            character.texcoords[0].y = float(glyph_origin.y) / float(bm_font_face_handle->GetTextureHeight());
+            character.texcoords[1].x = float(glyph_origin.x + character.dimensions.x) / float(bm_font_face_handle->GetTextureWidth());
+            character.texcoords[1].y = float(glyph_origin.y + character.dimensions.y) / float(bm_font_face_handle->GetTextureHeight());
 
 
             characters[glyph.character] = character;
             characters[glyph.character] = character;
 
 
             // Add the character's dimensions into the texture layout engine.
             // Add the character's dimensions into the texture layout engine.
             texture_layout.AddRectangle(glyph.character, glyph_dimensions);
             texture_layout.AddRectangle(glyph.character, glyph_dimensions);
-
         }
         }
 
 
         // Generate the texture layout; this will position the glyph rectangles efficiently and
         // Generate the texture layout; this will position the glyph rectangles efficiently and
@@ -113,13 +119,7 @@ bool FontFaceLayer::Initialise(const Rocket::Core::FontFaceHandle* _handle, Font
         if (!texture_layout.GenerateLayout(512))
         if (!texture_layout.GenerateLayout(512))
             return false;
             return false;
 
 
-        Texture texture;
-        if (!texture.Load( bm_font_face_handle->GetTextureBaseName() + "_0.tga", bm_font_face_handle->GetTextureDirectory() ) )
-            return false;
-        textures.push_back(texture);
     }
     }
-
-
     return true;
     return true;
 }
 }
 
 

+ 1 - 1
Source/Core/BitmapFont/FontFamily.cpp

@@ -44,7 +44,7 @@ FontFamily::~FontFamily()
 // Adds a new face to the family.
 // Adds a new face to the family.
 bool FontFamily::AddFace( void *bm_face, Font::Style style, Font::Weight weight, bool release_stream)
 bool FontFamily::AddFace( void *bm_face, Font::Style style, Font::Weight weight, bool release_stream)
 {
 {
-    Rocket::Core::FontFace* face = new FontFace((BM_Font*)bm_face, style, weight, release_stream);
+    Rocket::Core::FontFace* face = new FontFace((BitmapFontDefinitions*)bm_face, style, weight, release_stream);
     font_faces.push_back(face);
     font_faces.push_back(face);
 
 
     return true;
     return true;

+ 1 - 1
Source/Core/BitmapFont/FontFamily.h

@@ -30,7 +30,7 @@
 
 
 #include "../../../Include/Rocket/Core/Font.h"
 #include "../../../Include/Rocket/Core/Font.h"
 #include "../../../Include/Rocket/Core/FontFamily.h"
 #include "../../../Include/Rocket/Core/FontFamily.h"
-#include "BM_Font.h"
+#include "BitmapFontDefinitions.h"
 
 
 namespace Rocket {
 namespace Rocket {
 namespace Core {
 namespace Core {

+ 2 - 26
Source/Core/BitmapFont/FontParser.cpp

@@ -32,7 +32,7 @@ namespace Rocket {
 namespace Core {
 namespace Core {
 namespace BitmapFont {
 namespace BitmapFont {
 
 
-FontParser::FontParser( BM_Font *face )
+FontParser::FontParser( BitmapFontDefinitions *face )
     : BaseXMLParser()
     : BaseXMLParser()
 {
 {
     BM_face = face;
     BM_face = face;
@@ -53,39 +53,17 @@ void FontParser::HandleElementStart(const String& name, const XMLAttributes& att
         BM_face->Face.Size = attributes.Get( "size" )->Get< int >();
         BM_face->Face.Size = attributes.Get( "size" )->Get< int >();
         BM_face->Face.Weight = attributes.Get( "bold" )->Get< bool >() ? Font::WEIGHT_BOLD : Font::WEIGHT_NORMAL;
         BM_face->Face.Weight = attributes.Get( "bold" )->Get< bool >() ? Font::WEIGHT_BOLD : Font::WEIGHT_NORMAL;
         BM_face->Face.Style = attributes.Get( "italic" )->Get< bool >() ? Font::STYLE_ITALIC : Font::STYLE_NORMAL;
         BM_face->Face.Style = attributes.Get( "italic" )->Get< bool >() ? Font::STYLE_ITALIC : Font::STYLE_NORMAL;
-        BM_face->Face.CharsetName = attributes.Get( "charset" )->Get< String >();
-        BM_face->Face.IsUnicode = attributes.Get( "unicode" )->Get< bool >();
-        BM_face->Face.StretchHeight = attributes.Get( "stretchH" )->Get< int >();
-        BM_face->Face.IsSmoothed = attributes.Get( "smooth" )->Get< bool >();
-        BM_face->Face.SuperSamplingLevel = attributes.Get( "aa" )->Get< int >();
-        //:TODO:
-        //BM_face->Face.FamilyName = attributes.Get( "padding" )->Get< String >();
-        //BM_face->Face.FamilyName = attributes.Get( "spacing" )->Get< String >();
-        BM_face->Face.Outline = attributes.Get( "outline" )->Get< int >();
+        BM_face->Face.BitmapSource = attributes.Get( "src" )->Get< String >();
     }
     }
     else if ( name == "common" )
     else if ( name == "common" )
     {
     {
-
         BM_face->CommonCharactersInfo.LineHeight = attributes.Get( "lineHeight" )->Get< int >();
         BM_face->CommonCharactersInfo.LineHeight = attributes.Get( "lineHeight" )->Get< int >();
         BM_face->CommonCharactersInfo.BaseLine = attributes.Get( "base" )->Get< int >();
         BM_face->CommonCharactersInfo.BaseLine = attributes.Get( "base" )->Get< int >();
         BM_face->CommonCharactersInfo.ScaleWidth = attributes.Get( "scaleW" )->Get< int >();
         BM_face->CommonCharactersInfo.ScaleWidth = attributes.Get( "scaleW" )->Get< int >();
         BM_face->CommonCharactersInfo.ScaleHeight = attributes.Get( "scaleH" )->Get< int >();
         BM_face->CommonCharactersInfo.ScaleHeight = attributes.Get( "scaleH" )->Get< int >();
-        BM_face->CommonCharactersInfo.PageCount = attributes.Get( "pages" )->Get< int >();
-        BM_face->CommonCharactersInfo.IsPacked = attributes.Get( "packed" )->Get< bool >();
-        BM_face->CommonCharactersInfo.AlphaChanelUsage = attributes.Get( "alphaChnl" )->Get< int >();
-        BM_face->CommonCharactersInfo.RedChanelUsage = attributes.Get( "redChnl" )->Get< int >();
-        BM_face->CommonCharactersInfo.GreenChanelUsage = attributes.Get( "greenChnl" )->Get< int >();
-        BM_face->CommonCharactersInfo.BlueChanelUsage = attributes.Get( "blueChnl" )->Get< int >();
-
-        BM_face->PagesInfo = new PageInfo[BM_face->CommonCharactersInfo.PageCount];
         BM_face->CommonCharactersInfo.CharacterCount = 0;
         BM_face->CommonCharactersInfo.CharacterCount = 0;
         BM_face->CommonCharactersInfo.KerningCount = 0;
         BM_face->CommonCharactersInfo.KerningCount = 0;
     }
     }
-    else if ( name == "page" )
-    {
-        BM_face->PagesInfo[ attributes.Get( "id" )->Get< int >() ].Id = attributes.Get( "id" )->Get< int >();
-        BM_face->PagesInfo[ attributes.Get( "id" )->Get< int >() ].FileName = attributes.Get( "file" )->Get< String >();
-    }
     else if ( name == "chars" )
     else if ( name == "chars" )
     {
     {
         BM_face->CommonCharactersInfo.CharacterCount = attributes.Get( "count" )->Get< int >();
         BM_face->CommonCharactersInfo.CharacterCount = attributes.Get( "count" )->Get< int >();
@@ -101,8 +79,6 @@ void FontParser::HandleElementStart(const String& name, const XMLAttributes& att
         BM_face->CharactersInfo[ char_id ].XOffset = attributes.Get( "xoffset" )->Get< int >();
         BM_face->CharactersInfo[ char_id ].XOffset = attributes.Get( "xoffset" )->Get< int >();
         BM_face->CharactersInfo[ char_id ].YOffset = attributes.Get( "yoffset" )->Get< int >();
         BM_face->CharactersInfo[ char_id ].YOffset = attributes.Get( "yoffset" )->Get< int >();
         BM_face->CharactersInfo[ char_id ].Advance = attributes.Get( "xadvance" )->Get< int >();
         BM_face->CharactersInfo[ char_id ].Advance = attributes.Get( "xadvance" )->Get< int >();
-        BM_face->CharactersInfo[ char_id ].PageId = attributes.Get( "page" )->Get< int >();
-        BM_face->CharactersInfo[ char_id ].ChannelUsed = attributes.Get( "chnl" )->Get< int >();
 
 
         char_id++;
         char_id++;
     }
     }

+ 3 - 3
Source/Core/BitmapFont/FontParser.h

@@ -31,7 +31,7 @@
 #include <Rocket/Core/Header.h>
 #include <Rocket/Core/Header.h>
 #include <Rocket/Core/Types.h>
 #include <Rocket/Core/Types.h>
 #include <Rocket/Core/Dictionary.h>
 #include <Rocket/Core/Dictionary.h>
-#include "BM_Font.h"
+#include "BitmapFontDefinitions.h"
 #include <set>
 #include <set>
 
 
 namespace Rocket {
 namespace Rocket {
@@ -45,7 +45,7 @@ namespace BitmapFont {
 class FontParser : public BaseXMLParser
 class FontParser : public BaseXMLParser
 {
 {
     public:
     public:
-        FontParser( BM_Font *face );
+        FontParser( BitmapFontDefinitions *face );
         virtual ~FontParser();
         virtual ~FontParser();
 
 
         /// Called when the parser finds the beginning of an element tag.
         /// Called when the parser finds the beginning of an element tag.
@@ -57,7 +57,7 @@ class FontParser : public BaseXMLParser
 
 
     private:
     private:
         FontParser();
         FontParser();
-        BM_Font *BM_face;
+        BitmapFontDefinitions *BM_face;
         int char_id;
         int char_id;
         int kern_id;
         int kern_id;
 };
 };

+ 8 - 14
Source/Core/BitmapFont/FontProvider.cpp

@@ -32,7 +32,7 @@
 #include <Rocket/Core/StreamMemory.h>
 #include <Rocket/Core/StreamMemory.h>
 #include "FontFamily.h"
 #include "FontFamily.h"
 #include <Rocket/Core.h>
 #include <Rocket/Core.h>
-#include "BM_Font.h"
+#include "BitmapFontDefinitions.h"
 #include "FontParser.h"
 #include "FontParser.h"
 
 
 namespace Rocket {
 namespace Rocket {
@@ -79,7 +79,7 @@ void FontProvider::Shutdown()
 // Adds a new font face to the database, ignoring any family, style and weight information stored in the face itself.
 // Adds a new font face to the database, ignoring any family, style and weight information stored in the face itself.
 bool FontProvider::LoadFontFace(const String& file_name)
 bool FontProvider::LoadFontFace(const String& file_name)
 {
 {
-    BM_Font *bm_font = (BM_Font*) instance->LoadFace(file_name);
+    BitmapFontDefinitions *bm_font = (BitmapFontDefinitions*) instance->LoadFace(file_name);
 
 
     if (bm_font == NULL)
     if (bm_font == NULL)
     {
     {
@@ -107,7 +107,7 @@ bool FontProvider::LoadFontFace(const String& file_name)
 // Loads a new font face.
 // Loads a new font face.
 bool FontProvider::LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight)
 bool FontProvider::LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight)
 {
 {
-    BM_Font *bm_font = (BM_Font*) instance->LoadFace(file_name);
+    BitmapFontDefinitions *bm_font = (BitmapFontDefinitions*) instance->LoadFace(file_name);
     if (bm_font == NULL)
     if (bm_font == NULL)
     {
     {
         Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.CString());
         Log::Message(Log::LT_ERROR, "Failed to load font face from %s.", file_name.CString());
@@ -185,14 +185,14 @@ bool FontProvider::AddFace(void* face, const String& family, Font::Style style,
         instance->font_families[family] = font_family;
         instance->font_families[family] = font_family;
     }
     }
 
 
-    return font_family->AddFace((BM_Font *) face, style, weight, release_stream);
+    return font_family->AddFace((BitmapFontDefinitions *) face, style, weight, release_stream);
     return true;
     return true;
 }
 }
 
 
 // Loads a FreeType face.
 // Loads a FreeType face.
 void* FontProvider::LoadFace(const String& file_name)
 void* FontProvider::LoadFace(const String& file_name)
 {
 {
-    BM_Font *bm_face = new BM_Font();
+    BitmapFontDefinitions *bm_face = new BitmapFontDefinitions();
     FontParser parser( bm_face );
     FontParser parser( bm_face );
 
 
     FileInterface* file_interface = GetFileInterface();
     FileInterface* file_interface = GetFileInterface();
@@ -214,11 +214,7 @@ void* FontProvider::LoadFace(const String& file_name)
 
 
     parser.Parse( stream );
     parser.Parse( stream );
 
 
-    URL file_url = file_name;
-
-    bm_face->Face.Source = file_url.GetFileName();
-    bm_face->Face.Directory = file_url.GetPath();
-
+    bm_face->Face.Source = file_name;
     return bm_face;
     return bm_face;
 }
 }
 
 
@@ -227,16 +223,14 @@ void* FontProvider::LoadFace(const byte* data, int data_length, const String& so
 {
 {
     URL file_url = source + ".fnt";
     URL file_url = source + ".fnt";
 
 
-    BM_Font *bm_face = new BM_Font();
+    BitmapFontDefinitions *bm_face = new BitmapFontDefinitions();
     FontParser parser( bm_face );
     FontParser parser( bm_face );
     StreamMemory* stream = new StreamMemory( data, data_length );
     StreamMemory* stream = new StreamMemory( data, data_length );
     stream->SetSourceURL( file_url );
     stream->SetSourceURL( file_url );
 
 
     parser.Parse( stream );
     parser.Parse( stream );
 
 
-    bm_face->Face.Source = file_url.GetFileName();
-    bm_face->Face.Directory = file_url.GetPath();
-
+    bm_face->Face.Source = file_url.GetPathedFileName();
     return bm_face;
     return bm_face;
 }
 }