Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Fonts/GlyphAlphabet.h @ 1592:0d4b11ba86df
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 23 Oct 2020 15:15:32 +0200 |
parents | 244ad1e4e76a |
children | 4fb8fdf03314 |
rev | line source |
---|---|
576 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
576
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
576 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "FontRenderer.h" | |
25 | |
1455
30deba7bc8e2
simplifying include_directories
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1270
diff
changeset
|
26 #include <Enumerations.h> |
576 | 27 |
28 #include <map> | |
29 | |
30 namespace OrthancStone | |
31 { | |
32 class GlyphAlphabet : public boost::noncopyable | |
33 { | |
34 public: | |
35 class ITextVisitor : public boost::noncopyable | |
36 { | |
37 public: | |
38 virtual ~ITextVisitor() | |
39 { | |
40 } | |
41 | |
42 virtual void Visit(uint32_t unicode, | |
43 int x, | |
44 int y, | |
45 unsigned int width, | |
46 unsigned int height, | |
47 const Orthanc::IDynamicObject* payload /* can be NULL */) = 0; | |
48 }; | |
49 | |
50 | |
51 class IGlyphVisitor : public boost::noncopyable | |
52 { | |
53 public: | |
54 virtual ~IGlyphVisitor() | |
55 { | |
56 } | |
57 | |
58 virtual void Visit(uint32_t unicode, | |
59 const Glyph& glyph) = 0; | |
60 }; | |
61 | |
62 | |
63 private: | |
64 typedef std::map<uint32_t, Glyph*> Content; | |
65 | |
66 Content content_; | |
67 unsigned int lineHeight_; | |
68 | |
69 public: | |
70 GlyphAlphabet() : | |
71 lineHeight_(0) | |
72 { | |
73 } | |
74 | |
75 ~GlyphAlphabet() | |
76 { | |
77 Clear(); | |
78 } | |
79 | |
80 void Clear(); | |
81 | |
82 void Register(uint32_t unicode, | |
83 const Glyph& glyph, | |
84 Orthanc::IDynamicObject* payload); | |
85 | |
86 void Register(FontRenderer& renderer, | |
87 uint32_t unicode); | |
88 | |
89 #if ORTHANC_ENABLE_LOCALE == 1 | |
90 static bool GetUnicodeFromCodepage(uint32_t& unicode, | |
91 unsigned int index, | |
92 Orthanc::Encoding encoding); | |
93 #endif | |
94 | |
95 size_t GetSize() const | |
96 { | |
97 return content_.size(); | |
98 } | |
99 | |
100 void Apply(IGlyphVisitor& visitor) const; | |
101 | |
102 void Apply(ITextVisitor& visitor, | |
103 const std::string& utf8) const; | |
104 }; | |
105 } |