Browse Source

Remove Font.h, unify enums.

Michael Ragazzon 6 years ago
parent
commit
5a0797fb8a

+ 0 - 1
Cmake/FileList.cmake

@@ -137,7 +137,6 @@ set(Core_PUB_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/EventListenerInstancer.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Factory.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FileInterface.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Font.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontDatabase.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffect.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/FontEffectInstancer.h

+ 3 - 4
Include/RmlUi/Core/BitmapFont/FontProvider.h

@@ -30,7 +30,6 @@
 #define RMLUICOREBITMAPFONTFONTPROVIDER_H
 
 #include "../StringUtilities.h"
-#include "../Font.h"
 #include "../FontProvider.h"
 
 namespace Rml {
@@ -66,7 +65,7 @@ public:
     /// @param[in] style The style of the face (normal or italic).
     /// @param[in] weight The weight of the face (normal or bold).
     /// @return True if the face was loaded successfully, false otherwise.
-    static bool LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight);
+    static bool LoadFontFace(const String& file_name, const String& family, Style::FontStyle style, Style::FontWeight weight);
     /// Adds a new font face to the database, loading from memory. The face's family, style and weight will be determined from the face itself.
     /// @param[in] data The font data.
     /// @param[in] data_length Length of the data.
@@ -79,14 +78,14 @@ public:
     /// @param[in] style The style of the face (normal or italic).
     /// @param[in] weight The weight of the face (normal or bold).
     /// @return True if the face was loaded successfully, false otherwise.
-    static bool LoadFontFace(const byte* data, int data_length, const String& family, Font::Style style, Font::Weight weight);
+    static bool LoadFontFace(const byte* data, int data_length, const String& family, Style::FontStyle style, Style::FontWeight weight);
 
 private:
     FontProvider(void);
     ~FontProvider(void);
 
     // Adds a loaded face to the appropriate font family.
-    bool AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream);
+    bool AddFace(void* face, const String& family, Style::FontStyle style, Style::FontWeight weight, bool release_stream);
     // Loads a FreeType face.
     void* LoadFace(const String& file_name);
     // Loads a FreeType face from memory.

+ 0 - 1
Include/RmlUi/Core/Core.h

@@ -51,7 +51,6 @@
 #include "EventListenerInstancer.h"
 #include "Factory.h"
 #include "FileInterface.h"
-#include "Font.h"
 #include "FontDatabase.h"
 #include "FontEffect.h"
 #include "FontGlyph.h"

+ 0 - 62
Include/RmlUi/Core/Font.h

