From de2b986787be7d24660f7673180aba61ffafbf2b Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sun, 1 Jan 2023 15:07:37 -0400 Subject: [PATCH] Code style fixes --- src/modules/font/GenericShaper.cpp | 2 +- src/modules/font/GenericShaper.h | 2 +- src/modules/font/TextShaper.cpp | 8 ++++---- src/modules/font/TextShaper.h | 12 ++++++------ src/modules/font/freetype/HarfbuzzShaper.cpp | 14 +++++++------- src/modules/font/freetype/HarfbuzzShaper.h | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/modules/font/GenericShaper.cpp b/src/modules/font/GenericShaper.cpp index 1d8962b3f..ef5854602 100644 --- a/src/modules/font/GenericShaper.cpp +++ b/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()); diff --git a/src/modules/font/GenericShaper.h b/src/modules/font/GenericShaper.h index a9f4d6526..c77b5b309 100644 --- a/src/modules/font/GenericShaper.h +++ b/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 *positions, std::vector *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: diff --git a/src/modules/font/TextShaper.cpp b/src/modules/font/TextShaper.cpp index 404e06ff5..43854e719 100644 --- a/src/modules/font/TextShaper.cpp +++ b/src/modules/font/TextShaper.cpp @@ -135,7 +135,7 @@ float TextShaper::getBaseline() const bool TextShaper::hasGlyph(uint32 glyph) const { - for (const StrongRef& r : rasterizers) + for (const StrongRef &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 &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); } } diff --git a/src/modules/font/TextShaper.h b/src/modules/font/TextShaper.h index b7609cebd..b5417514c 100644 --- a/src/modules/font/TextShaper.h +++ b/src/modules/font/TextShaper.h @@ -56,8 +56,8 @@ struct ColoredCodepoints std::vector colors; }; -void getCodepointsFromString(const std::string& str, std::vector& codepoints); -void getCodepointsFromString(const std::vector& strs, ColoredCodepoints& codepoints); +void getCodepointsFromString(const std::string &str, std::vector &codepoints); +void getCodepointsFromString(const std::vector &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& text, float wraplimit, std::vector& lines, std::vector* linewidths = nullptr); - void getWrap(const ColoredCodepoints& codepoints, float wraplimit, std::vector &lineranges, std::vector *linewidths = nullptr); + void getWrap(const std::vector &text, float wraplimit, std::vector &lines, std::vector *linewidths = nullptr); + void getWrap(const ColoredCodepoints &codepoints, float wraplimit, std::vector &lineranges, std::vector *linewidths = nullptr); virtual void setFallbacks(const std::vector &fallbacks); virtual void computeGlyphPositions(const ColoredCodepoints &codepoints, Range range, Vector2 offset, float extraspacing, std::vector *positions, std::vector *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: diff --git a/src/modules/font/freetype/HarfbuzzShaper.cpp b/src/modules/font/freetype/HarfbuzzShaper.cpp index bd25dc040..d2ab9a729 100644 --- a/src/modules/font/freetype/HarfbuzzShaper.cpp +++ b/src/modules/font/freetype/HarfbuzzShaper.cpp @@ -102,7 +102,7 @@ void HarfbuzzShaper::updateSpacesForTabInfo() } } -bool HarfbuzzShaper::isValidGlyph(uint32 glyphindex, const std::vector& codepoints, uint32 codepointindex) +bool HarfbuzzShaper::isValidGlyph(uint32 glyphindex, const std::vector &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++) diff --git a/src/modules/font/freetype/HarfbuzzShaper.h b/src/modules/font/freetype/HarfbuzzShaper.h index 19ed2ec79..3a71a5b8b 100644 --- a/src/modules/font/freetype/HarfbuzzShaper.h +++ b/src/modules/font/freetype/HarfbuzzShaper.h @@ -45,9 +45,9 @@ public: HarfbuzzShaper(TrueTypeRasterizer *rasterizer); virtual ~HarfbuzzShaper(); - void setFallbacks(const std::vector& fallbacks) override; + void setFallbacks(const std::vector &fallbacks) override; void computeGlyphPositions(const ColoredCodepoints &codepoints, Range range, Vector2 offset, float extraspacing, std::vector *positions, std::vector *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& codepoints, uint32 codepointindex); - void computeBufferRanges(const ColoredCodepoints& codepoints, Range range, std::vector &bufferranges); + bool isValidGlyph(uint32 glyphindex, const std::vector &codepoints, uint32 codepointindex); + void computeBufferRanges(const ColoredCodepoints &codepoints, Range range, std::vector &bufferranges); std::vector hbFonts; std::vector hbBuffers;