That Terminal
A terminal emulator designed for video making purposes.
font_planner.hh
Go to the documentation of this file.
1 #ifndef bqtFontPlannerHH
2 #define bqtFontPlannerHH
7 #include <atomic>
8 #include <memory>
9 #include <vector>
10 #include <mutex>
11 #include <unordered_set>
12 #include <condition_variable>
13 #include "read_font.hh"
14 
16 class FontPlan
17 {
18 public:
32  void Create(unsigned width, unsigned height, char32_t firstch, char32_t numch);
33 
35  struct Glyph
36  {
37  unsigned long bitmap;
38  bool bold;
39  };
40 
50  Glyph LoadGlyph(char32_t ch, unsigned scanline, unsigned render_width) const;
51 
52 private:
53  std::vector<bool> bold_list;
54  std::vector<const unsigned char*> bitmap_pointers;
55  std::vector<unsigned char> resized_bitmaps;
56  std::vector<std::shared_ptr<GlyphList>> loaded_fonts;
57  std::unordered_set<std::string> font_filenames;
58 
60  std::tuple<unsigned,unsigned,char32_t,char32_t> prev {};
61 
63  std::atomic<bool> ready { true };
64  mutable std::condition_variable ready_notification { };
65  mutable std::mutex working;
66 };
67 
71 void FontPlannerTick();
72 
73 #endif
Definition: font_planner.hh:17
void Create(unsigned width, unsigned height, char32_t firstch, char32_t numch)
Definition: font_planner.cc:180
bool bold
True if the font is "bold" style.
Definition: font_planner.hh:38
Glyph LoadGlyph(char32_t ch, unsigned scanline, unsigned render_width) const
Definition: font_planner.cc:413
unsigned long bitmap
bitmap: maximum 64 pixels.
Definition: font_planner.hh:37
Definition: font_planner.hh:36
void FontPlannerTick()
Definition: font_planner.cc:440
Contains low-level functions for parsing font files. Used by ReadFontsList and FontPlan.