Browse Source

Rename CodePoint to Character.

Michael Ragazzon 6 years ago
parent
commit
16fb312b4e

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

@@ -176,7 +176,7 @@ public:
 	/// Sends a single unicode character as text input into this context.
 	/// Sends a single unicode character as text input into this context.
 	/// @param[in] character The unicode code point to send into this context.
 	/// @param[in] character The unicode code point to send into this context.
 	/// @return True if the event was not consumed (ie, was prevented from propagating by an element), false if it was.
 	/// @return True if the event was not consumed (ie, was prevented from propagating by an element), false if it was.
-	bool ProcessTextInput(CodePoint character);
+	bool ProcessTextInput(Character character);
 	/// Sends a single ascii character as text input into this context.
 	/// Sends a single ascii character as text input into this context.
 	bool ProcessTextInput(char character);
 	bool ProcessTextInput(char character);
 	/// Sends a string of text as text input into this context.
 	/// Sends a string of text as text input into this context.

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

@@ -102,7 +102,7 @@ public:
 	/// @param[in] string The string to measure.
 	/// @param[in] string The string to measure.
 	/// @param[in] prior_character The optionally-specified character that immediately precedes the string. This may have an impact on the string width due to kerning.
 	/// @param[in] prior_character The optionally-specified character that immediately precedes the string. This may have an impact on the string width due to kerning.
 	/// @return The width, in pixels, this string will occupy if rendered with this handle.
 	/// @return The width, in pixels, this string will occupy if rendered with this handle.
-	virtual int GetStringWidth(FontFaceHandle handle, const String& string, CodePoint prior_character = CodePoint::Null);
+	virtual int GetStringWidth(FontFaceHandle handle, const String& string, Character prior_character = Character::Null);
 
 
 	/// Called by RmlUi when it wants to retrieve the geometry required to render a single line of text.
 	/// Called by RmlUi when it wants to retrieve the geometry required to render a single line of text.
 	/// @param[in] face_handle The font handle.
 	/// @param[in] face_handle The font handle.

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

@@ -77,7 +77,7 @@ public:
 	}
 	}
 };
 };
 
 
-using FontGlyphMap = UnorderedMap<CodePoint, FontGlyph>;
+using FontGlyphMap = UnorderedMap<Character, FontGlyph>;
 
 
 }
 }
 }
 }

+ 4 - 4
Include/RmlUi/Core/StringUtilities.h

@@ -104,13 +104,13 @@ namespace StringUtilities
 	};
 	};
 
 
 	// Decode the first code point in a zero-terminated UTF-8 string.
 	// Decode the first code point in a zero-terminated UTF-8 string.
-	RMLUICORE_API CodePoint ToCodePoint(const char* p);
+	RMLUICORE_API Character ToCharacter(const char* p);
 
 
 	// Encode a single code point as a UTF-8 string.
 	// Encode a single code point as a UTF-8 string.
-	RMLUICORE_API String ToUTF8(CodePoint code_point);
+	RMLUICORE_API String ToUTF8(Character character);
 
 
 	// Encode an array of code points as a UTF-8 string.
 	// Encode an array of code points as a UTF-8 string.
-	RMLUICORE_API String ToUTF8(const CodePoint* code_points, int num_code_points);
+	RMLUICORE_API String ToUTF8(const Character* characters, int num_characters);
 
 
 	/// Returns number of characters in a UTF-8 string.
 	/// Returns number of characters in a UTF-8 string.
 	RMLUICORE_API size_t LengthUTF8(StringView string_view);
 	RMLUICORE_API size_t LengthUTF8(StringView string_view);
@@ -190,7 +190,7 @@ public:
 	StringIteratorU8& operator--();
 	StringIteratorU8& operator--();
 
 
 	// Returns the codepoint at the current position. The iterator must be dereferencable.
 	// Returns the codepoint at the current position. The iterator must be dereferencable.
-	inline CodePoint operator*() const { return StringUtilities::ToCodePoint(p); }
+	inline Character operator*() const { return StringUtilities::ToCharacter(p); }
 
 
 	// Returns false when the iterator is located just outside the valid part of the string.
 	// Returns false when the iterator is located just outside the valid part of the string.
 	inline operator bool() const { return (p != view.begin() - 1) && (p != view.end()); }
 	inline operator bool() const { return (p != view.begin() - 1) && (p != view.end()); }

+ 2 - 2
Include/RmlUi/Core/TypeConverter.inl

@@ -105,7 +105,7 @@ PASS_THROUGH(unsigned int);
 PASS_THROUGH(float);
 PASS_THROUGH(float);
 PASS_THROUGH(bool);
 PASS_THROUGH(bool);
 PASS_THROUGH(char);
 PASS_THROUGH(char);
-PASS_THROUGH(CodePoint);
+PASS_THROUGH(Character);
 PASS_THROUGH(Vector2i);
 PASS_THROUGH(Vector2i);
 PASS_THROUGH(Vector2f);
 PASS_THROUGH(Vector2f);
 PASS_THROUGH(Vector3i);
 PASS_THROUGH(Vector3i);
@@ -148,7 +148,7 @@ BASIC_CONVERTER_BOOL(float, bool);
 BASIC_CONVERTER(float, int);
 BASIC_CONVERTER(float, int);
 BASIC_CONVERTER(float, unsigned int);
 BASIC_CONVERTER(float, unsigned int);
 
 
-BASIC_CONVERTER(char, CodePoint);
+BASIC_CONVERTER(char, Character);
 
 
 /////////////////////////////////////////////////
 /////////////////////////////////////////////////
 // From string converters
 // From string converters

+ 6 - 4
Include/RmlUi/Core/Types.h

@@ -57,10 +57,12 @@ namespace Rml {
 namespace Core {
 namespace Core {
 
 
 // Commonly used basic types
 // Commonly used basic types
-typedef unsigned char byte;
-typedef double Time;
-typedef void* ScriptObject;
-enum class CodePoint : char32_t { Null, Replacement = 0xfffd };
+using byte = unsigned char;
+using Time = double;
+using ScriptObject = void*;
+
+// Unicode code point
+enum class Character : char32_t { Null, Replacement = 0xfffd };
 
 
 }
 }
 }
 }

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

@@ -125,7 +125,7 @@ private:
 	void Set(const char value);
 	void Set(const char value);
 	void Set(const float value);
 	void Set(const float value);
 	void Set(const int value);
 	void Set(const int value);
-	void Set(const CodePoint value);
+	void Set(const Character value);
 	void Set(const char* value);
 	void Set(const char* value);
 	void Set(void* value);
 	void Set(void* value);
 	void Set(const Vector2f& value);
 	void Set(const Vector2f& value);

+ 1 - 1
Include/RmlUi/Core/Variant.inl

@@ -75,7 +75,7 @@ bool Variant::GetInto(T& value) const
 		break;
 		break;
 
 
 	case WORD:
 	case WORD:
-		return TypeConverter< CodePoint, T >::Convert(*(CodePoint*)data, value);
+		return TypeConverter< Character, T >::Convert(*(Character*)data, value);
 		break;
 		break;
 
 
 	case VECTOR2:
 	case VECTOR2:

+ 1 - 1
Samples/shell/include/Input.h

@@ -53,7 +53,7 @@ public:
 	/// @param[in] key_identifier The key to generate a character code for.
 	/// @param[in] key_identifier The key to generate a character code for.
 	/// @param[in] key_modifier_state The configuration of the key modifiers.
 	/// @param[in] key_modifier_state The configuration of the key modifiers.
 	/// @return The character code.
 	/// @return The character code.
