Browse Source

Code style fixes

Sasha Szpakowski 2 years ago
parent
commit
de2b986787

+ 1 - 1
src/modules/font/GenericShaper.cpp

@@ -141,7 +141,7 @@ void GenericShaper::computeGlyphPositions(const ColoredCodepoints &codepoints, R
 	}
 }
 
-int GenericShaper::computeWordWrapIndex(const ColoredCodepoints& codepoints, Range range, float wraplimit, float *width)
+int GenericShaper::computeWordWrapIndex(const ColoredCodepoints &codepoints, Range range, float wraplimit, float *width)
 {
 	if (!range.isValid())
 		range = Range(0, codepoints.cps.size());

+ 1 - 1
src/modules/font/GenericShaper.h

@@ -36,7 +36,7 @@ public:
 	virtual ~GenericShaper();
 
 	void computeGlyphPositions(const ColoredCodepoints &codepoints, Range range, Vector2 offset, float extraspacing, std::vector<GlyphPosition> *positions, std::vector<IndexedColor> *colors, TextInfo *info) override;
-	int computeWordWrapIndex(const ColoredCodepoints& codepoints, Range range, float wraplimit, float *width) override;
+	int computeWordWrapIndex(const ColoredCodepoints &codepoints, Range range, float wraplimit, float *width) override;
 
 private:
 

+ 4 - 4
src/modules/font/TextShaper.cpp

@@ -135,7 +135,7 @@ float TextShaper::getBaseline() const
 
 bool TextShaper::hasGlyph(uint32 glyph) const
 {
-	for (const StrongRef<Rasterizer>& r : rasterizers)
+	for (const StrongRef<Rasterizer> &r : rasterizers)
 	{
 		if (r->hasGlyph(glyph))
 			return true;
@@ -162,7 +162,7 @@ bool TextShaper::hasGlyphs(const std::string &text) const
 				return false;
 		}
 	}
-	catch (utf8::exception& e)
+	catch (utf8::exception &e)
 	{
 		throw love::Exception("UTF-8 decoding error: %s", e.what());
 	}
@@ -208,7 +208,7 @@ float TextShaper::getKerning(const std::string &leftchar, const std::string &rig
 		left = utf8::peek_next(leftchar.begin(), leftchar.end());
 		right = utf8::peek_next(rightchar.begin(), rightchar.end());
 	}
-	catch (utf8::exception& e)
+	catch (utf8::exception &e)
 	{
 		throw love::Exception("UTF-8 decoding error: %s", e.what());
 	}
@@ -346,7 +346,7 @@ void TextShaper::getWrap(const std::vector<ColoredString> &text, float wraplimit
 			for (size_t i = range.getMin(); i <= range.getMax(); i++)
 			{
 				char character[5] = { '\0' };
-				char* end = utf8::unchecked::append(cps.cps[i], character);
+				char *end = utf8::unchecked::append(cps.cps[i], character);
 				line.append(character, end - character);
 			}
 		}

+ 6 - 6
src/modules/font/TextShaper.h

@@ -56,8 +56,8 @@ struct ColoredCodepoints
 	std::vector<IndexedColor> colors;
 };
 
-void getCodepointsFromString(const std::string& str, std::vector<uint32>& codepoints);
-void getCodepointsFromString(const std::vector<ColoredString>& strs, ColoredCodepoints& codepoints);
+void getCodepointsFromString(const std::string &str, std::vector<uint32> &codepoints);
+void getCodepointsFromString(const std::vector<ColoredString> &strs, ColoredCodepoints &codepoints);
 
 class TextShaper : public Object
 {
@@ -114,19 +114,19 @@ public:
 	bool hasGlyphs(const std::string &text) const;
 
 	float getKerning(uint32 leftglyph, uint32 rightglyph);
-	float getKerning(const std::string& leftchar, const std::string& rightchar);
+	float getKerning(const std::string &leftchar, const std::string &rightchar);
 
 	int getGlyphAdvance(uint32 glyph, GlyphIndex *glyphindex = nullptr);
 
 	int getWidth(const std::string &str);
 
-	void getWrap(const std::vector<ColoredString>& text, float wraplimit, std::vector<std::string>& lines, std::vector<int>* linewidths = nullptr);
-	void getWrap(const ColoredCodepoints& codepoints, float wraplimit, std::vector<Range> &lineranges, std::vector<int> *linewidths = nullptr);
+	void getWrap(const std::vector<ColoredString> &text, float wraplimit, std::vector<std::string> &lines, std::vector<int> *linewidths = nullptr);
+	void getWrap(const ColoredCodepoints &codepoints, float wraplimit, std::vector<Range> &lineranges, std::vector<int> *linewidths = nullptr);
 
 	virtual void setFallbacks(const std::vector<Rasterizer *> &fallbacks);
 
 	virtual void computeGlyphPositions(const ColoredCodepoints &codepoints, Range range, Vector2 offset, float extraspacing, std::vector<GlyphPosition> *positions, std::vector<IndexedColor> *colors, TextInfo *info) = 0;
-	virtual int computeWordWrapIndex(const ColoredCodepoints& codepoints, Range range, float wraplimit, float *width) = 0;
+	virtual int computeWordWrapIndex(const ColoredCodepoints &codepoints, Range range, float wraplimit, float *width) = 0;
 
 protected:
 

+ 7 - 7
src/modules/font/freetype/HarfbuzzShaper.cpp

@@ -102,7 +102,7 @@ void HarfbuzzShaper::updateSpacesForTabInfo()
 	}
 }
 
