#ifndef _library__framebuffer_font2__hpp__included__ #define _library__framebuffer_font2__hpp__included__ #include #include #include #include #include #include #include "framebuffer.hpp" namespace framebuffer { struct font2 { public: struct glyph { glyph(); glyph(std::istream& s); unsigned width; unsigned height; unsigned stride; std::vector fglyph; //Bitpacked, element breaks between rows. void render(fb& fb, int32_t x, int32_t y, color fg, color bg, color hl) const; void render(fb& fb, int32_t x, int32_t y, color fg, color bg, color hl) const; }; font2(); font2(const std::string& file); font2(struct font& bfont); void add(const std::u32string& key, const glyph& fglyph) throw(std::bad_alloc); std::u32string best_ligature_match(const std::u32string& codepoints, size_t start) const throw(std::bad_alloc); const glyph& lookup_glyph(const std::u32string& key) const throw(); unsigned get_rowadvance() const throw() { return rowadvance; } private: std::map glyphs; unsigned rowadvance; }; } #endif