Browse Source

Fix some inconsistent style

Michael Ragazzon 6 years ago
parent
commit
1ea89f48f9

+ 1 - 5
Source/Core/ElementTextDefault.cpp

@@ -83,14 +83,10 @@ void ElementTextDefault::OnRender()
 	if (font_face_handle == 0)
 		return;
 	
-	
 	// If our font configuration has potentially changed, update it and force a geometry
 	// generation if necessary.
-	if (font_dirty &&
-		UpdateFontConfiguration())
-	{
+	if (font_dirty && UpdateFontConfiguration())
 		geometry_dirty = true;
-	}
 
 	// Regenerate the geometry if the colour or font configuration has altered.
 	if (geometry_dirty)

+ 3 - 3
Source/Core/FontEngineInterfaceDefault.h

@@ -14,7 +14,7 @@
  *
  * 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
@@ -33,7 +33,7 @@
 namespace Rml {
 namespace Core {
 
-class RMLUICORE_API FontEngineInterfaceDefault: public FontEngineInterface
+class RMLUICORE_API FontEngineInterfaceDefault : public FontEngineInterface
 {
 public:
 	FontEngineInterfaceDefault();
@@ -64,7 +64,7 @@ public:
 	int GetBaseline(FontFaceHandle) override;
 
 	/// Returns the font's underline, as a pixel offset from the bottom of the font.
-	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.
 	int GetStringWidth(FontFaceHandle, const String& string, CodePoint prior_character) override;

+ 1 - 1
Source/Core/FontFace.cpp

@@ -15,7 +15,7 @@
  *
  * 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

+ 5 - 5
Source/Core/FontFace.h

@@ -15,7 +15,7 @@
  *
  * 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
@@ -43,8 +43,8 @@ class FontFaceHandleDefault;
 class FontFace
 {
 public:
-    FontFace(Style::FontStyle style, Style::FontWeight weight, bool release_stream);
-    virtual ~FontFace();
+	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.
@@ -56,11 +56,11 @@ public:
 	/// Returns a handle for positioning and rendering this face at the given size.
 	/// @param[in] size The size of the desired handle, in points.
 	/// @return The shared font handle.
-    virtual SharedPtr<FontFaceHandleDefault> GetHandle(int size) = 0;
+	virtual SharedPtr<FontFaceHandleDefault> GetHandle(int size) = 0;
 
 	/// Releases the face's FreeType face structure. This will mean handles for new sizes cannot be constructed,
 	/// but existing ones can still be fetched.
-    virtual void ReleaseFace() = 0;
+	virtual void ReleaseFace() = 0;
 
 protected:
 	Style::FontStyle style;

+ 3 - 10
Source/Core/FontFaceHandleDefault.h

@@ -15,7 +15,7 @@
  *
  * 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
@@ -85,7 +85,7 @@ public:
 
 	/// Returns the font's underline, as a pixel offset from the bottom of the font.
 	/// @return The font's underline thickness.
-	float GetUnderline(float *thickness) const;
+	float GetUnderline(float* thickness) const;
 
 	/// Returns the font's glyphs.
 	/// @return The font's glyphs.
@@ -115,13 +115,6 @@ public:
 	/// @param[in] colour The colour to render the text.
 	/// @return The width, in pixels, of the string geometry.
 	int GenerateString(GeometryList& geometry, const String& string, const Vector2f& position, const Colourb& colour, int layer_configuration = 0) const;
-	/// Generates the geometry required to render a line above, below or through a line of text.
-	/// @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] 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, Style::TextDecoration decoration_type, const Colourb& colour) const;
 
 protected:
 
@@ -129,7 +122,7 @@ protected:
 	FontMetrics& GetMetrics();
 
 	void GenerateBaseLayer();
-	
+
 	virtual int GetKerning(CodePoint lhs, CodePoint rhs) const = 0;
 
 private:

+ 8 - 8
Source/Core/FontFaceLayer.cpp

@@ -15,7 +15,7 @@
  *
  * 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
@@ -35,7 +35,7 @@ namespace Rml {
 namespace Core {
 
 #ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-	
+
 FontFaceLayer::FontFaceLayer() : colour(255, 255, 255)
 {
 	handle = nullptr;
@@ -83,8 +83,8 @@ bool FontFaceLayer::Initialise(const FontFaceHandleDefault* _handle, SharedPtr<c
 
 				if (effect->GetGlyphMetrics(glyph_origin, glyph_dimensions, glyph))
 				{
-					character.origin.x = (float) glyph_origin.x;
-					character.origin.y = (float) glyph_origin.y;
+					character.origin.x = (float)glyph_origin.x;
+					character.origin.y = (float)glyph_origin.y;
 				}
 				else
 					character.texture_index = -1;
@@ -111,8 +111,8 @@ bool FontFaceLayer::Initialise(const FontFaceHandleDefault* _handle, SharedPtr<c
 			}
 
 			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);
+			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;
 
 			// Add the character's dimensions into the texture layout engine.
@@ -181,7 +181,7 @@ bool FontFaceLayer::GenerateTexture(UniquePtr<const byte[]>& texture_data, Vecto
 		TextureLayoutRectangle& rectangle = texture_layout.GetRectangle(i);
 		CodePoint code_point = (CodePoint)rectangle.GetId();
 		RMLUI_ASSERT(characters.find(code_point) != characters.end());
-		
+
 		Character& character = characters[code_point];
 
 		if (character.texture_index != texture_id)
@@ -238,7 +238,7 @@ const Texture* FontFaceLayer::GetTexture(int index)
 // Returns the number of textures employed by this layer.
 int FontFaceLayer::GetNumTextures() const
 {
-	return (int) textures.size();
+	return (int)textures.size();
 }
 
 // Returns the layer's colour.

+ 2 - 2
Source/Core/FontFaceLayer.h

@@ -15,7 +15,7 @@
  *
  * 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
@@ -97,7 +97,7 @@ public:
 			&character_indices[0] + (character_indices.size() - 6),
 			Vector2f(position.x + character.origin.x, position.y + character.origin.y).Round(),
 			character.dimensions,
-			colour, 
+			colour,
 			character.texcoords[0],
 			character.texcoords[1],
 			(int)character_vertices.size() - 4

+ 1 - 1
Source/Core/FontFamily.cpp

@@ -15,7 +15,7 @@
  *
  * 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

+ 3 - 3
Source/Core/FontFamily.h

@@ -15,7 +15,7 @@
  *
  * 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
@@ -45,7 +45,7 @@ class FontFamily
 {
 public:
 	FontFamily(const String& name);
-    virtual ~FontFamily();
+	virtual ~FontFamily();
 
 	/// Adds a new face to the family.
 	/// @param[in] ft_face The previously loaded FreeType face.
@@ -53,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, Style::FontStyle style, Style::FontWeight 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] style The style of the desired handle.

+ 13 - 13
Source/Core/FontProvider.h

@@ -40,30 +40,30 @@ class FontFamily;
 class FontFaceHandleDefault;
 
 /**
-    The font database contains all font families currently in use by RmlUi.
-    @author Peter Curry
+	The font database contains all font families currently in use by RmlUi.
+	@author Peter Curry
  */
 
 class RMLUICORE_API FontProvider
 {
 public:
 
-    /// 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
-    /// valid handle.
-    /// @param[in] family The family of the desired font handle.
-    /// @param[in] style The style of the desired font handle.
-    /// @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.
+	/// 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
+	/// valid handle.
+	/// @param[in] family The family of the desired font handle.
+	/// @param[in] style The style of the desired font handle.
+	/// @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<FontFaceHandleDefault> GetFontFaceHandle(const String& family, Style::FontStyle style, Style::FontWeight weight, int size);
 
 protected:
 
-    typedef UnorderedMap< String, FontFamily*> FontFamilyMap;
-    FontFamilyMap font_families;
+	typedef UnorderedMap< String, FontFamily*> FontFamilyMap;
+	FontFamilyMap font_families;
 
-    static const String debugger_font_family_name;
+	static const String debugger_font_family_name;
 };
 
 }

+ 5 - 5
Source/Core/FreeType/FontFaceHandle.cpp

@@ -103,7 +103,7 @@ static void BuildGlyphMap(FT_Face ft_face, FontGlyphMap& glyphs, int size)
 	// Add a replacement character for rendering unknown characters.
 	CodePoint replacement_character = CodePoint::Replacement;
 	auto it = glyphs.find(replacement_character);
-	if(it == glyphs.end())
+	if (it == glyphs.end())
 	{
 		FontGlyph glyph;
 		glyph.dimensions = { size / 3, (size * 2) / 3 };
@@ -133,7 +133,7 @@ static bool BuildGlyph(FT_Face ft_face, CodePoint code_point, FontGlyphMap& glyp
 	int index = FT_Get_Char_Index(ft_face, (FT_ULong)code_point);
 	if (index == 0)
 		return false;
-	
+
 	FT_Error error = FT_Load_Glyph(ft_face, index, 0);
 	if (error != 0)
 	{
@@ -288,9 +288,9 @@ int FontFaceHandle_FreeType::GetKerning(CodePoint lhs, CodePoint rhs) const
 
 	FT_Error ft_error = FT_Get_Kerning(
 		ft_face,
-		FT_Get_Char_Index(ft_face, (FT_ULong)lhs), 
-		FT_Get_Char_Index(ft_face, (FT_ULong)rhs), 
-		FT_KERNING_DEFAULT, 
+		FT_Get_Char_Index(ft_face, (FT_ULong)lhs),
+		FT_Get_Char_Index(ft_face, (FT_ULong)rhs),
+		FT_KERNING_DEFAULT,
 		&ft_kerning
 	);
 

+ 15 - 15
Source/Core/FreeType/FontProvider.h

@@ -45,26 +45,26 @@ namespace Core {
 class RMLUICORE_API FontProvider_FreeType : public Rml::Core::FontProvider
 {
 public:
-    static bool Initialise();
-    static void Shutdown();
+	static bool Initialise();
+	static void Shutdown();
 
-    /// Adds a new font face to the database. The face's family, style and weight will be determined from the face itself.
-    /// @param[in] file_name The file to load the face from.
-    /// @return True if the face was loaded successfully, false otherwise.
-    static bool LoadFontFace(const String& file_name);
+	/// Adds a new font face to the database. The face's family, style and weight will be determined from the face itself.
+	/// @param[in] file_name The file to load the face from.
+	/// @return True if the face was loaded successfully, false otherwise.
+	static bool LoadFontFace(const String& file_name);
 
 private:
-    FontProvider_FreeType(void);
-    ~FontProvider_FreeType(void);
+	FontProvider_FreeType(void);
+	~FontProvider_FreeType(void);
 
-    // Adds a loaded face to the appropriate font family.
-    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.
-    void* LoadFace(const byte* data, int data_length, const String& source, bool local_data);
+	// Adds a loaded face to the appropriate font family.
+	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.
+	void* LoadFace(const byte* data, int data_length, const String& source, bool local_data);
 
-    static FontProvider_FreeType* instance;
+	static FontProvider_FreeType* instance;
 };
 
 }