@@ -1,62 +0,0 @@
-/*
- * This source file is part of RmlUi, the HTML/CSS Interface Middleware
- *
- * For the latest information, see http://github.com/mikke89/RmlUi
- *
- * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- * Copyright (c) 2019 The RmlUi Team, and contributors
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#ifndef RMLUICOREFONT_H
-#define RMLUICOREFONT_H
-
-namespace Rml {
-namespace Core {
-
-namespace Font
-{
-	enum Style
-	{
-		STYLE_NORMAL = 0,
-		STYLE_ITALIC = 1,
-		NUM_STYLES = 2
-	};
-
-	enum Weight
-	{
-		WEIGHT_NORMAL = 0,
-		WEIGHT_BOLD = 1,
-		NUM_WEIGHTS = 2
-	};
-
-	enum Line
-	{
-		UNDERLINE = 0,
-		OVERLINE = 1,
-		STRIKE_THROUGH = 2
-	};
-};
-
-}
-}
-
-#endif

+ 3 - 4
Include/RmlUi/Core/FontDatabase.h

@@ -31,7 +31,6 @@
 
 #include "StringUtilities.h"
 #include "Header.h"
-#include "Font.h"
 #include "FontProvider.h"
 
 namespace Rml {
@@ -71,7 +70,7 @@ public:
 	/// @param[in] style The style of the face (normal or italic).
 	/// @param[in] weight The weight of the face (normal or bold).
 	/// @return True if the face was loaded successfully, false otherwise.
-	static bool LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight);
+	static bool LoadFontFace(const String& file_name, const String& family, Style::FontStyle style, Style::FontWeight weight);
 	/// Adds a new font face to the database, loading from memory. The face's family, style and weight will be determined from the face itself.
 	/// @param[in] data The font data.
 	/// @param[in] data_length Length of the data.
@@ -84,7 +83,7 @@ public:
 	/// @param[in] style The style of the face (normal or italic).
 	/// @param[in] weight The weight of the face (normal or bold).
 	/// @return True if the face was loaded successfully, false otherwise.
-    static bool LoadFontFace(FontProviderType font_provider_type, const byte* data, int data_length, const String& family, Font::Style style, Font::Weight weight);
+    static bool LoadFontFace(FontProviderType font_provider_type, const byte* data, int data_length, const String& family, Style::FontStyle style, Style::FontWeight weight);
 
 	/// Returns a handle to a font face that can be used to position and render text. This will return the closest match
 	/// it can find, but in the event a font family is requested that does not exist, nullptr will be returned instead of a
@@ -95,7 +94,7 @@ public:
 	/// @param[in] weight The weight of the desired font handle.
 	/// @param[in] size The size of desired handle, in points.
 	/// @return A valid handle if a matching (or closely matching) font face was found, nullptr otherwise.
-	static SharedPtr<FontFaceHandle> GetFontFaceHandle(const String& family, const String& charset, Font::Style style, Font::Weight weight, int size);
+	static SharedPtr<FontFaceHandle> GetFontFaceHandle(const String& family, const String& charset, Style::FontStyle style, Style::FontWeight weight, int size);
 
     static void AddFontProvider(FontProvider * provider);
 

+ 6 - 6
Include/RmlUi/Core/FontFace.h

@@ -29,7 +29,7 @@
 #ifndef RMLUICOREFONTFACE_H
 #define RMLUICOREFONTFACE_H
 
-#include "Font.h"
+#include "ComputedValues.h"
 
 namespace Rml {
 namespace Core {
@@ -43,15 +43,15 @@ class FontFaceHandle;
 class FontFace
 {
 public:
-    FontFace(Font::Style style, Font::Weight weight, bool release_stream);
+    FontFace(Style::FontStyle style, Style::FontWeight weight, bool release_stream);
     virtual ~FontFace();
 
 	/// Returns the style of the font face.
 	/// @return The font face's style.
-	Font::Style GetStyle() const;
+	Style::FontStyle GetStyle() const;
 	/// Returns the weight of the font face.
 	/// @return The font face's weight.
-	Font::Weight GetWeight() const;
+	Style::FontWeight GetWeight() const;
 
 	/// Returns a handle for positioning and rendering this face at the given size.
 	/// @param[in] charset The set of characters in the handle, as a comma-separated list of unicode ranges.
@@ -64,8 +64,8 @@ public:
     virtual void ReleaseFace() = 0;
 
 protected:
-	Font::Style style;
-	Font::Weight weight;
+	Style::FontStyle style;
+	Style::FontWeight weight;
 
 	bool release_stream;
 

+ 2 - 3
Include/RmlUi/Core/FontFamily.h

@@ -30,7 +30,6 @@
 #define RMLUICOREFONTFAMILY_H
 
 #include "StringUtilities.h"
-#include "Font.h"
 
 namespace Rml {
 namespace Core {
@@ -54,7 +53,7 @@ public:
 	/// @param[in] weight The weight of the new face.
 	/// @param[in] release_stream True if the application must free the face's memory stream.
 	/// @return True if the face was loaded successfully, false otherwise.
-    virtual bool AddFace(void* ft_face, Font::Style style, Font::Weight weight, bool release_stream) = 0;
+    virtual bool AddFace(void* ft_face, Style::FontStyle style, Style::FontWeight weight, bool release_stream) = 0;
 
 	/// Returns a handle to the most appropriate font in the family, at the correct size.
 	/// @param[in] charset The set of characters in the handle, as a comma-separated list of unicode ranges.
@@ -62,7 +61,7 @@ public:
 	/// @param[in] weight The weight of the desired handle.
 	/// @param[in] size The size of desired handle, in points.
 	/// @return A valid handle if a matching (or closely matching) font face was found, nullptr otherwise.
-	SharedPtr<FontFaceHandle> GetFaceHandle(const String& charset, Font::Style style, Font::Weight weight, int size);
+	SharedPtr<FontFaceHandle> GetFaceHandle(const String& charset, Style::FontStyle style, Style::FontWeight weight, int size);
 
 protected:
 	String name;

+ 3 - 3
Include/RmlUi/Core/FontProvider.h

@@ -29,9 +29,9 @@
 #ifndef RMLUICOREFONTPROVIDER_H
 #define RMLUICOREFONTPROVIDER_H
 
-#include "StringUtilities.h"
-#include "Font.h"
 #include "Header.h"
+#include "StringUtilities.h"
+#include "ComputedValues.h"
 
 namespace Rml {
 namespace Core {
@@ -57,7 +57,7 @@ public:
     /// @param[in] weight The weight of the desired font handle.
     /// @param[in] size The size of desired handle, in points.
     /// @return A valid handle if a matching (or closely matching) font face was found, nullptr otherwise.
-	SharedPtr<FontFaceHandle> GetFontFaceHandle(const String& family, const String& charset, Font::Style style, Font::Weight weight, int size);
+	SharedPtr<FontFaceHandle> GetFontFaceHandle(const String& family, const String& charset, Style::FontStyle style, Style::FontWeight weight, int size);
 
 protected:
 

+ 3 - 4
Include/RmlUi/Core/FreeType/FontProvider.h

@@ -30,7 +30,6 @@
 #define RMLUICOREFREETYPEFONTPROVIDER_H
 
 #include "../StringUtilities.h"
-#include "../Font.h"
 #include "../FontProvider.h"
 
 namespace Rml {
@@ -66,7 +65,7 @@ public:
     /// @param[in] style The style of the face (normal or italic).
     /// @param[in] weight The weight of the face (normal or bold).
     /// @return True if the face was loaded successfully, false otherwise.
-    static bool LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight);
+    static bool LoadFontFace(const String& file_name, const String& family, Style::FontStyle style, Style::FontWeight weight);
     /// Adds a new font face to the database, loading from memory. The face's family, style and weight will be determined from the face itself.
     /// @param[in] data The font data.
     /// @param[in] data_length Length of the data.
@@ -79,14 +78,14 @@ public:
     /// @param[in] style The style of the face (normal or italic).
     /// @param[in] weight The weight of the face (normal or bold).
     /// @return True if the face was loaded successfully, false otherwise.
-    static bool LoadFontFace(const byte* data, int data_length, const String& family, Font::Style style, Font::Weight weight);
+    static bool LoadFontFace(const byte* data, int data_length, const String& family, Style::FontStyle style, Style::FontWeight weight);
 
 private:
     FontProvider(void);
     ~FontProvider(void);
 
     // Adds a loaded face to the appropriate font family.
-    bool AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream);
+    bool AddFace(void* face, const String& family, Style::FontStyle style, Style::FontWeight weight, bool release_stream);
     // Loads a FreeType face.
     void* LoadFace(const String& file_name);
     // Loads a FreeType face from memory.

+ 2 - 2
Source/Core/BitmapFont/BitmapFontDefinitions.h

@@ -44,8 +44,8 @@ namespace BitmapFont {
 		String Source;
 		String BitmapSource;
 		int Size;
-		Font::Style Style;
-		Font::Weight Weight;
+		Style::FontStyle Style;
+		Style::FontWeight Weight;
 	};
 
 	struct CharacterCommonInfo

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

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

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

@@ -45,7 +45,7 @@ class FontFaceHandle;
 class FontFace : public Rml::Core::FontFace
 {
 public:
-	FontFace(BitmapFontDefinitions *_face, Font::Style style, Font::Weight weight, bool release_stream);
+	FontFace(BitmapFontDefinitions *_face, Style::FontStyle style, Style::FontWeight weight, bool release_stream);
 	~FontFace();
 
 	/// Returns a handle for positioning and rendering this face at the given size.

+ 0 - 1
Source/Core/BitmapFont/FontFaceHandle.h

@@ -30,7 +30,6 @@
 #define RMLUICOREBITMAPFONTFONTFACEHANDLE_H
 
 #include "../UnicodeRange.h"
-#include "../../../Include/RmlUi/Core/Font.h"
 #include "../../../Include/RmlUi/Core/FontEffect.h"
 #include "../../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../../Include/RmlUi/Core/Geometry.h"

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

@@ -42,7 +42,7 @@ BitmapFont::FontFamily::~FontFamily()
 }
 
 // Adds a new face to the family.
-bool BitmapFont::FontFamily::AddFace( void *bm_face, Font::Style style, Font::Weight weight, bool release_stream)
+bool BitmapFont::FontFamily::AddFace( void *bm_face, Style::FontStyle style, Style::FontWeight weight, bool release_stream)
 {
 	Rml::Core::FontFace* face = new BitmapFont::FontFace((BitmapFontDefinitions*)bm_face, style, weight, release_stream);
 	font_faces.push_back(face);

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

@@ -29,7 +29,6 @@
 #ifndef RMLUICOREBITMAPFONTFAMILY_H
 #define RMLUICOREBITMAPFONTFAMILY_H
 
-#include "../../../Include/RmlUi/Core/Font.h"
 #include "../../../Include/RmlUi/Core/FontFamily.h"
 #include "BitmapFontDefinitions.h"
 
@@ -57,7 +56,7 @@ public:
 	/// @param[in] weight The weight of the new face.
 	/// @param[in] release_stream True if the application must free the face's memory stream.
 	/// @return True if the face was loaded successfully, false otherwise.
-	bool AddFace( void *bm_face, Font::Style style, Font::Weight weight, bool release_stream) override;
+	bool AddFace( void *bm_face, Style::FontStyle style, Style::FontWeight weight, bool release_stream) override;
 };
 
 }

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

@@ -51,8 +51,8 @@ void BitmapFont::FontParser::HandleElementStart(const String& name, const XMLAtt
 	{
 		bm_face->Face.FamilyName = Get(attributes, "face", String());
 		bm_face->Face.Size = Get(attributes, "size", 0);
-		bm_face->Face.Weight = Get(attributes, "bold", false ) ? Font::WEIGHT_BOLD : Font::WEIGHT_NORMAL;
-		bm_face->Face.Style = Get(attributes, "italic", false ) ? Font::STYLE_ITALIC : Font::STYLE_NORMAL;
+		bm_face->Face.Weight = Get(attributes, "bold", false ) ? Style::FontWeight::Bold : Style::FontWeight::Normal;
+		bm_face->Face.Style = Get(attributes, "italic", false ) ? Style::FontStyle::Italic : Style::FontStyle::Normal;
 		bm_face->Face.BitmapSource = Get(attributes, "src", String());
 	}
 	else if ( name == "common" )

+ 5 - 5
Source/Core/BitmapFont/FontProvider.cpp

@@ -86,8 +86,8 @@ bool BitmapFont::FontProvider::LoadFontFace(const String& file_name)
 		return false;
 	}
 
-	Font::Style style = bm_font->Face.Style;
-	Font::Weight weight = bm_font->Face.Weight;
+	Style::FontStyle style = bm_font->Face.Style;
+	Style::FontWeight weight = bm_font->Face.Weight;
 
 	if (instance->AddFace(bm_font, bm_font->Face.FamilyName, style, weight, true))
 	{
@@ -104,7 +104,7 @@ bool BitmapFont::FontProvider::LoadFontFace(const String& file_name)
 }
 
 // Loads a new font face.
-bool BitmapFont::FontProvider::LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight)
+bool BitmapFont::FontProvider::LoadFontFace(const String& file_name, const String& family, Style::FontStyle style, Style::FontWeight weight)
 {
 	BitmapFont::BitmapFontDefinitions *bm_font = (BitmapFont::BitmapFontDefinitions*) instance->LoadFace(file_name);
 	if (bm_font == nullptr)
@@ -134,14 +134,14 @@ bool BitmapFont::FontProvider::LoadFontFace(const byte* data, int data_length)
 }
 
 // Adds a new font face to the database, loading from memory.
-bool BitmapFont::FontProvider::LoadFontFace(const byte* data, int data_length, const String& family, Font::Style style, Font::Weight weight)
+bool BitmapFont::FontProvider::LoadFontFace(const byte* data, int data_length, const String& family, Style::FontStyle style, Style::FontWeight weight)
 {
 	// TODO Loading from memory
 	return false;
 }
 
 // Adds a loaded face to the appropriate font family.
-bool BitmapFont::FontProvider::AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream)
+bool BitmapFont::FontProvider::AddFace(void* face, const String& family, Style::FontStyle style, Style::FontWeight weight, bool release_stream)
 {
 	String family_lower = StringUtilities::ToLower(family);
 	Rml::Core::FontFamily* font_family = nullptr;

+ 1 - 9
Source/Core/ElementTextDefault.cpp

@@ -430,15 +430,7 @@ void ElementTextDefault::GenerateDecoration(const FontFaceHandle* font_face_hand
 {
 	RMLUI_ZoneScopedC(0xA52A2A);
 	
-	Font::Line line_height;
-	if (decoration_property == Style::TextDecoration::Overline)
-		line_height = Font::OVERLINE;
-	else if (decoration_property == Style::TextDecoration::LineThrough)
-		line_height = Font::STRIKE_THROUGH;
-	else
-		line_height = Font::UNDERLINE;
-
-	font_face_handle->GenerateLine(&decoration, line.position, line.width, line_height, colour);
+	font_face_handle->GenerateLine(&decoration, line.position, line.width, decoration_property, colour);
 }
 
 static bool BuildToken(WString& token, const word*& token_begin, const word* string_end, bool first_token, bool collapse_white_space, bool break_at_endline, Style::TextTransform text_transformation)

+ 1 - 2
Source/Core/ElementUtilities.cpp

@@ -148,8 +148,7 @@ SharedPtr<FontFaceHandle> ElementUtilities::GetFontFaceHandle(const Style::Compu
 	const String& charset = (computed_values.font_charset.empty() ? default_charset : computed_values.font_charset);
 	int font_size = (int)computed_values.font_size;
 
-	// TODO Synchronize enums
-	return FontDatabase::GetFontFaceHandle(computed_values.font_family, charset, (Font::Style)computed_values.font_style, (Font::Weight)computed_values.font_weight, font_size);
+	return FontDatabase::GetFontFaceHandle(computed_values.font_family, charset, computed_values.font_style, computed_values.font_weight, font_size);
 }
 
 float ElementUtilities::GetDensityIndependentPixelRatio(Element * element)

+ 3 - 3
Source/Core/FontDatabase.cpp

@@ -97,7 +97,7 @@ bool FontDatabase::LoadFontFace(const String& file_name)
 }
 
 // Adds a new font face to the database, ignoring any family, style and weight information stored in the face itself.
-bool FontDatabase::LoadFontFace(const String& file_name, const String& family, Font::Style style, Font::Weight weight)
+bool FontDatabase::LoadFontFace(const String& file_name, const String& family, Style::FontStyle style, Style::FontWeight weight)
 {
     FontProviderType font_provider_type = GetFontProviderType(file_name);
 
@@ -131,7 +131,7 @@ bool FontDatabase::LoadFontFace(FontProviderType font_provider_type, const byte*
 }
 
 // Adds a new font face to the database, loading from memory, ignoring any family, style and weight information stored in the face itself.
-bool FontDatabase::LoadFontFace(FontProviderType font_provider_type, const byte* data, int data_length, const String& family, Font::Style style, Font::Weight weight)
+bool FontDatabase::LoadFontFace(FontProviderType font_provider_type, const byte* data, int data_length, const String& family, Style::FontStyle style, Style::FontWeight weight)
 {
     switch(font_provider_type)
     {
@@ -159,7 +159,7 @@ FontDatabase::FontProviderType FontDatabase::GetFontProviderType(const String& f
 }
 
 // Returns a handle to a font face that can be used to position and render text.
-SharedPtr<FontFaceHandle> FontDatabase::GetFontFaceHandle(const String& family, const String& charset, Font::Style style, Font::Weight weight, int size)
+SharedPtr<FontFaceHandle> FontDatabase::GetFontFaceHandle(const String& family, const String& charset, Style::FontStyle style, Style::FontWeight weight, int size)
 {
     size_t provider_count = font_provider_table.size();
 

+ 3 - 3
Source/Core/FontFace.cpp

@@ -34,7 +34,7 @@
 namespace Rml {
 namespace Core {
 
-FontFace::FontFace(Font::Style _style, Font::Weight _weight, bool _release_stream)
+FontFace::FontFace(Style::FontStyle _style, Style::FontWeight _weight, bool _release_stream)
 {
 	style = _style;
 	weight = _weight;
@@ -48,13 +48,13 @@ FontFace::~FontFace()
 }
 
 // Returns the style of the font face.
-Font::Style FontFace::GetStyle() const
+Style::FontStyle FontFace::GetStyle() const
 {
 	return style;
 }
 
 // Returns the weight of the font face.
-Font::Weight FontFace::GetWeight() const
+Style::FontWeight FontFace::GetWeight() const
 {
 	return weight;
 }

+ 5 - 5
Source/Core/FontFaceHandle.cpp

@@ -256,7 +256,7 @@ int FontFaceHandle::GenerateString(GeometryList& geometry, const WString& string
 }
 
 // Generates the geometry required to render a line above, below or through a line of text.
-void FontFaceHandle::GenerateLine(Geometry* geometry, const Vector2f& position, int width, Font::Line height, const Colourb& colour) const
+void FontFaceHandle::GenerateLine(Geometry* geometry, const Vector2f& position, int width, Style::TextDecoration height, const Colourb& colour) const
 {
 	std::vector< Vertex >& line_vertices = geometry->GetVertices();
 	std::vector< int >& line_indices = geometry->GetIndices();
@@ -264,10 +264,10 @@ void FontFaceHandle::GenerateLine(Geometry* geometry, const Vector2f& position,
 	float offset;
 	switch (height)
 	{
-		case Font::UNDERLINE:       offset = -underline_position; break;
-		case Font::OVERLINE:        offset = -underline_position - (float)size; break;
-		case Font::STRIKE_THROUGH:  offset = -0.65f * (float)x_height; break; // or maybe: -underline_position - (float)size * 0.5f
-		default: return;
+	case Style::TextDecoration::Underline:       offset = -underline_position; break;
+	case Style::TextDecoration::Overline:        offset = -underline_position - (float)size; break;
+	case Style::TextDecoration::LineThrough:     offset = -0.65f * (float)x_height; break; // or maybe: -underline_position - (float)size * 0.5f
+	default: return;
 	}
 
 	line_vertices.resize(line_vertices.size() + 4);

+ 2 - 3
Source/Core/FontFaceHandle.h

@@ -31,7 +31,6 @@
 
 #include "../../Include/RmlUi/Core/Traits.h"
 #include "UnicodeRange.h"
-#include "../../Include/RmlUi/Core/Font.h"
 #include "../../Include/RmlUi/Core/FontEffect.h"
 #include "../../Include/RmlUi/Core/FontGlyph.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
@@ -102,9 +101,9 @@ public:
 	/// @param[out] geometry The geometry to append the newly created geometry into.
 	/// @param[in] position The position of the baseline of the lined text.
 	/// @param[in] width The width of the string to line.
-	/// @param[in] height The height to render the line at.
+	/// @param[in] decoration_type The type for vertical positioning of line.
 	/// @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, Style::TextDecoration decoration_type, const Colourb& colour) const;
 
 	/// Returns the font face's raw charset (the charset range as a string).
 	/// @return The font face's charset.

+ 1 - 1
Source/Core/FontFamily.cpp

@@ -44,7 +44,7 @@ FontFamily::~FontFamily()
 }
 
 // Returns a handle to the most appropriate font in the family, at the correct size.
-SharedPtr<FontFaceHandle> FontFamily::GetFaceHandle(const String& charset, Font::Style style, Font::Weight weight, int size)
+SharedPtr<FontFaceHandle> FontFamily::GetFaceHandle(const String& charset, Style::FontStyle style, Style::FontWeight weight, int size)
 {
 	// Search for a face of the same style, and match the weight as closely as we can.
 	FontFace* matching_face = nullptr;

+ 1 - 1
Source/Core/FontProvider.cpp

@@ -34,7 +34,7 @@ namespace Rml {
 namespace Core {
 
 // Returns a handle to a font face that can be used to position and render text.
-SharedPtr<FontFaceHandle> FontProvider::GetFontFaceHandle(const String& family, const String& charset, Font::Style style, Font::Weight weight, int size)
+SharedPtr<FontFaceHandle> FontProvider::GetFontFaceHandle(const String& family, const String& charset, Style::FontStyle style, Style::FontWeight weight, int size)
 {
 	RMLUI_ASSERTMSG(family == StringUtilities::ToLower(family), "Font family name must be converted to lowercase before entering here.");
 	FontFamilyMap::iterator iterator = font_families.find(family);

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

@@ -35,7 +35,7 @@ namespace Rml {
 namespace Core {
 namespace FreeType {
 
-FontFace::FontFace(FT_Face _face, Font::Style _style, Font::Weight _weight, bool _release_stream) : Rml::Core::FontFace(_style, _weight, _release_stream)
+FontFace::FontFace(FT_Face _face, Style::FontStyle _style, Style::FontWeight _weight, bool _release_stream) : Rml::Core::FontFace(_style, _weight, _release_stream)
 {
 	face = _face;
 }

+ 1 - 1
Source/Core/FreeType/FontFace.h

@@ -45,7 +45,7 @@ class FontFaceHandle;
 class FontFace : public Rml::Core::FontFace
 {
 public:
-	FontFace(FT_Face face, Font::Style style, Font::Weight weight, bool release_stream);
+	FontFace(FT_Face face, Style::FontStyle style, Style::FontWeight weight, bool release_stream);
 	~FontFace();
 
 	/// Returns a handle for positioning and rendering this face at the given size.

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

@@ -44,7 +44,7 @@ FreeType::FontFamily::~FontFamily()
 }
 
 // Adds a new face to the family.
-bool FreeType::FontFamily::AddFace(void* ft_face, Font::Style style, Font::Weight weight, bool release_stream)
+bool FreeType::FontFamily::AddFace(void* ft_face, Style::FontStyle style, Style::FontWeight weight, bool release_stream)
 {
 	FontFace* face = new FreeType::FontFace((FT_Face)ft_face, style, weight, release_stream);
 	font_faces.push_back(face);

+ 1 - 2
Source/Core/FreeType/FontFamily.h

@@ -29,7 +29,6 @@
 #ifndef RMLUICOREFREETYPEFONTFAMILY_H
 #define RMLUICOREFREETYPEFONTFAMILY_H
 
-#include <RmlUi/Core/Font.h>
 #include <RmlUi/Core/FontFamily.h>
 #include <ft2build.h>
 #include FT_FREETYPE_H
@@ -58,7 +57,7 @@ public:
 	/// @param[in] weight The weight of the new face.
 	/// @param[in] release_stream True if the application must free the face's memory stream.
 	/// @return True if the face was loaded successfully, false otherwise.
-	bool AddFace(void* ft_face, Font::Style style, Font::Weight weight, bool release_stream) override;
+	bool AddFace(void* ft_face, Style::FontStyle style, Style::FontWeight weight, bool release_stream) override;
 };
 
 }

+ 7 - 7
Source/Core/FreeType/FontProvider.cpp

@@ -104,8 +104,8 @@ bool FontProvider::LoadFontFace(const String& file_name)
 		return false;
 	}
 
-	Font::Style style = ft_face->style_flags & FT_STYLE_FLAG_ITALIC ? Font::STYLE_ITALIC : Font::STYLE_NORMAL;
-	Font::Weight weight = ft_face->style_flags & FT_STYLE_FLAG_BOLD ? Font::WEIGHT_BOLD : Font::WEIGHT_NORMAL;
+	Style::FontStyle style = ft_face->style_flags & FT_STYLE_FLAG_ITALIC ? Style::FontStyle::Italic : Style::FontStyle::Normal;
+	Style::FontWeight weight = ft_face->style_flags & FT_STYLE_FLAG_BOLD ? Style::FontWeight::Bold : Style::FontWeight::Normal;
 
 	if (instance->AddFace(ft_face, ft_face->family_name, style, weight, true))
 	{
@@ -120,7 +120,7 @@ bool FontProvider::LoadFontFace(const String& file_name)
 }
 
 // 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, const String& family, Font::Style style, Font::Weight weight)
+bool FontProvider::LoadFontFace(const String& file_name, const String& family, Style::FontStyle style, Style::FontWeight weight)
 {
 	FT_Face ft_face = (FT_Face) instance->LoadFace(file_name);
 	if (ft_face == nullptr)
@@ -151,8 +151,8 @@ bool FontProvider::LoadFontFace(const byte* data, int data_length)
 		return false;
 	}
 
-	Font::Style style = ft_face->style_flags & FT_STYLE_FLAG_ITALIC ? Font::STYLE_ITALIC : Font::STYLE_NORMAL;
-	Font::Weight weight = ft_face->style_flags & FT_STYLE_FLAG_BOLD ? Font::WEIGHT_BOLD : Font::WEIGHT_NORMAL;
+	Style::FontStyle style = ft_face->style_flags & FT_STYLE_FLAG_ITALIC ? Style::FontStyle::Italic : Style::FontStyle::Normal;
+	Style::FontWeight weight = ft_face->style_flags & FT_STYLE_FLAG_BOLD ? Style::FontWeight::Bold : Style::FontWeight::Normal;
 
 	if (instance->AddFace(ft_face, ft_face->family_name, style, weight, false))
 	{
@@ -167,7 +167,7 @@ bool FontProvider::LoadFontFace(const byte* data, int data_length)
 }
 
 // Adds a new font face to the database, loading from memory, ignoring any family, style and weight information stored in the face itself.
-bool FontProvider::LoadFontFace(const byte* data, int data_length, const String& family, Font::Style style, Font::Weight weight)
+bool FontProvider::LoadFontFace(const byte* data, int data_length, const String& family, Style::FontStyle style, Style::FontWeight weight)
 {
 	FT_Face ft_face = (FT_Face) instance->LoadFace(data, data_length, "memory", false);
 	if (ft_face == nullptr)
@@ -189,7 +189,7 @@ bool FontProvider::LoadFontFace(const byte* data, int data_length, const String&
 }
 
 // Adds a loaded face to the appropriate font family.
-bool FontProvider::AddFace(void* face, const String& family, Font::Style style, Font::Weight weight, bool release_stream)
+bool FontProvider::AddFace(void* face, const String& family, Style::FontStyle style, Style::FontWeight weight, bool release_stream)
 {
 	String family_lower = StringUtilities::ToLower(family);
 	FontFamily* font_family = nullptr;

+ 2 - 2
Source/Debugger/Plugin.cpp

@@ -277,8 +277,8 @@ Plugin* Plugin::GetInstance()
 
 bool Plugin::LoadFont()
 {
-	return (Core::FontDatabase::LoadFontFace(Core::FontDatabase::FreeType, lacuna_regular, sizeof(lacuna_regular) / sizeof(unsigned char), "Lacuna", Core::Font::STYLE_NORMAL, Core::Font::WEIGHT_NORMAL) &&
-			Core::FontDatabase::LoadFontFace(Core::FontDatabase::FreeType, lacuna_italic, sizeof(lacuna_italic) / sizeof(unsigned char), "Lacuna", Core::Font::STYLE_ITALIC, Core::Font::WEIGHT_NORMAL));
+	return (Core::FontDatabase::LoadFontFace(Core::FontDatabase::FreeType, lacuna_regular, sizeof(lacuna_regular) / sizeof(unsigned char), "Lacuna", Core::Style::FontStyle::Normal, Core::Style::FontWeight::Normal) &&
+			Core::FontDatabase::LoadFontFace(Core::FontDatabase::FreeType, lacuna_italic, sizeof(lacuna_italic) / sizeof(unsigned char), "Lacuna", Core::Style::FontStyle::Italic, Core::Style::FontWeight::Normal));
 }
 
 bool Plugin::LoadMenuElement()