<commit_before>#include "ui_stylesheet.h"
#include "halley/file_formats/config_file.h"
#include "halley/audio/audio_clip.h"
#include "halley/core/graphics/text/font.h"
#include "halley/core/resources/resources.h"
#include "halley/support/logger.h"
#include "halley/maths/vector4.h"
using namespace Halley;

template <typename T>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, T& data) {}

template <>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, Sprite& data)
{
	if (node.getType() == ConfigNodeType::String) {
		if (!node.asString().isEmpty()) {
			data = Sprite().setImage(resources, node.asString());
		}
	} else {
		data = Sprite()
			.setImage(resources, node["img"].asString())
			.setColour(Colour4f::fromString(node["colour"].asString("#FFFFFF")));
	}
}

template <>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, TextRenderer& data)
{
	data = TextRenderer()
		.setFont(resources.get<Font>(node["font"].asString()))
		.setSize(node["size"].asFloat())
		.setColour(Colour4f::fromString(node["colour"].asString()))
		.setOutline(node["outline"].asFloat(0.0f))
		.setOutlineColour(Colour4f::fromString(node["outlineColour"].asString("#000000")))		
		.setAlignment(node["alignment"].asFloat(0.0f));
}

template <>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, String& data)
{
	if (node.asString().isEmpty()) {
		data = "";
	} else {<commit_msg>Read font smoothness from style sheets<commit_after>#include "ui_stylesheet.h"
#include "halley/file_formats/config_file.h"
#include "halley/audio/audio_clip.h"
#include "halley/core/graphics/text/font.h"
#include "halley/core/resources/resources.h"
#include "halley/support/logger.h"
#include "halley/maths/vector4.h"
using namespace Halley;

template <typename T>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, T& data) {}

template <>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, Sprite& data)
{
	if (node.getType() == ConfigNodeType::String) {
		if (!node.asString().isEmpty()) {
			data = Sprite().setImage(resources, node.asString());
		}
	} else {
		data = Sprite()
			.setImage(resources, node["img"].asString())
			.setColour(Colour4f::fromString(node["colour"].asString("#FFFFFF")));
	}
}

template <>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, TextRenderer& data)
{
	data = TextRenderer()
		.setFont(resources.get<Font>(node["font"].asString()))
		.setSize(node["size"].asFloat())
		.setColour(Colour4f::fromString(node["colour"].asString()))
		.setOutline(node["outline"].asFloat(0.0f))
		.setOutlineColour(Colour4f::fromString(node["outlineColour"].asString("#000000")))		
		.setAlignment(node["alignment"].asFloat(0.0f))
		.setSmoothness(node["smoothness"].asFloat(1.0));
}

template <>
void loadStyleData(Resources& resources, const String& name, const ConfigNode& node, String& data)
{
	if (node.asString().isEmpty()) {
		data = "";
	} else {
{'fraction_non_alphanumeric': 0.1736449204803635, 'fraction_numerical': 0.009737098344693282, 'mean_word_length': 6.303317535545023, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3090772', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1036, 'n_words': 192}