Formatting

This commit is contained in:
patrick96 2023-05-10 12:30:32 +02:00 committed by Patrick Ziegler
parent d74a4fab77
commit 6e716296ff
5 changed files with 840 additions and 835 deletions

View File

@ -212,13 +212,18 @@ namespace cairo {
cairo_glyph_t* glyphs{nullptr};
cairo_text_cluster_t* clusters{nullptr};
cairo_text_cluster_flags_t cf{};
int nglyphs = 0, nclusters = 0;
int nglyphs = 0;
int nclusters = 0;
string utf8 = string(text);
auto status = cairo_scaled_font_text_to_glyphs(
m_scaled, x, y, utf8.c_str(), utf8.size(), &glyphs, &nglyphs, &clusters, &nclusters, &cf);
if (status != CAIRO_STATUS_SUCCESS) {
logger::make().notice("ERROR %d", status);
for (char& c : utf8) {
logger::make().notice("0x%02x", c);
}
throw application_error(sstream() << "cairo_scaled_font_text_to_glyphs() " << cairo_status_to_string(status));
}

View File

@ -1,6 +1,7 @@
#pragma once
#include <cairo/cairo-ft.h>
#include <list>
#include "common.hpp"
@ -64,7 +65,7 @@ namespace cairo {
* @brief Convert a UCS-4 codepoint to a utf-8 encoded string
*/
size_t ucs4_to_utf8(char* utf8, unsigned int ucs);
}
}
} // namespace utils
} // namespace cairo
POLYBAR_NS_END

View File

@ -1,7 +1,7 @@
#include <map>
#include "cairo/utils.hpp"
#include <map>
POLYBAR_NS
namespace cairo {
@ -170,7 +170,7 @@ namespace cairo {
return 0;
}
}
}
}
} // namespace utils
} // namespace cairo
POLYBAR_NS_END

View File

@ -78,8 +78,7 @@ namespace string_util {
/**
* Replace all occurrences of needle in haystack
*/
string replace_all(
const string& haystack, const string& needle, const string& replacement, size_t start, size_t end) {
string replace_all(const string& haystack, const string& needle, const string& replacement, size_t start, size_t end) {
string result{haystack};
string::size_type pos;
while ((pos = result.find(needle, start)) != string::npos && pos < result.length() &&