srctree

Robin Linden parent f8277665 7c9bcb33
type/sfml: Allow manually adding fonts to the font cache

This will allow us to save fallback fonts and handle things like thebrowser-specific serif, sans-serif, monospace, etc font families.

inlinesplit
type/sfml.h added: 6, removed: 2, total 4
@@ -33,8 +33,12 @@ class SfmlType : public IType {
public:
std::optional<std::shared_ptr<IFont const>> font(std::string_view name) const override;
 
void set_font(std::string name, std::shared_ptr<SfmlFont const> font) {
font_cache_.insert_or_assign(std::move(name), std::move(font));
}
 
private:
mutable std::map<std::string, std::shared_ptr<SfmlFont>, std::less<>> font_cache_;
mutable std::map<std::string, std::shared_ptr<SfmlFont const>, std::less<>> font_cache_;
};
 
} // namespace type