libart-paperback 0.1.0-a.1.20260122225059.e5fea306241a
PDF (1.4) library for C++
font.hxx
1#ifndef art__paperback__graphics__font_hxx_
2#define art__paperback__graphics__font_hxx_
3
4#include <art/paperback/types.hxx>
5#include <art/paperback/forward.hxx>
6
8{
9
10 /// Represents text width computations.
11 ///
13 {
14 /// Character count.
15 ///
16 uint32_t character_count{};
17
18 /// Space count.
19 ///
20 uint32_t space_count{};
21
22 /// Text width.
23 ///
24 double width{};
25
26 };
27
28 /// Base class for fonts.
29 ///
30 class Font
31 {
32 public:
33 /// Destructor.
34 ///
35 virtual
36 ~Font() noexcept
37 {}
38
39 /// Access the parent document of this font.
40 ///
41 virtual
43 document() = 0;
44
45 /// Get the COS object for this font.
46 ///
47 virtual
49 object() = 0;
50
51 /// Get the name of the font.
52 ///
53 /// \return Returns the name of the font.
54 ///
55 virtual
56 string
57 name() const = 0;
58
59 /// Get the font ascent.
60 ///
61 /// \return Returns the font ascent.
62 ///
63 virtual
64 int16_t
65 get_ascent() const = 0;
66
67 /// Get the font descent.
68 ///
69 virtual
70 int16_t
71 get_descent() const = 0;
72
73 /// Get the font X-height.
74 ///
75 virtual
76 uint16_t
77 get_xheight() const = 0;
78
79 /// Get the font cap-height.
80 ///
81 virtual
82 uint16_t
83 get_capheight() const = 0;
84
85 /// Compute text width.
86 ///
87 virtual
89 get_text_width(string const&) = 0;
90
91 protected:
92 /// Constructor.
93 ///
95 {}
96
97 private:
98 Font(Font const&) = delete;
99 Font(Font&&) = delete;
100 Font& operator=(Font const&) = delete;
101 Font& operator=(Font&&) = delete;
102
103 };
104
105} // namespace Art::Paperback::Graphics
106
107#endif
Represents a COS-file object.
Definition object.hxx:16
Definition document.hxx:12
Base class for fonts.
Definition font.hxx:31
virtual ~Font() noexcept
Destructor.
Definition font.hxx:36
virtual int16_t get_descent() const =0
Get the font descent.
virtual int16_t get_ascent() const =0
Get the font ascent.
virtual uint16_t get_capheight() const =0
Get the font cap-height.
virtual string name() const =0
Get the name of the font.
virtual Text_width get_text_width(string const &)=0
Compute text width.
virtual uint16_t get_xheight() const =0
Get the font X-height.
virtual Document & document()=0
Access the parent document of this font.
virtual Carousel::Object object()=0
Get the COS object for this font.
Font()
Constructor.
Definition font.hxx:94
Graphics namespace.
Definition forward.hxx:105
Represents text width computations.
Definition font.hxx:13
uint32_t space_count
Space count.
Definition font.hxx:20
uint32_t character_count
Character count.
Definition font.hxx:16
double width
Text width.
Definition font.hxx:24