-	static Rml::Core::CodePoint GetCharacterCode(Rml::Core::Input::KeyIdentifier key_identifier, int key_modifier_state);
+	static Rml::Core::Character GetCharacterCode(Rml::Core::Input::KeyIdentifier key_identifier, int key_modifier_state);
 
 
 protected:
 protected:
 	static Rml::Core::Context* context;
 	static Rml::Core::Context* context;

+ 10 - 10
Samples/shell/src/Input.cpp

@@ -316,9 +316,9 @@ void Input::SetContext(Rml::Core::Context* _context)
 
 
 
 
 // Returns the character code for a key identifer / key modifier combination.
 // Returns the character code for a key identifer / key modifier combination.
-Rml::Core::CodePoint Input::GetCharacterCode(Rml::Core::Input::KeyIdentifier key_identifier, int key_modifier_state)
+Rml::Core::Character Input::GetCharacterCode(Rml::Core::Input::KeyIdentifier key_identifier, int key_modifier_state)
 {
 {
-	using Rml::Core::CodePoint;
+	using Rml::Core::Character;
 
 
 	// Check if we have a keycode capable of generating characters on the main keyboard (ie, not on the numeric
 	// Check if we have a keycode capable of generating characters on the main keyboard (ie, not on the numeric
 	// keypad; that is dealt with below).
 	// keypad; that is dealt with below).
@@ -330,28 +330,28 @@ Rml::Core::CodePoint Input::GetCharacterCode(Rml::Core::Input::KeyIdentifier key
 
 
 		// Return character code based on identifier and modifiers
 		// Return character code based on identifier and modifiers
 		if (shift && !capslock)
 		if (shift && !capslock)
-			return (CodePoint)ascii_map[1][key_identifier];
+			return (Character)ascii_map[1][key_identifier];
 
 
 		if (shift && capslock)
 		if (shift && capslock)
-			return (CodePoint)ascii_map[2][key_identifier];
+			return (Character)ascii_map[2][key_identifier];
 
 
 		if (!shift && capslock)
 		if (!shift && capslock)
-			return (CodePoint)ascii_map[3][key_identifier];
+			return (Character)ascii_map[3][key_identifier];
 
 
-		return (CodePoint)ascii_map[0][key_identifier];
+		return (Character)ascii_map[0][key_identifier];
 	}
 	}
 
 
 	// Check if we have a keycode from the numeric keypad.
 	// Check if we have a keycode from the numeric keypad.
 	else if (key_identifier <= Rml::Core::Input::KI_OEM_NEC_EQUAL)
 	else if (key_identifier <= Rml::Core::Input::KI_OEM_NEC_EQUAL)
 	{
 	{
 		if (key_modifier_state & Rml::Core::Input::KM_NUMLOCK)
 		if (key_modifier_state & Rml::Core::Input::KM_NUMLOCK)
-			return (CodePoint)keypad_map[0][key_identifier - Rml::Core::Input::KI_NUMPAD0];
+			return (Character)keypad_map[0][key_identifier - Rml::Core::Input::KI_NUMPAD0];
 		else
 		else
-			return (CodePoint)keypad_map[1][key_identifier - Rml::Core::Input::KI_NUMPAD0];
+			return (Character)keypad_map[1][key_identifier - Rml::Core::Input::KI_NUMPAD0];
 	}
 	}
 
 
 	else if (key_identifier == Rml::Core::Input::KI_RETURN)
 	else if (key_identifier == Rml::Core::Input::KI_RETURN)
-		return (CodePoint)'\n';
+		return (Character)'\n';
 
 
-	return CodePoint::Null;
+	return Character::Null;
 }
 }

+ 5 - 5
Samples/shell/src/win32/InputWin32.cpp

@@ -111,7 +111,7 @@ void InputWin32::ProcessWindowsEvent(UINT message, WPARAM w_param, LPARAM l_para
 			static char16_t first_u16_code_unit = 0;
 			static char16_t first_u16_code_unit = 0;
 
 
 			char16_t c = (char16_t)w_param;
 			char16_t c = (char16_t)w_param;
-			Rml::Core::CodePoint code_point = (Rml::Core::CodePoint)c;
+			Rml::Core::Character character = (Rml::Core::Character)c;
 
 
 			// Windows sends two-wide characters as two messages.
 			// Windows sends two-wide characters as two messages.
 			if (c >= 0xD800 && c < 0xDC00)
 			if (c >= 0xD800 && c < 0xDC00)
@@ -125,19 +125,19 @@ void InputWin32::ProcessWindowsEvent(UINT message, WPARAM w_param, LPARAM l_para
 				{
 				{
 					// Second 16-bit code unit of a two-wide character.
 					// Second 16-bit code unit of a two-wide character.
 					Rml::Core::String utf8 = Rml::Core::StringUtilities::ToUTF8({ first_u16_code_unit, c });
 					Rml::Core::String utf8 = Rml::Core::StringUtilities::ToUTF8({ first_u16_code_unit, c });
-					code_point = Rml::Core::StringUtilities::ToCodePoint(utf8.data());
+					character = Rml::Core::StringUtilities::ToCharacter(utf8.data());
 				}
 				}
 				else if (c == '\r')
 				else if (c == '\r')
 				{
 				{
 					// Windows sends new-lines as carriage returns, convert to endlines.
 					// Windows sends new-lines as carriage returns, convert to endlines.
-					code_point = (Rml::Core::CodePoint)'\n';
+					character = (Rml::Core::Character)'\n';
 				}
 				}
 
 
 				first_u16_code_unit = 0;
 				first_u16_code_unit = 0;
 
 
 				// Only send through printable characters.
 				// Only send through printable characters.
-				if ((char32_t)code_point >= 32 || code_point == (Rml::Core::CodePoint)'\n')
-					context->ProcessTextInput(code_point);
+				if ((char32_t)character >= 32 || character == (Rml::Core::Character)'\n')
+					context->ProcessTextInput(character);
 			}
 			}
 		}
 		}
 		break;
 		break;

+ 3 - 3
Source/Controls/WidgetTextInput.cpp

@@ -378,7 +378,7 @@ void WidgetTextInput::ProcessEvent(Core::Event& event)
 				// @performance: Can be made heaps faster.
 				// @performance: Can be made heaps faster.
 				for (auto it = Core::StringIteratorU8(clipboard_text); it; ++it)
 				for (auto it = Core::StringIteratorU8(clipboard_text); it; ++it)
 				{
 				{
-					Core::CodePoint code = *it;
+					Core::Character code = *it;
 					AddCharacter(code);
 					AddCharacter(code);
 				}
 				}
 			}
 			}
@@ -404,7 +404,7 @@ void WidgetTextInput::ProcessEvent(Core::Event& event)
 			event.GetParameter< int >("alt_key", 0) == 0 &&
 			event.GetParameter< int >("alt_key", 0) == 0 &&
 			event.GetParameter< int >("meta_key", 0) == 0)
 			event.GetParameter< int >("meta_key", 0) == 0)
 		{
 		{
-			Rml::Core::CodePoint character = event.GetParameter("data", Rml::Core::CodePoint::Null);
+			Rml::Core::Character character = event.GetParameter("data", Rml::Core::Character::Null);
 			AddCharacter(character);
 			AddCharacter(character);
 		}
 		}
 
 
@@ -461,7 +461,7 @@ void WidgetTextInput::ProcessEvent(Core::Event& event)
 }
 }
 
 
 // Adds a new character to the string at the cursor position.
 // Adds a new character to the string at the cursor position.