-bool HarfbuzzShaper::isValidGlyph(uint32 glyphindex, const std::vector<uint32>& codepoints, uint32 codepointindex)
+bool HarfbuzzShaper::isValidGlyph(uint32 glyphindex, const std::vector<uint32> &codepoints, uint32 codepointindex)
 {
 	if (glyphindex != 0)
 		return true;
@@ -140,7 +140,7 @@ void HarfbuzzShaper::computeBufferRanges(const ColoredCodepoints &codepoints, Ra
 	// Harfbuzz doesn't have its own fallback API.
 	for (size_t rasti = 0; rasti < rasterizers.size(); rasti++)
 	{
-		hb_buffer_t* hbb = hbBuffers[rasti];
+		hb_buffer_t *hbb = hbBuffers[rasti];
 		hb_buffer_reset(hbb);
 
 		for (Range r : fallbackranges)
@@ -229,8 +229,8 @@ void HarfbuzzShaper::computeGlyphPositions(const ColoredCodepoints &codepoints,
 
 		hb_buffer_t *hbbuffer = hbBuffers[bufferrange.index];
 
-		const hb_glyph_info_t* glyphinfos = hb_buffer_get_glyph_infos(hbbuffer, nullptr);
-		hb_glyph_position_t* glyphpositions = hb_buffer_get_glyph_positions(hbbuffer, nullptr);
+		const hb_glyph_info_t *glyphinfos = hb_buffer_get_glyph_infos(hbbuffer, nullptr);
+		hb_glyph_position_t *glyphpositions = hb_buffer_get_glyph_positions(hbbuffer, nullptr);
 		hb_direction_t direction = hb_buffer_get_direction(hbbuffer);
 
 		for (size_t i = bufferrange.range.first; i <= bufferrange.range.last; i++)
@@ -339,10 +339,10 @@ int HarfbuzzShaper::computeWordWrapIndex(const ColoredCodepoints &codepoints, Ra
 
 	for (const auto &bufferrange : bufferranges)
 	{
-		hb_buffer_t* hbbuffer = hbBuffers[bufferrange.index];
+		hb_buffer_t *hbbuffer = hbBuffers[bufferrange.index];
 
-		const hb_glyph_info_t* glyphinfos = hb_buffer_get_glyph_infos(hbbuffer, nullptr);
-		hb_glyph_position_t* glyphpositions = hb_buffer_get_glyph_positions(hbbuffer, nullptr);
+		const hb_glyph_info_t *glyphinfos = hb_buffer_get_glyph_infos(hbbuffer, nullptr);
+		hb_glyph_position_t *glyphpositions = hb_buffer_get_glyph_positions(hbbuffer, nullptr);
 		hb_direction_t direction = hb_buffer_get_direction(hbbuffer);
 
 		for (size_t i = bufferrange.range.first; i <= bufferrange.range.last; i++)

+ 4 - 4
src/modules/font/freetype/HarfbuzzShaper.h

@@ -45,9 +45,9 @@ public:
 	HarfbuzzShaper(TrueTypeRasterizer *rasterizer);
 	virtual ~HarfbuzzShaper();
 
-	void setFallbacks(const std::vector<Rasterizer*>& fallbacks) override;
+	void setFallbacks(const std::vector<Rasterizer *> &fallbacks) override;
 	void computeGlyphPositions(const ColoredCodepoints &codepoints, Range range, Vector2 offset, float extraspacing, std::vector<GlyphPosition> *positions, std::vector<IndexedColor> *colors, TextInfo *info) override;
-	int computeWordWrapIndex(const ColoredCodepoints& codepoints, Range range, float wraplimit, float *width) override;
+	int computeWordWrapIndex(const ColoredCodepoints &codepoints, Range range, float wraplimit, float *width) override;
 
 private:
 
@@ -59,8 +59,8 @@ private:
 	};
 
 	void updateSpacesForTabInfo();
-	bool isValidGlyph(uint32 glyphindex, const std::vector<uint32>& codepoints, uint32 codepointindex);
-	void computeBufferRanges(const ColoredCodepoints& codepoints, Range range, std::vector<BufferRange> &bufferranges);
+	bool isValidGlyph(uint32 glyphindex, const std::vector<uint32> &codepoints, uint32 codepointindex);
+	void computeBufferRanges(const ColoredCodepoints &codepoints, Range range, std::vector<BufferRange> &bufferranges);
 
 	std::vector<hb_font_t *> hbFonts;
 	std::vector<hb_buffer_t *> hbBuffers;