annotate Framework/Fonts/TextBoundingBox.h @ 1186:3284c3fd96ad broker

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 Nov 2019 09:51:47 +0100
parents b098a3aaf694
children 2d8ab34c8c91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
577
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "GlyphAlphabet.h"
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 namespace OrthancStone
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 class TextBoundingBox : protected GlyphAlphabet::ITextVisitor
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 private:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 int left_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 int top_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 int right_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 int bottom_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 unsigned int countCharacters_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 void AddPoint(int x,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 int y);
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 void Clear();
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 protected:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 virtual void Visit(uint32_t unicode,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 int x,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 int y,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 unsigned int width,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 unsigned int height,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 const Orthanc::IDynamicObject* payload /* ignored */);
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 public:
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 TextBoundingBox(const GlyphAlphabet& alphabet,
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 const std::string& utf8);
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 int GetLeft() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 return left_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 int GetTop() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 return top_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 unsigned int GetWidth() const;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 unsigned int GetHeight() const;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 unsigned int GetCharactersCount() const
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return countCharacters_;
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 };
b098a3aaf694 alphabet of glyphs
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 }