File: font_renderer.hpp

package info (click to toggle)
python-visual 1%3A5.12-1.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,672 kB
  • ctags: 7,636
  • sloc: cpp: 15,593; sh: 9,615; ansic: 6,631; python: 4,737; makefile: 385
file content (35 lines) | stat: -rw-r--r-- 880 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef VPYTHON_GTK2_FONT_RENDERER_HPP
#define VPYTHON_GTK2_FONT_RENDERER_HPP

// See text.hpp for public interface

#include "text.hpp"
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <pangomm.h>
#include <pango/pangoft2.h>

namespace cvisual {

class font_renderer {
 public:
	// Create a font_renderer for the requested font.  
	// Must support 'verdana' or 'sans-serif'
	// Should support 'times new roman' or 'serif', and 'courier new' or 'monospace'
	font_renderer( const std::wstring& description, int height );
	
	// Returns true if the requested font was available.
	bool ok();
	
	// Render text and call tx.set_image()
	void gl_render_to_texture( const struct view&, const std::wstring& text, layout_texture& tx );

 private:
	Glib::RefPtr<Pango::Context> ft2_context;
};

extern Glib::ustring w2u( const std::wstring& );

} // namespace cvisual

#endif