Formatting
This commit is contained in:
parent
d74a4fab77
commit
6e716296ff
@ -212,13 +212,18 @@ namespace cairo {
|
|||||||
cairo_glyph_t* glyphs{nullptr};
|
cairo_glyph_t* glyphs{nullptr};
|
||||||
cairo_text_cluster_t* clusters{nullptr};
|
cairo_text_cluster_t* clusters{nullptr};
|
||||||
cairo_text_cluster_flags_t cf{};
|
cairo_text_cluster_flags_t cf{};
|
||||||
int nglyphs = 0, nclusters = 0;
|
int nglyphs = 0;
|
||||||
|
int nclusters = 0;
|
||||||
|
|
||||||
string utf8 = string(text);
|
string utf8 = string(text);
|
||||||
auto status = cairo_scaled_font_text_to_glyphs(
|
auto status = cairo_scaled_font_text_to_glyphs(
|
||||||
m_scaled, x, y, utf8.c_str(), utf8.size(), &glyphs, &nglyphs, &clusters, &nclusters, &cf);
|
m_scaled, x, y, utf8.c_str(), utf8.size(), &glyphs, &nglyphs, &clusters, &nclusters, &cf);
|
||||||
|
|
||||||
if (status != CAIRO_STATUS_SUCCESS) {
|
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));
|
throw application_error(sstream() << "cairo_scaled_font_text_to_glyphs() " << cairo_status_to_string(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cairo/cairo-ft.h>
|
#include <cairo/cairo-ft.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
@ -64,7 +65,7 @@ namespace cairo {
|
|||||||
* @brief Convert a UCS-4 codepoint to a utf-8 encoded string
|
* @brief Convert a UCS-4 codepoint to a utf-8 encoded string
|
||||||
*/
|
*/
|
||||||
size_t ucs4_to_utf8(char* utf8, unsigned int ucs);
|
size_t ucs4_to_utf8(char* utf8, unsigned int ucs);
|
||||||
}
|
} // namespace utils
|
||||||
}
|
} // namespace cairo
|
||||||
|
|
||||||
POLYBAR_NS_END
|
POLYBAR_NS_END
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <map>
|
|
||||||
|
|
||||||
#include "cairo/utils.hpp"
|
#include "cairo/utils.hpp"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
namespace cairo {
|
namespace cairo {
|
||||||
@ -170,7 +170,7 @@ namespace cairo {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace utils
|
||||||
}
|
} // namespace cairo
|
||||||
|
|
||||||
POLYBAR_NS_END
|
POLYBAR_NS_END
|
||||||
|
@ -78,8 +78,7 @@ namespace string_util {
|
|||||||
/**
|
/**
|
||||||
* Replace all occurrences of needle in haystack
|
* Replace all occurrences of needle in haystack
|
||||||
*/
|
*/
|
||||||
string replace_all(
|
string replace_all(const string& haystack, const string& needle, const string& replacement, size_t start, size_t end) {
|
||||||
const string& haystack, const string& needle, const string& replacement, size_t start, size_t end) {
|
|
||||||
string result{haystack};
|
string result{haystack};
|
||||||
string::size_type pos;
|
string::size_type pos;
|
||||||
while ((pos = result.find(needle, start)) != string::npos && pos < result.length() &&
|
while ((pos = result.find(needle, start)) != string::npos && pos < result.length() &&
|
||||||
|
Loading…
Reference in New Issue
Block a user