Ver Fonte

Remove UnicodeRange

Michael Ragazzon há 6 anos atrás
pai
commit
8d914870ed

+ 0 - 2
CMake/FileList.cmake

@@ -84,7 +84,6 @@ set(Core_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutRow.h
     ${PROJECT_SOURCE_DIR}/Source/Core/TextureLayoutTexture.h
     ${PROJECT_SOURCE_DIR}/Source/Core/TextureResource.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/UnicodeRange.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Utilities.h
     ${PROJECT_SOURCE_DIR}/Source/Core/WidgetSlider.h
     ${PROJECT_SOURCE_DIR}/Source/Core/WidgetSliderScroll.h
@@ -317,7 +316,6 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/TransformPrimitive.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/TransformState.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/TypeConverter.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/UnicodeRange.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/URL.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Variant.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Vector3.cpp

+ 0 - 1
Source/Core/FontFaceHandle.h

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

+ 0 - 2
Source/Core/FreeType/FontFace.cpp

@@ -47,8 +47,6 @@ FontFace_FreeType::~FontFace_FreeType()
 // Returns a handle for positioning and rendering this face at the given size.
 SharedPtr<Rml::Core::FontFaceHandle> FontFace_FreeType::GetHandle(int size)
 {
-	UnicodeRangeList charset;
-
 	auto it = handles.find(size);
 	if (it != handles.end())
 		return it->second;

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

@@ -29,7 +29,6 @@
 #ifndef RMLUICOREFREETYPEFONTFACEHANDLE_H
 #define RMLUICOREFREETYPEFONTFACEHANDLE_H
 
-#include "../UnicodeRange.h"
 #include "../FontFaceHandle.h"
 #include "../../../Include/RmlUi/Core/FontEffect.h"
 #include "../../../Include/RmlUi/Core/FontGlyph.h"

+ 0 - 167
Source/Core/UnicodeRange.cpp

@@ -1,167 +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.
- *
- */
-
-#include "precompiled.h"
-#include "UnicodeRange.h"
-
-namespace Rml {
-namespace Core {
-
-UnicodeRange::UnicodeRange()
-{
-	min_codepoint = UINT_MAX;
-	max_codepoint = UINT_MAX;
-}
-
-UnicodeRange::UnicodeRange(int _min_codepoint, int _max_codepoint)
-{
-	min_codepoint = _min_codepoint;
-	max_codepoint = _max_codepoint;
-
-	RMLUI_ASSERT(min_codepoint <= max_codepoint);
-}
-
-// Initialises the range from a unicode range in string form.
-bool UnicodeRange::Initialise(const String& unicode_range)
-{
-	// Check for a 'U+' at the start.
-	if (unicode_range.size() < 2 ||
-		unicode_range[0] != 'U' ||
-		unicode_range[1] != '+')
-		return false;
-
-	// Check if there's a '-' sign; if so, we've got a range.
-	String::size_type separator_index = unicode_range.find("-", 2);
-	if (separator_index != String::npos)
-	{
-		const char* end = unicode_range.c_str() + separator_index;
-		min_codepoint = strtoul(unicode_range.c_str() + 2, (char **) &end, 16);
-
-		end = unicode_range.c_str() + unicode_range.size();
-		max_codepoint = strtoul(unicode_range.c_str() + separator_index + 1, (char **) &end, 16);
-
-		return min_codepoint <= max_codepoint;
-	}
-
-	// No range! Check if we have any wildcards.
-	String::size_type wildcard_index = unicode_range.find("?", 2);
-	if (wildcard_index != String::npos)
-	{
-		String range_min(unicode_range.c_str() + 2, unicode_range.c_str() + wildcard_index);
-		String range_max(range_min);
-
-		for (String::size_type i = 0; i < unicode_range.size() - wildcard_index; ++i)
-		{
-			range_min += "0";
-			range_max += "F";
-		}
-
-		const char* end = range_min.c_str() + range_min.size();
-		min_codepoint = strtoul(range_min.c_str(), (char**) &end, 16);
-		end = range_max.c_str() + range_max.size();
-		max_codepoint = strtoul(range_max.c_str(), (char**) &end, 16);
-
-		return true;
-	}
-
-	const char* end = unicode_range.c_str() + unicode_range.size();
-	min_codepoint = strtoul(unicode_range.c_str() + 2, (char**) &end, 16);
-	max_codepoint = min_codepoint;
-
-	return true;
-}
-
-// Builds up a list of unicode ranges from a comma-separated list of unicode ranges in string form.
-bool UnicodeRange::BuildList(UnicodeRangeList& list, const String& unicode_range)
-{
-	StringList unicode_ranges;
-	StringUtilities::ExpandString(unicode_ranges, unicode_range);
-
-	for (size_t i = 0; i < unicode_ranges.size(); ++i)
-	{
-		UnicodeRange range;
-		if (!range.Initialise(unicode_ranges[i]))
-			return false;
-
-		list.push_back(range);
-	}
-
-	// Collapse contiguous ranges.
-	for (size_t i = 0; i < list.size(); ++i)
-	{
-		size_t j = i + 1;
-		while (j < list.size())
-		{
-			if (list[i].IsContiguous(list[j]))
-			{
-				list[i] = list[i].Join(list[j]);
-				list.erase(list.begin() + j);
-			}
-			else
-				++j;
-		}
-	}
-
-	return !list.empty();
-}
-
-// Returns true if this range is wholly contained within another range.
-bool UnicodeRange::IsContained(const UnicodeRange& rhs)
-{
-	return rhs.min_codepoint <= min_codepoint &&
-		   rhs.max_codepoint >= max_codepoint;
-}
-
-// Returns true if this range is wholly contained within another range list.
-bool UnicodeRange::IsContained(const UnicodeRangeList& rhs)
-{
-	for (size_t i = 0; i < rhs.size(); ++i)
-	{
-		if (IsContained(rhs[i]))
-			return true;
-	}
-
-	return false;
-}
-
-// Returns true if this range is contained or contiguous with another range.
-bool UnicodeRange::IsContiguous(const UnicodeRange& rhs)
-{
-	return (min_codepoint >= rhs.min_codepoint && min_codepoint <= ((rhs.max_codepoint == 0xFFFFFFFF) ? rhs.max_codepoint : rhs.max_codepoint + 1)) ||
-		   (max_codepoint >= ((rhs.min_codepoint == 0) ? 0 : rhs.min_codepoint - 1) && max_codepoint <= rhs.max_codepoint);
-}
-
-// Joins this range with another that it is contiguous with.
-UnicodeRange UnicodeRange::Join(const UnicodeRange& rhs)
-{
-	return UnicodeRange(Math::Min(min_codepoint, rhs.min_codepoint),
-						   Math::Max(max_codepoint, rhs.max_codepoint));
-}
-
-}
-}

+ 0 - 81
Source/Core/UnicodeRange.h

@@ -1,81 +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 RMLUICOREUNICODERANGE_H
-#define RMLUICOREUNICODERANGE_H
-
-namespace Rml {
-namespace Core {
-
-class UnicodeRange;
-typedef std::vector< UnicodeRange > UnicodeRangeList;
-
-/**
- */
-
-class UnicodeRange
-{
-public:
-	UnicodeRange();
-	UnicodeRange(int min_codepoint, int max_codepoint);
-
-	/// Initialises the range from a unicode range in string form.
-	/// @param[in] unicode_range The string specified the unicode range.
-	/// @return True if the range is valid, false otherwise.
-	bool Initialise(const String& unicode_range);
-
-	/// Builds up a list of unicode ranges from a comma-separated list of unicode ranges in string form.
-	/// @param[out] list The returned list.
-	/// @param[in] unicode_range The comma-separated list of unicode ranges.
-	/// @return True if all values were parsed successfully and at least one value is returned in the list, false otherwise.
-	static bool BuildList(UnicodeRangeList& list, const String& unicode_range);
-
-	/// Returns true if this range is wholly contained within another range.
-	/// @param[in] rhs The range to check against.
-	bool IsContained(const UnicodeRange& rhs);
-	/// Returns true if this range is wholly contained within another range list.
-	/// @param[in] rhs The range list to check against.
-	bool IsContained(const UnicodeRangeList& rhs);
-
-	/// Returns true if this range is contained or contiguous with another range.
-	/// @param[in] rhs The range to check against.
-	/// @return True if the ranges are contiguous, false otherwise.
-	bool IsContiguous(const UnicodeRange& rhs);
-	/// Joins this range with another that it is contiguous with.
-	/// @param[in] rhs The range to join with this range.
-	/// @return The new, joined, range containing both the original ranges.
-	UnicodeRange Join(const UnicodeRange& rhs);
-
-	unsigned int min_codepoint;
-	unsigned int max_codepoint;
-};
-
-}
-}
-
-#endif