fix(renderer): Cleanup
This commit is contained in:
parent
73aa721f90
commit
07cb5f134e
@ -140,7 +140,7 @@ renderer::renderer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.info("Using DPI = %gx%g", dpi_x, dpi_y);
|
m_log.info("Configured DPI = %gx%g", dpi_x, dpi_y);
|
||||||
|
|
||||||
auto fonts = m_conf.get_list<string>(m_conf.section(), "font", {});
|
auto fonts = m_conf.get_list<string>(m_conf.section(), "font", {});
|
||||||
if (fonts.empty()) {
|
if (fonts.empty()) {
|
||||||
@ -148,18 +148,17 @@ renderer::renderer(
|
|||||||
fonts.emplace_back("fixed");
|
fonts.emplace_back("fixed");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto fonts_loaded = false;
|
|
||||||
for (const auto& f : fonts) {
|
for (const auto& f : fonts) {
|
||||||
vector<string> fd{string_util::split(f, ';')};
|
int offset{0};
|
||||||
auto font =
|
string pattern{f};
|
||||||
cairo::make_font(*m_context, string(fd[0]), fd.size() > 1 ? std::atoi(fd[1].c_str()) : 0, dpi_x, dpi_y);
|
size_t pos = pattern.rfind(';');
|
||||||
m_log.info("Loaded font \"%s\" (name=%s, file=%s)", fd[0], font->name(), font->file());
|
if (pos != string::npos) {
|
||||||
|
offset = std::atoi(pattern.substr(pos + 1).c_str());
|
||||||
|
pattern.erase(pos);
|
||||||
|
}
|
||||||
|
auto font = cairo::make_font(*m_context, string{pattern}, offset, dpi_x, dpi_y);
|
||||||
|
m_log.info("Loaded font \"%s\" (name=%s, offset=%i, file=%s)", pattern, font->name(), offset, font->file());
|
||||||
*m_context << move(font);
|
*m_context << move(font);
|
||||||
fonts_loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fonts_loaded) {
|
|
||||||
throw application_error("Unable to load fonts");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user