#pragma once

#include <psemek/math/vector.hpp>
#include <psemek/util/hash_table.hpp>
#include <psemek/io/stream.hpp>

#include <string>

namespace psemek::fonts
{

	struct bmfont_data
	{
		struct glyph_data
		{
			float start_x;
			float start_y;
			float size_x;
			float size_y;
			float offset_x;
			float offset_y;
			float advance;
		};

		std::string name;
		math::vector<int, 2> size;
		int baseline;
		util::hash_map<char32_t, glyph_data> glyphs;
		float sdf_scale = 0.f;

		// Parse JSON font info generated by BMFont or msdf-bmfont
		static bmfont_data parse(io::istream && stream);
	};

}