-bool WidgetTextInput::AddCharacter(Rml::Core::CodePoint character)
+bool WidgetTextInput::AddCharacter(Rml::Core::Character character)
 {
 {
 	if ((char32_t)character <= 127 && !IsCharacterValid(static_cast<char>(character)))
 	if ((char32_t)character <= 127 && !IsCharacterValid(static_cast<char>(character)))
 		return false;
 		return false;

+ 1 - 1
Source/Controls/WidgetTextInput.h

@@ -94,7 +94,7 @@ protected:
 	/// Adds a new character to the string at the cursor position.
 	/// Adds a new character to the string at the cursor position.
 	/// @param[in] character The character to add to the string.
 	/// @param[in] character The character to add to the string.
 	/// @return True if the character was successfully added, false otherwise.
 	/// @return True if the character was successfully added, false otherwise.
-	bool AddCharacter(Rml::Core::CodePoint character);
+	bool AddCharacter(Rml::Core::Character character);
 	/// Deletes a character from the string.
 	/// Deletes a character from the string.
 	/// @param[in] backward True to delete a character behind the cursor, false for in front of the cursor.
 	/// @param[in] backward True to delete a character behind the cursor, false for in front of the cursor.
 	/// @return True if a character was deleted, false otherwise.
 	/// @return True if a character was deleted, false otherwise.

+ 2 - 2
Source/Core/Context.cpp

@@ -500,11 +500,11 @@ bool Context::ProcessKeyUp(Input::KeyIdentifier key_identifier, int key_modifier
 
 
 bool Context::ProcessTextInput(char character)
 bool Context::ProcessTextInput(char character)
 {
 {
-	return ProcessTextInput(static_cast<CodePoint>(character));
+	return ProcessTextInput(static_cast<Character>(character));
 }
 }
 
 
 // Sends a single character of text as text input into RmlUi.
 // Sends a single character of text as text input into RmlUi.
-bool Context::ProcessTextInput(CodePoint character)
+bool Context::ProcessTextInput(Character character)
 {
 {
 	// Generate the parameters for the key event.
 	// Generate the parameters for the key event.
 	Dictionary parameters;
 	Dictionary parameters;

+ 2 - 2
Source/Core/ElementTextDefault.cpp

@@ -219,9 +219,9 @@ bool ElementTextDefault::GenerateLine(String& line, int& line_length, float& lin
 	{
 	{
 		String token;
 		String token;
 		const char* next_token_begin = token_begin;
 		const char* next_token_begin = token_begin;
-		CodePoint previous_codepoint = CodePoint::Null;
+		Character previous_codepoint = Character::Null;
 		if (!line.empty())
 		if (!line.empty())
-			previous_codepoint = StringUtilities::ToCodePoint(StringUtilities::SeekBackwardUTF8(&line.back(), line.data()));
+			previous_codepoint = StringUtilities::ToCharacter(StringUtilities::SeekBackwardUTF8(&line.back(), line.data()));
 
 
 		// Generate the next token and determine its pixel-length.
 		// Generate the next token and determine its pixel-length.
 		bool break_line = BuildToken(token, next_token_begin, string_end, line.empty() && trim_whitespace_prefix, collapse_white_space, break_at_endline, text_transform_property);
 		bool break_line = BuildToken(token, next_token_begin, string_end, line.empty() && trim_whitespace_prefix, collapse_white_space, break_at_endline, text_transform_property);

+ 1 - 1
Source/Core/FontEngineDefault/FontEngineInterfaceDefault.cpp

@@ -96,7 +96,7 @@ float FontEngineInterfaceDefault::GetUnderline(FontFaceHandle handle, float& thi
 	return handle_default->GetUnderline(thickness);
 	return handle_default->GetUnderline(thickness);
 }
 }
 
 
-int FontEngineInterfaceDefault::GetStringWidth(FontFaceHandle handle, const String& string, CodePoint prior_character)
+int FontEngineInterfaceDefault::GetStringWidth(FontFaceHandle handle, const String& string, Character prior_character)
 {
 {
 	auto handle_default = reinterpret_cast<FontFaceHandleDefault *>(handle);
 	auto handle_default = reinterpret_cast<FontFaceHandleDefault *>(handle);
 	return handle_default->GetStringWidth(string, prior_character);
 	return handle_default->GetStringWidth(string, prior_character);

+ 1 - 1
Source/Core/FontEngineDefault/FontEngineInterfaceDefault.h

@@ -67,7 +67,7 @@ public:
 	float GetUnderline(FontFaceHandle, float& thickness) override;
 	float GetUnderline(FontFaceHandle, float& thickness) override;
 
 
 	/// 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.
-	int GetStringWidth(FontFaceHandle, const String& string, CodePoint prior_character) override;
+	int GetStringWidth(FontFaceHandle, const String& string, Character prior_character) override;
 
 
 	/// Generates the geometry required to render a single line of text.
 	/// Generates the geometry required to render a single line of text.
 	int GenerateString(FontFaceHandle, FontEffectsHandle, const String& string, const Vector2f& position, const Colourb& colour, GeometryList& geometry) override;
 	int GenerateString(FontFaceHandle, FontEffectsHandle, const String& string, const Vector2f& position, const Colourb& colour, GeometryList& geometry) override;

+ 25 - 25
Source/Core/FontEngineDefault/FontFaceHandleDefault.cpp

@@ -105,24 +105,24 @@ float FontFaceHandleDefault::GetUnderline(float& thickness) const
 }
 }
 
 
 // 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.
-int FontFaceHandleDefault::GetStringWidth(const String& string, CodePoint prior_character)
+int FontFaceHandleDefault::GetStringWidth(const String& string, Character prior_character)
 {
 {
 	int width = 0;
 	int width = 0;
 	for (auto it_string = StringIteratorU8(string); it_string; ++it_string)
 	for (auto it_string = StringIteratorU8(string); it_string; ++it_string)
 	{
 	{
-		CodePoint code_point = *it_string;
+		Character character = *it_string;
 
 
-		const FontGlyph* glyph = GetOrAppendGlyph(code_point);
+		const FontGlyph* glyph = GetOrAppendGlyph(character);
 		if (!glyph)
 		if (!glyph)
 			continue;
 			continue;
 
 
 		// Adjust the cursor for the kerning between this character and the previous one.
 		// Adjust the cursor for the kerning between this character and the previous one.
-		if (prior_character != CodePoint::Null)
-			width += GetKerning(prior_character, code_point);
+		if (prior_character != Character::Null)
+			width += GetKerning(prior_character, character);
 		// Adjust the cursor for this character's advance.
 		// Adjust the cursor for this character's advance.
 		width += glyph->advance;
 		width += glyph->advance;
 
 
-		prior_character = code_point;
+		prior_character = character;
 	}
 	}
 
 
 	return width;
 	return width;
@@ -243,27 +243,27 @@ int FontFaceHandleDefault::GenerateString(GeometryList& geometry, const String&
 			geometry[geometry_index + i].SetTexture(layer->GetTexture(i));
 			geometry[geometry_index + i].SetTexture(layer->GetTexture(i));
 
 
 		line_width = 0;
 		line_width = 0;
-		CodePoint prior_character = CodePoint::Null;
+		Character prior_character = Character::Null;
 
 
 		geometry[geometry_index].GetIndices().reserve(string.size() * 6);
 		geometry[geometry_index].GetIndices().reserve(string.size() * 6);
 		geometry[geometry_index].GetVertices().reserve(string.size() * 4);
 		geometry[geometry_index].GetVertices().reserve(string.size() * 4);
 
 
 		for (auto it_string = StringIteratorU8(string); it_string; ++it_string)
 		for (auto it_string = StringIteratorU8(string); it_string; ++it_string)
 		{
 		{
-			CodePoint code_point = *it_string;
+			Character character = *it_string;
 
 
-			const FontGlyph* glyph = GetOrAppendGlyph(code_point);
+			const FontGlyph* glyph = GetOrAppendGlyph(character);
 			if (!glyph)
 			if (!glyph)
 				continue;
 				continue;
 
 
 			// Adjust the cursor for the kerning between this character and the previous one.
 			// Adjust the cursor for the kerning between this character and the previous one.
-			if (prior_character != CodePoint::Null)
-				line_width += GetKerning(prior_character, code_point);
+			if (prior_character != Character::Null)
+				line_width += GetKerning(prior_character, character);
 
 
-			layer->GenerateGeometry(&geometry[geometry_index], code_point, Vector2f(position.x + line_width, position.y), layer_colour);
+			layer->GenerateGeometry(&geometry[geometry_index], character, Vector2f(position.x + line_width, position.y), layer_colour);
 
 
 			line_width += glyph->advance;
 			line_width += glyph->advance;
-			prior_character = code_point;
+			prior_character = character;
 		}
 		}
 
 
 		geometry_index += layer->GetNumTextures();
 		geometry_index += layer->GetNumTextures();
@@ -303,32 +303,32 @@ int FontFaceHandleDefault::GetVersion() const
 	return version;
 	return version;
 }
 }
 
 
-bool FontFaceHandleDefault::AppendGlyph(CodePoint code_point) 
+bool FontFaceHandleDefault::AppendGlyph(Character character)
 {
 {
-	bool result = FreeType::AppendGlyph(ft_face, metrics.size, code_point, glyphs);
+	bool result = FreeType::AppendGlyph(ft_face, metrics.size, character, glyphs);
 	return result;
 	return result;
 }
 }
 
 
-int FontFaceHandleDefault::GetKerning(CodePoint lhs, CodePoint rhs) const
+int FontFaceHandleDefault::GetKerning(Character lhs, Character rhs) const
 {
 {
 	int result = FreeType::GetKerning(ft_face, metrics.size, lhs, rhs);
 	int result = FreeType::GetKerning(ft_face, metrics.size, lhs, rhs);
 	return result;
 	return result;
 }
 }
 
 
-const FontGlyph* FontFaceHandleDefault::GetOrAppendGlyph(CodePoint& code_point, bool look_in_fallback_fonts)
+const FontGlyph* FontFaceHandleDefault::GetOrAppendGlyph(Character& character, bool look_in_fallback_fonts)
 {
 {
 	// Don't try to render control characters
 	// Don't try to render control characters
-	if ((char32_t)code_point < (char32_t)' ')
+	if ((char32_t)character < (char32_t)' ')
 		return nullptr;
 		return nullptr;
 
 
-	auto it_glyph = glyphs.find(code_point);
+	auto it_glyph = glyphs.find(character);
 	if (it_glyph == glyphs.end())
 	if (it_glyph == glyphs.end())
 	{
 	{
-		bool result = AppendGlyph(code_point);
+		bool result = AppendGlyph(character);
 
 
 		if (result)
 		if (result)
 		{
 		{
-			it_glyph = glyphs.find(code_point);
+			it_glyph = glyphs.find(character);
 			if (it_glyph == glyphs.end())
 			if (it_glyph == glyphs.end())
 			{
 			{
 				RMLUI_ERROR;
 				RMLUI_ERROR;
@@ -346,11 +346,11 @@ const FontGlyph* FontFaceHandleDefault::GetOrAppendGlyph(CodePoint& code_point,
 				if (!fallback_face || fallback_face == this)
 				if (!fallback_face || fallback_face == this)
 					continue;
 					continue;
 
 
-				const FontGlyph* glyph = fallback_face->GetOrAppendGlyph(code_point, false);
+				const FontGlyph* glyph = fallback_face->GetOrAppendGlyph(character, false);
 				if (glyph)
 				if (glyph)
 				{
 				{
 					// Insert the new glyph into our own set of glyphs
 					// Insert the new glyph into our own set of glyphs
-					auto pair = glyphs.emplace(code_point, glyph->WeakCopy());
+					auto pair = glyphs.emplace(character, glyph->WeakCopy());
 					it_glyph = pair.first;
 					it_glyph = pair.first;
 					if(pair.second)
 					if(pair.second)
 						is_layers_dirty = true;
 						is_layers_dirty = true;
@@ -361,8 +361,8 @@ const FontGlyph* FontFaceHandleDefault::GetOrAppendGlyph(CodePoint& code_point,
 			// If we still have not found a glyph, use the replacement character.
 			// If we still have not found a glyph, use the replacement character.
 			if(it_glyph == glyphs.end())
 			if(it_glyph == glyphs.end())
 			{
 			{
-				code_point = CodePoint::Replacement;
-				it_glyph = glyphs.find(code_point);
+				character = Character::Replacement;
+				it_glyph = glyphs.find(character);
 				if (it_glyph == glyphs.end())
 				if (it_glyph == glyphs.end())
 					return nullptr;
 					return nullptr;
 			}
 			}

+ 5 - 5
Source/Core/FontEngineDefault/FontFaceHandleDefault.h

@@ -74,7 +74,7 @@ public:
 	/// @param[in] string The string to measure.
 	/// @param[in] string The string to measure.
 	/// @param[in] prior_character The optionally-specified character that immediately precedes the string. This may have an impact on the string width due to kerning.
 	/// @param[in] prior_character The optionally-specified character that immediately precedes the string. This may have an impact on the string width due to kerning.
 	/// @return The width, in pixels, this string will occupy if rendered with this handle.
 	/// @return The width, in pixels, this string will occupy if rendered with this handle.
-	int GetStringWidth(const String& string, CodePoint prior_character = CodePoint::Null);
+	int GetStringWidth(const String& string, Character prior_character = Character::Null);
 
 
 	/// Generates, if required, the layer configuration for a given list of font effects.
 	/// Generates, if required, the layer configuration for a given list of font effects.
 	/// @param[in] font_effects The list of font effects to generate the configuration for.
 	/// @param[in] font_effects The list of font effects to generate the configuration for.
@@ -102,15 +102,15 @@ public:
 
 
 private:
 private:
 	// Build and append glyph to 'glyphs'
 	// Build and append glyph to 'glyphs'
-	bool AppendGlyph(CodePoint code_point);
+	bool AppendGlyph(Character character);
 
 
-	int GetKerning(CodePoint lhs, CodePoint rhs) const;
+	int GetKerning(Character lhs, Character rhs) const;
 
 
 	/// Retrieve a glyph from the given code point, building and appending a new glyph if not already built.
 	/// Retrieve a glyph from the given code point, building and appending a new glyph if not already built.
-	/// @param[in-out] code_point  The code point, can be changed e.g. to the replacement character if no glyph is found.
+	/// @param[in-out] character  The character, can be changed e.g. to the replacement character if no glyph is found.
 	/// @param[in] look_in_fallback_fonts  Look for the glyph in fallback fonts if not found locally, adding it to our glyphs.
 	/// @param[in] look_in_fallback_fonts  Look for the glyph in fallback fonts if not found locally, adding it to our glyphs.
 	/// @return The font glyph for the returned code point.
 	/// @return The font glyph for the returned code point.
-	const FontGlyph* GetOrAppendGlyph(CodePoint& code_point, bool look_in_fallback_fonts = true);
+	const FontGlyph* GetOrAppendGlyph(Character& character, bool look_in_fallback_fonts = true);
 
 
 	// Regenerate layers if dirty, such as after adding new glyphs.
 	// Regenerate layers if dirty, such as after adding new glyphs.
 	bool UpdateLayersOnDirty();
 	bool UpdateLayersOnDirty();

+ 31 - 31
Source/Core/FontEngineDefault/FontFaceLayer.cpp

@@ -53,7 +53,7 @@ bool FontFaceLayer::Generate(const FontFaceHandleDefault* handle, const FontFace
 			texture.RemoveDatabaseCache();
 			texture.RemoveDatabaseCache();
 
 
 		texture_layout = TextureLayout{};
 		texture_layout = TextureLayout{};
-		characters.clear();
+		character_boxes.clear();
 		textures.clear();
 		textures.clear();
 	}
 	}
 
 
@@ -63,7 +63,7 @@ bool FontFaceLayer::Generate(const FontFaceHandleDefault* handle, const FontFace
 	if (clone)
 	if (clone)
 	{
 	{
 		// Clone the geometry and textures from the clone layer.
 		// Clone the geometry and textures from the clone layer.
-		characters = clone->characters;
+		character_boxes = clone->character_boxes;
 
 
 		// Copy the cloned layer's textures.
 		// Copy the cloned layer's textures.
 		for (size_t i = 0; i < clone->textures.size(); ++i)
 		for (size_t i = 0; i < clone->textures.size(); ++i)
@@ -74,33 +74,33 @@ bool FontFaceLayer::Generate(const FontFaceHandleDefault* handle, const FontFace
 		{
 		{
 			for (auto& pair : glyphs)
 			for (auto& pair : glyphs)
 			{
 			{
-				CodePoint code_point = pair.first;
+				Character character = pair.first;
 				const FontGlyph& glyph = pair.second;
 				const FontGlyph& glyph = pair.second;
 
 
-				RMLUI_ASSERT(characters.find(code_point) != characters.end());
+				RMLUI_ASSERT(character_boxes.find(character) != character_boxes.end());
 
 
-				Character& character = characters[code_point];
+				TextureBox& box = character_boxes[character];
 
 
-				Vector2i glyph_origin(Math::RealToInteger(character.origin.x), Math::RealToInteger(character.origin.y));
-				Vector2i glyph_dimensions(Math::RealToInteger(character.dimensions.x), Math::RealToInteger(character.dimensions.y));
+				Vector2i glyph_origin(Math::RealToInteger(box.origin.x), Math::RealToInteger(box.origin.y));
+				Vector2i glyph_dimensions(Math::RealToInteger(box.dimensions.x), Math::RealToInteger(box.dimensions.y));
 
 
 				if (effect->GetGlyphMetrics(glyph_origin, glyph_dimensions, glyph))
 				if (effect->GetGlyphMetrics(glyph_origin, glyph_dimensions, glyph))
 				{
 				{
-					character.origin.x = (float)glyph_origin.x;
-					character.origin.y = (float)glyph_origin.y;
+					box.origin.x = (float)glyph_origin.x;
+					box.origin.y = (float)glyph_origin.y;
 				}
 				}
 				else
 				else
-					character.texture_index = -1;
+					box.texture_index = -1;
 			}
 			}
 		}
 		}
 	}
 	}
 	else
 	else
 	{
 	{
 		// Initialise the texture layout for the glyphs.
 		// Initialise the texture layout for the glyphs.
-		characters.reserve(glyphs.size());
+		character_boxes.reserve(glyphs.size());
 		for (auto& pair : glyphs)
 		for (auto& pair : glyphs)
 		{
 		{
-			CodePoint code_point = pair.first;
+			Character character = pair.first;
 			const FontGlyph& glyph = pair.second;
 			const FontGlyph& glyph = pair.second;
 
 
 			Vector2i glyph_origin(0, 0);
 			Vector2i glyph_origin(0, 0);
@@ -113,13 +113,13 @@ bool FontFaceLayer::Generate(const FontFaceHandleDefault* handle, const FontFace
 					continue;
 					continue;
 			}
 			}
 
 
-			Character character;
-			character.origin = Vector2f((float)(glyph_origin.x + glyph.bearing.x), (float)(glyph_origin.y - glyph.bearing.y));
-			character.dimensions = Vector2f((float)glyph_dimensions.x - glyph_origin.x, (float)glyph_dimensions.y - glyph_origin.y);
-			characters[code_point] = character;
+			TextureBox box;
+			box.origin = Vector2f((float)(glyph_origin.x + glyph.bearing.x), (float)(glyph_origin.y - glyph.bearing.y));
+			box.dimensions = Vector2f((float)glyph_dimensions.x - glyph_origin.x, (float)glyph_dimensions.y - glyph_origin.y);
+			character_boxes[character] = box;
 
 
 			// Add the character's dimensions into the texture layout engine.
 			// Add the character's dimensions into the texture layout engine.
-			texture_layout.AddRectangle((int)code_point, glyph_dimensions - glyph_origin);
+			texture_layout.AddRectangle((int)character, glyph_dimensions - glyph_origin);
 		}
 		}
 
 
 		constexpr int max_texture_dimensions = 2048;
 		constexpr int max_texture_dimensions = 2048;
@@ -136,18 +136,18 @@ bool FontFaceLayer::Generate(const FontFaceHandleDefault* handle, const FontFace
 		{
 		{
 			TextureLayoutRectangle& rectangle = texture_layout.GetRectangle(i);
 			TextureLayoutRectangle& rectangle = texture_layout.GetRectangle(i);
 			const TextureLayoutTexture& texture = texture_layout.GetTexture(rectangle.GetTextureIndex());
 			const TextureLayoutTexture& texture = texture_layout.GetTexture(rectangle.GetTextureIndex());
-			CodePoint code_point = (CodePoint)rectangle.GetId();
-			RMLUI_ASSERT(characters.find(code_point) != characters.end());
-			Character& character = characters[code_point];
+			Character character = (Character)rectangle.GetId();
+			RMLUI_ASSERT(character_boxes.find(character) != character_boxes.end());
+			TextureBox& box = character_boxes[character];
 
 
 			// Set the character's texture index.
 			// Set the character's texture index.
-			character.texture_index = rectangle.GetTextureIndex();
+			box.texture_index = rectangle.GetTextureIndex();
 
 
 			// Generate the character's texture coordinates.
 			// Generate the character's texture coordinates.
-			character.texcoords[0].x = float(rectangle.GetPosition().x) / float(texture.GetDimensions().x);
-			character.texcoords[0].y = float(rectangle.GetPosition().y) / float(texture.GetDimensions().y);
-			character.texcoords[1].x = float(rectangle.GetPosition().x + rectangle.GetDimensions().x) / float(texture.GetDimensions().x);
-			character.texcoords[1].y = float(rectangle.GetPosition().y + rectangle.GetDimensions().y) / float(texture.GetDimensions().y);
+			box.texcoords[0].x = float(rectangle.GetPosition().x) / float(texture.GetDimensions().x);
+			box.texcoords[0].y = float(rectangle.GetPosition().y) / float(texture.GetDimensions().y);
+			box.texcoords[1].x = float(rectangle.GetPosition().x + rectangle.GetDimensions().x) / float(texture.GetDimensions().x);
+			box.texcoords[1].y = float(rectangle.GetPosition().y + rectangle.GetDimensions().y) / float(texture.GetDimensions().y);
 		}
 		}
 
 
 		const FontEffect* effect_ptr = effect.get();
 		const FontEffect* effect_ptr = effect.get();
@@ -186,15 +186,15 @@ bool FontFaceLayer::GenerateTexture(UniquePtr<const byte[]>& texture_data, Vecto
 	for (int i = 0; i < texture_layout.GetNumRectangles(); ++i)
 	for (int i = 0; i < texture_layout.GetNumRectangles(); ++i)
 	{
 	{
 		TextureLayoutRectangle& rectangle = texture_layout.GetRectangle(i);
 		TextureLayoutRectangle& rectangle = texture_layout.GetRectangle(i);
-		CodePoint code_point = (CodePoint)rectangle.GetId();
-		RMLUI_ASSERT(characters.find(code_point) != characters.end());
+		Character character = (Character)rectangle.GetId();
+		RMLUI_ASSERT(character_boxes.find(character) != character_boxes.end());
 
 
-		Character& character = characters[code_point];
+		TextureBox& box = character_boxes[character];
 
 
-		if (character.texture_index != texture_id)
+		if (box.texture_index != texture_id)
 			continue;
 			continue;
 
 
-		auto it = glyphs.find((CodePoint)rectangle.GetId());
+		auto it = glyphs.find((Character)rectangle.GetId());
 		if (it == glyphs.end())
 		if (it == glyphs.end())
 			continue;
 			continue;
 
 
@@ -220,7 +220,7 @@ bool FontFaceLayer::GenerateTexture(UniquePtr<const byte[]>& texture_data, Vecto
 		}
 		}
 		else
 		else
 		{
 		{
-			effect->GenerateGlyphTexture(rectangle.GetTextureData(), Vector2i(Math::RealToInteger(character.dimensions.x), Math::RealToInteger(character.dimensions.y)), rectangle.GetTextureStride(), glyph);
+			effect->GenerateGlyphTexture(rectangle.GetTextureData(), Vector2i(Math::RealToInteger(box.dimensions.x), Math::RealToInteger(box.dimensions.y)), rectangle.GetTextureStride(), glyph);
 		}
 		}
 	}
 	}
 
 

+ 15 - 15
Source/Core/FontEngineDefault/FontFaceLayer.h

@@ -73,31 +73,31 @@ public:
 	/// @param[in] character_code The character to generate geometry for.
 	/// @param[in] character_code The character to generate geometry for.
 	/// @param[in] position The position of the baseline.
 	/// @param[in] position The position of the baseline.
 	/// @param[in] colour The colour of the string.
 	/// @param[in] colour The colour of the string.
-	inline void GenerateGeometry(Geometry* geometry, const CodePoint character_code, const Vector2f& position, const Colourb& colour) const
+	inline void GenerateGeometry(Geometry* geometry, const Character character_code, const Vector2f& position, const Colourb& colour) const
 	{
 	{
-		auto it = characters.find(character_code);
-		if (it == characters.end())
+		auto it = character_boxes.find(character_code);
+		if (it == character_boxes.end())
 			return;
 			return;
 
 
-		const Character& character = it->second;
+		const TextureBox& box = it->second;
 
 
-		if (character.texture_index < 0)
+		if (box.texture_index < 0)
 			return;
 			return;
 
 
 		// Generate the geometry for the character.
 		// Generate the geometry for the character.
-		std::vector< Vertex >& character_vertices = geometry[character.texture_index].GetVertices();
-		std::vector< int >& character_indices = geometry[character.texture_index].GetIndices();
+		std::vector< Vertex >& character_vertices = geometry[box.texture_index].GetVertices();
+		std::vector< int >& character_indices = geometry[box.texture_index].GetIndices();
 
 
 		character_vertices.resize(character_vertices.size() + 4);
 		character_vertices.resize(character_vertices.size() + 4);
 		character_indices.resize(character_indices.size() + 6);
 		character_indices.resize(character_indices.size() + 6);
 		GeometryUtilities::GenerateQuad(
 		GeometryUtilities::GenerateQuad(
 			&character_vertices[0] + (character_vertices.size() - 4),
 			&character_vertices[0] + (character_vertices.size() - 4),
 			&character_indices[0] + (character_indices.size() - 6),
 			&character_indices[0] + (character_indices.size() - 6),
-			Vector2f(position.x + character.origin.x, position.y + character.origin.y).Round(),
-			character.dimensions,
+			Vector2f(position.x + box.origin.x, position.y + box.origin.y).Round(),
+			box.dimensions,
 			colour,
 			colour,
-			character.texcoords[0],
-			character.texcoords[1],
+			box.texcoords[0],
+			box.texcoords[1],
 			(int)character_vertices.size() - 4
 			(int)character_vertices.size() - 4
 		);
 		);
 	}
 	}
@@ -116,9 +116,9 @@ public:
 private:
 private:
 
 
 
 
-	struct Character
+	struct TextureBox
 	{
 	{
-		Character() : texture_index(-1) { }
+		TextureBox() : texture_index(-1) { }
 
 
 		// The offset, in pixels, of the baseline from the start of this character's geometry.
 		// The offset, in pixels, of the baseline from the start of this character's geometry.
 		Vector2f origin;
 		Vector2f origin;
@@ -131,14 +131,14 @@ private:
 		int texture_index;
 		int texture_index;
 	};
 	};
 
 
-	using CharacterMap = UnorderedMap<CodePoint, Character>;
+	using CharacterMap = UnorderedMap<Character, TextureBox>;
 	using TextureList = std::vector<Texture>;
 	using TextureList = std::vector<Texture>;
 
 
 	SharedPtr<const FontEffect> effect;
 	SharedPtr<const FontEffect> effect;
 
 
 	TextureLayout texture_layout;
 	TextureLayout texture_layout;
 
 
-	CharacterMap characters;
+	CharacterMap character_boxes;
 	TextureList textures;
 	TextureList textures;
 	Colourb colour;
 	Colourb colour;
 };
 };

+ 13 - 13
Source/Core/FontEngineDefault/FreeTypeInterface.cpp

@@ -39,7 +39,7 @@ namespace Core {
 static FT_Library ft_library = nullptr;
 static FT_Library ft_library = nullptr;
 
 
 
 
-static bool BuildGlyph(FT_Face ft_face, CodePoint code_point, FontGlyphMap& glyphs);
+static bool BuildGlyph(FT_Face ft_face, Character character, FontGlyphMap& glyphs);
 static void BuildGlyphMap(FT_Face ft_face, int size, FontGlyphMap& glyphs);
 static void BuildGlyphMap(FT_Face ft_face, int size, FontGlyphMap& glyphs);
 static void GenerateMetrics(FT_Face ft_face, const FontGlyphMap& glyphs, FontMetrics& metrics);
 static void GenerateMetrics(FT_Face ft_face, const FontGlyphMap& glyphs, FontMetrics& metrics);
 
 
@@ -144,11 +144,11 @@ bool FreeType::InitialiseFaceHandle(FontFaceHandleFreetype face, int font_size,
 	return true;
 	return true;
 }
 }
 
 
-bool FreeType::AppendGlyph(FontFaceHandleFreetype face, int font_size, CodePoint code_point, FontGlyphMap& glyphs)
+bool FreeType::AppendGlyph(FontFaceHandleFreetype face, int font_size, Character character, FontGlyphMap& glyphs)
 {
 {
 	FT_Face ft_face = (FT_Face)face;
 	FT_Face ft_face = (FT_Face)face;
 
 
-	RMLUI_ASSERT(glyphs.find(code_point) == glyphs.end());
+	RMLUI_ASSERT(glyphs.find(character) == glyphs.end());
 	RMLUI_ASSERT(ft_face);
 	RMLUI_ASSERT(ft_face);
 
 
 	// Set face size again in case it was used at another size in another font face handle.
 	// Set face size again in case it was used at another size in another font face handle.
@@ -159,14 +159,14 @@ bool FreeType::AppendGlyph(FontFaceHandleFreetype face, int font_size, CodePoint
 		return false;
 		return false;
 	}
 	}
 
 
-	if (!BuildGlyph(ft_face, code_point, glyphs))
+	if (!BuildGlyph(ft_face, character, glyphs))
 		return false;
 		return false;
 
 
 	return true;
 	return true;
 }
 }
 
 
 
 
-int FreeType::GetKerning(FontFaceHandleFreetype face, int font_size, CodePoint lhs, CodePoint rhs)
+int FreeType::GetKerning(FontFaceHandleFreetype face, int font_size, Character lhs, Character rhs)
 {
 {
 	FT_Face ft_face = (FT_Face)face;
 	FT_Face ft_face = (FT_Face)face;
 
 
@@ -206,10 +206,10 @@ static void BuildGlyphMap(FT_Face ft_face, int size, FontGlyphMap& glyphs)
 	FT_ULong code_max = 126;
 	FT_ULong code_max = 126;
 
 
 	for (FT_ULong character_code = code_min; character_code <= code_max; ++character_code)
 	for (FT_ULong character_code = code_min; character_code <= code_max; ++character_code)
-		BuildGlyph(ft_face, (CodePoint)character_code, glyphs);
+		BuildGlyph(ft_face, (Character)character_code, glyphs);
 
 
 	// Add a replacement character for rendering unknown characters.
 	// Add a replacement character for rendering unknown characters.
-	CodePoint replacement_character = CodePoint::Replacement;
+	Character replacement_character = Character::Replacement;
 	auto it = glyphs.find(replacement_character);
 	auto it = glyphs.find(replacement_character);
 	if (it == glyphs.end())
 	if (it == glyphs.end())
 	{
 	{
@@ -237,30 +237,30 @@ static void BuildGlyphMap(FT_Face ft_face, int size, FontGlyphMap& glyphs)
 	}
 	}
 }
 }
 
 
-static bool BuildGlyph(FT_Face ft_face, CodePoint code_point, FontGlyphMap& glyphs)
+static bool BuildGlyph(FT_Face ft_face, Character character, FontGlyphMap& glyphs)
 {
 {
-	int index = FT_Get_Char_Index(ft_face, (FT_ULong)code_point);
+	int index = FT_Get_Char_Index(ft_face, (FT_ULong)character);
 	if (index == 0)
 	if (index == 0)
 		return false;
 		return false;
 
 
 	FT_Error error = FT_Load_Glyph(ft_face, index, 0);
 	FT_Error error = FT_Load_Glyph(ft_face, index, 0);
 	if (error != 0)
 	if (error != 0)
 	{
 	{
-		Log::Message(Log::LT_WARNING, "Unable to load glyph for character '%u' on the font face '%s %s'; error code: %d.", code_point, ft_face->family_name, ft_face->style_name, error);
+		Log::Message(Log::LT_WARNING, "Unable to load glyph for character '%u' on the font face '%s %s'; error code: %d.", character, ft_face->family_name, ft_face->style_name, error);
 		return false;
 		return false;
 	}
 	}
 
 
 	error = FT_Render_Glyph(ft_face->glyph, FT_RENDER_MODE_NORMAL);
 	error = FT_Render_Glyph(ft_face->glyph, FT_RENDER_MODE_NORMAL);
 	if (error != 0)
 	if (error != 0)
 	{
 	{
-		Log::Message(Log::LT_WARNING, "Unable to render glyph for character '%u' on the font face '%s %s'; error code: %d.", code_point, ft_face->family_name, ft_face->style_name, error);
+		Log::Message(Log::LT_WARNING, "Unable to render glyph for character '%u' on the font face '%s %s'; error code: %d.", character, ft_face->family_name, ft_face->style_name, error);
 		return false;
 		return false;
 	}
 	}
 
 
-	auto result = glyphs.emplace(code_point, FontGlyph{});
+	auto result = glyphs.emplace(character, FontGlyph{});
 	if (!result.second)
 	if (!result.second)
 	{
 	{
-		Log::Message(Log::LT_WARNING, "Glyph character '%u' is already loaded in the font face '%s %s'.", code_point, ft_face->family_name, ft_face->style_name);
+		Log::Message(Log::LT_WARNING, "Glyph character '%u' is already loaded in the font face '%s %s'.", character, ft_face->family_name, ft_face->style_name);
 		return false;
 		return false;
 	}
 	}
 
 

+ 2 - 2
Source/Core/FontEngineDefault/FreeTypeInterface.h

@@ -53,10 +53,10 @@ void GetFaceStyle(FontFaceHandleFreetype face, String& font_family, Style::FontS
 bool InitialiseFaceHandle(FontFaceHandleFreetype face, int font_size, FontGlyphMap& glyphs, FontMetrics& metrics);
 bool InitialiseFaceHandle(FontFaceHandleFreetype face, int font_size, FontGlyphMap& glyphs, FontMetrics& metrics);
 
 
 // Build a new glyph representing the given code point and append to 'glyphs'.
 // Build a new glyph representing the given code point and append to 'glyphs'.
-bool AppendGlyph(FontFaceHandleFreetype face, int font_size, CodePoint code_point, FontGlyphMap& glyphs);
+bool AppendGlyph(FontFaceHandleFreetype face, int font_size, Character character, FontGlyphMap& glyphs);
 
 
 // Returns the kerning between two characters.
 // Returns the kerning between two characters.
-int GetKerning(FontFaceHandleFreetype face, int font_size, CodePoint lhs, CodePoint rhs);
+int GetKerning(FontFaceHandleFreetype face, int font_size, Character lhs, Character rhs);
 
 
 }
 }
 }
 }

+ 1 - 1
Source/Core/FontEngineInterface.cpp

@@ -89,7 +89,7 @@ float FontEngineInterface::GetUnderline(FontFaceHandle, float &)
 	return 0;
 	return 0;
 }
 }
 
 
-int FontEngineInterface::GetStringWidth(FontFaceHandle, const String& RMLUI_UNUSED_PARAMETER(string), CodePoint RMLUI_UNUSED_PARAMETER(prior_character))
+int FontEngineInterface::GetStringWidth(FontFaceHandle, const String& RMLUI_UNUSED_PARAMETER(string), Character RMLUI_UNUSED_PARAMETER(prior_character))
 {
 {
 	RMLUI_UNUSED(string);
 	RMLUI_UNUSED(string);
 	RMLUI_UNUSED(prior_character);
 	RMLUI_UNUSED(prior_character);

+ 25 - 25
Source/Core/StringUtilities.cpp

@@ -262,10 +262,10 @@ bool StringUtilities::StringComparei::operator()(const String& lhs, const String
 }
 }
 
 
 
 
-CodePoint StringUtilities::ToCodePoint(const char* p)
+Character StringUtilities::ToCharacter(const char* p)
 {
 {
 	if ((*p & (1 << 7)) == 0)
 	if ((*p & (1 << 7)) == 0)
-		return static_cast<CodePoint>(*p);
+		return static_cast<Character>(*p);
 
 
 	int num_bytes = 0;
 	int num_bytes = 0;
 	int code = 0;
 	int code = 0;
@@ -288,7 +288,7 @@ CodePoint StringUtilities::ToCodePoint(const char* p)
 	else
 	else
 	{
 	{
 		// Invalid begin byte
 		// Invalid begin byte
-		return CodePoint::Null;
+		return Character::Null;
 	}
 	}
 
 
 	for (int i = 1; i < num_bytes; i++)
 	for (int i = 1; i < num_bytes; i++)
@@ -298,30 +298,30 @@ CodePoint StringUtilities::ToCodePoint(const char* p)
 		{
 		{
 			// Invalid continuation byte
 			// Invalid continuation byte
 			++p;
 			++p;
-			return CodePoint::Null;
+			return Character::Null;
 		}
 		}
 
 
 		code = ((code << 6) | (byte & 0b0011'1111));
 		code = ((code << 6) | (byte & 0b0011'1111));
 	}
 	}
 
 
-	return static_cast<CodePoint>(code);
+	return static_cast<Character>(code);
 }
 }
 
 
-String StringUtilities::ToUTF8(CodePoint code_point)
+String StringUtilities::ToUTF8(Character character)
 {
 {
-	return ToUTF8(&code_point, 1);
+	return ToUTF8(&character, 1);
 }
 }
 
 
-String StringUtilities::ToUTF8(const CodePoint* code_points, int num_code_points)
+String StringUtilities::ToUTF8(const Character* characters, int num_characters)
 {
 {
 	String result;
 	String result;
-	result.reserve(num_code_points);
+	result.reserve(num_characters);
 
 
-	bool invalid_code_point = false;
+	bool invalid_character = false;
 
 
-	for (int i = 0; i < num_code_points; i++)
+	for (int i = 0; i < num_characters; i++)
 	{
 	{
-		char32_t c = (char32_t)code_points[i];
+		char32_t c = (char32_t)characters[i];
 
 
 		constexpr int l3 = 0b0000'0111;
 		constexpr int l3 = 0b0000'0111;
 		constexpr int l4 = 0b0000'1111;
 		constexpr int l4 = 0b0000'1111;
@@ -341,10 +341,10 @@ String StringUtilities::ToUTF8(const CodePoint* code_points, int num_code_points
 		else if (c <= 0x10FFFF)
 		else if (c <= 0x10FFFF)
 			result += { char(((c >> 18) & l3) | h4), char(((c >> 12) & l6) | h1), char(((c >> 6) & l6) | h1), char((c & l6) | h1) };
 			result += { char(((c >> 18) & l3) | h4), char(((c >> 12) & l6) | h1), char(((c >> 6) & l6) | h1), char((c & l6) | h1) };
 		else
 		else
-			invalid_code_point = true;
+			invalid_character = true;
 	}
 	}
 
 
-	if (invalid_code_point)
+	if (invalid_character)
 		Log::Message(Log::LT_WARNING, "One or more invalid code points encountered while encoding to UTF-8.");
 		Log::Message(Log::LT_WARNING, "One or more invalid code points encountered while encoding to UTF-8.");
 
 
 	return result;
 	return result;
@@ -377,19 +377,19 @@ U16String StringUtilities::ToUTF16(const String& input)
 	if (input.empty())
 	if (input.empty())
 		return result;
 		return result;
 
 
-	std::vector<CodePoint> code_points;
-	code_points.reserve(input.size());
+	std::vector<Character> characters;
+	characters.reserve(input.size());
 
 
 	for (auto it = StringIteratorU8(input); it; ++it)
 	for (auto it = StringIteratorU8(input); it; ++it)
-		code_points.push_back(*it);
+		characters.push_back(*it);
 
 
 	result.reserve(input.size());
 	result.reserve(input.size());
 
 
 	bool valid_characters = true;
 	bool valid_characters = true;
 
 
-	for (CodePoint code_point : code_points)
+	for (Character character : characters)
 	{
 	{
-		char32_t c = (char32_t)code_point;
+		char32_t c = (char32_t)character;
 
 
 		if (c <= 0xD7FF || (c >= 0xE000 && c <= 0xFFFF))
 		if (c <= 0xD7FF || (c >= 0xE000 && c <= 0xFFFF))
 		{
 		{
@@ -418,8 +418,8 @@ U16String StringUtilities::ToUTF16(const String& input)
 
 
 String StringUtilities::ToUTF8(const U16String& input)
 String StringUtilities::ToUTF8(const U16String& input)
 {
 {
-	std::vector<CodePoint> code_points;
-	code_points.reserve(input.size());
+	std::vector<Character> characters;
+	characters.reserve(input.size());
 
 
 	bool valid_input = true;
 	bool valid_input = true;
 	char16_t w1 = 0;
 	char16_t w1 = 0;
@@ -429,7 +429,7 @@ String StringUtilities::ToUTF8(const U16String& input)
 		if (w <= 0xD7FF || w >= 0xE000)
 		if (w <= 0xD7FF || w >= 0xE000)
 		{
 		{
 			// Single 16-bit code unit.
 			// Single 16-bit code unit.
-			code_points.push_back((CodePoint)(w));
+			characters.push_back((Character)(w));
 		}
 		}
 		else
 		else
 		{
 		{
@@ -440,7 +440,7 @@ String StringUtilities::ToUTF8(const U16String& input)
 			}
 			}
 			else if (w1 && w >= 0xDC00)
 			else if (w1 && w >= 0xDC00)
 			{
 			{
-				code_points.push_back((CodePoint)(((((char32_t)w1 & 0x3FF) << 10) | ((char32_t)(w) & 0x3FF)) + 0x10000u));
+				characters.push_back((Character)(((((char32_t)w1 & 0x3FF) << 10) | ((char32_t)(w) & 0x3FF)) + 0x10000u));
 				w1 = 0;
 				w1 = 0;
 			}
 			}
 			else
 			else
@@ -452,8 +452,8 @@ String StringUtilities::ToUTF8(const U16String& input)
 
 
 	String result;
 	String result;
 
 
-	if (code_points.size() > 0)
-		result = StringUtilities::ToUTF8(code_points.data(), (int)code_points.size());
+	if (characters.size() > 0)
+		result = StringUtilities::ToUTF8(characters.data(), (int)characters.size());
 
 
 	if (!valid_input)
 	if (!valid_input)
 		Log::Message(Log::LT_WARNING, "Invalid characters encountered while converting UTF-16 string to UTF-8.");
 		Log::Message(Log::LT_WARNING, "Invalid characters encountered while converting UTF-16 string to UTF-8.");

+ 3 - 3
Source/Core/Variant.cpp

@@ -215,10 +215,10 @@ void Variant::Set(const int value)
 	type = INT;
 	type = INT;
 	SET_VARIANT(int);
 	SET_VARIANT(int);
 }
 }
-void Variant::Set(const CodePoint value)
+void Variant::Set(const Character value)
 {
 {
 	type = WORD;
 	type = WORD;
-	SET_VARIANT(CodePoint);
+	SET_VARIANT(Character);
 }
 }
 
 
 void Variant::Set(const char* value) 
 void Variant::Set(const char* value) 
@@ -455,7 +455,7 @@ bool Variant::operator==(const Variant & other) const
 	case STRING:
 	case STRING:
 		return DEFAULT_VARIANT_COMPARE(String);
 		return DEFAULT_VARIANT_COMPARE(String);
 	case WORD:
 	case WORD:
-		return DEFAULT_VARIANT_COMPARE(CodePoint);
+		return DEFAULT_VARIANT_COMPARE(Character);
 	case VECTOR2:
 	case VECTOR2:
 		return DEFAULT_VARIANT_COMPARE(Vector2f);
 		return DEFAULT_VARIANT_COMPARE(Vector2f);
 	case VECTOR3:
 	case VECTOR3: