LASi: contextMgr.h Source File

LASi

contextMgr.h
Go to the documentation of this file.
1
8 #ifndef CONTEXT_MGR_H
9 #define CONTEXT_MGR_H
10
11 #include <pango/pango.h>
12 #include <pango/pangoft2.h>
13 #include "manager.h"
14
17 class ContextMgr : public Manager<PangoContext*> {
18 public:
19 ContextMgr(
20 const char* const lang="en_US.UTF-8",
21 const int dpiX = 72,
22 const int dpiY = 72) {
23 _t = pango_ft2_get_context(dpiX, dpiY);
24 pango_context_set_language(_t, pango_language_from_string(lang));
25 pango_context_set_base_dir(_t, PANGO_DIRECTION_LTR);
26 }
27
28 ~ContextMgr() {
29 if (_t && isOwner())
30 g_object_unref(_t);
31 }
32 };
33 #endif
Manager< PangoContext *>::_t
PangoContext * _t
Definition: manager.h:26
Manager
Manager template.
Definition: manager.h:24
manager.h
Convert return-code of Freetype library calls to std::runtime_error.
ContextMgr
Manage PangoContext*.
Definition: contextMgr.h:17
ContextMgr::~ContextMgr
~ContextMgr()
Definition: contextMgr.h:28
Manager< PangoContext *>::isOwner
bool isOwner() const
Definition: manager.h:34
ContextMgr::ContextMgr
ContextMgr(const char *const lang="en_US.UTF-8", const int dpiX=72, const int dpiY=72)
Definition: contextMgr.h:19