Fix some compilation errors on Mac OS X
[lsnes.git] / include / library / framebuffer-font2.hpp
blobb08e6d011672c07dcb364d6a2e5fb306db879ce0
1 #ifndef _library__framebuffer_font2__hpp__included__
2 #define _library__framebuffer_font2__hpp__included__
4 #include <vector>
5 #include <cstdint>
6 #include <cstdlib>
7 #include <iostream>
8 #include <stdexcept>
9 #include <map>
10 #include "framebuffer.hpp"
12 namespace framebuffer
14 struct font2
16 public:
17 struct glyph
19 glyph();
20 glyph(std::istream& s);
21 unsigned width;
22 unsigned height;
23 unsigned stride;
24 std::vector<uint32_t> fglyph; //Bitpacked, element breaks between rows.
25 void render(fb<false>& fb, int32_t x, int32_t y, color fg, color bg, color hl) const;
26 void render(fb<true>& fb, int32_t x, int32_t y, color fg, color bg, color hl) const;
28 font2();
29 font2(const std::string& file);
30 font2(struct font& bfont);
31 void add(const std::u32string& key, const glyph& fglyph) throw(std::bad_alloc);
32 std::u32string best_ligature_match(const std::u32string& codepoints, size_t start) const
33 throw(std::bad_alloc);
34 const glyph& lookup_glyph(const std::u32string& key) const throw();
35 unsigned get_rowadvance() const throw() { return rowadvance; }
36 private:
37 std::map<std::u32string, glyph> glyphs;
38 unsigned rowadvance;
41 #endif