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