cgv
Loading...
Searching...
No Matches
font.cxx
1#include <cgv/media/font/font.h>
2#include <cgv/media/font/font_server.h>
3
4namespace cgv {
5 namespace media {
6 namespace font {
7
9font_face::font_face(int _ffa) : ffa(_ffa)
10{
11}
13std::string font_face::get_type_name() const
14{
15 return "font_face";
16}
17
20{
21 return ffa;
22}
23
24
26std::string font::get_type_name() const
27{
28 return "font";
29}
30
32font_ptr find_font(const std::string& font_name)
33{
34 if (get_font_server())
35 return get_font_server()->find_font(font_name);
36 return font_ptr();
37}
38
40font_ptr find_font_by_prefix(const std::string& font_name_prefix)
41{
42 if(get_font_server())
43 return get_font_server()->find_font_by_prefix(font_name_prefix);
44 return font_ptr();
45}
46
48font_ptr find_font_or_default(const std::string& font_name, bool default_font_mono_space)
49{
50 const auto font = find_font(font_name);
51 if (font)
52 return font;
53 return default_font(default_font_mono_space);
54}
55
57font_ptr default_font(bool mono_space)
58{
59 if (get_font_server())
60 return get_font_server()->default_font(mono_space);
61 return font_ptr();
62}
63
65void enumerate_font_names(std::vector<const char*>& font_names)
66{
67 if (get_font_server())
68 return get_font_server()->enumerate_font_names(font_names);
69}
70
71 }
72 }
73}
int ffa
store the actual attributes of the font face
Definition font.h:33
font_face(int _ffa)
construct from attributes that are declared in the enum FontFaceAttributes
Definition font.cxx:9
virtual int get_attributes() const
return the attributes
Definition font.cxx:19
std::string get_type_name() const
returns "font_face"
Definition font.cxx:13
interface class for fonts. Construct font with the find_font function
Definition font.h:56
std::string get_type_name() const
returns "font"
Definition font.cxx:26
font_ptr find_font(const std::string &font_name)
find an installed font by name
Definition font.cxx:32
font_server_ptr get_font_server()
return the currently installed font server or 0 if no font server available
font_ptr find_font_by_prefix(const std::string &font_name_prefix)
find an installed font by name prefix
Definition font.cxx:40
font_ptr default_font(bool mono_space)
return platform dependend default font
Definition font.cxx:57
font_ptr find_font_or_default(const std::string &font_name, bool default_font_mono_space)
find an installed font by name
Definition font.cxx:48
data::ref_ptr< font > font_ptr
always use this ref counted pointer to store fonts
Definition font.h:71
void enumerate_font_names(std::vector< const char * > &font_names)
enumerate the names of all installed fonts
Definition font.cxx:65
the cgv namespace
Definition print.h:11