comparison Framework/Radiography/RadiographyTextLayer.h @ 1220:9ee6b28f53e8

RadiographyTextLayer: support multiple fonts
author Alain Mazy <alain@mazy.be>
date Sat, 07 Dec 2019 17:47:23 +0100
parents ab958fd99b07
children 37bc7f115f81 1c7ae79c426d
comparison
equal deleted inserted replaced
1219:f8bff27f1314 1220:9ee6b28f53e8
29 29
30 class RadiographyTextLayer : public RadiographyAlphaLayer 30 class RadiographyTextLayer : public RadiographyAlphaLayer
31 { 31 {
32 private: 32 private:
33 std::string text_; 33 std::string text_;
34 std::string font_;
34 unsigned int fontSize_; 35 unsigned int fontSize_;
35 uint8_t foreground_; 36 uint8_t foregroundGreyLevel_;
36 37
37 static bool fontHasBeenConfigured_; 38 static std::map<std::string, Orthanc::EmbeddedResources::FileResourceId> fonts_;
38 static Orthanc::EmbeddedResources::FileResourceId fontResourceId_;
39 public: 39 public:
40 RadiographyTextLayer(MessageBroker& broker, const RadiographyScene& scene) : 40 RadiographyTextLayer(MessageBroker& broker, const RadiographyScene& scene) :
41 RadiographyAlphaLayer(broker, scene) 41 RadiographyAlphaLayer(broker, scene)
42 { 42 {
43 } 43 }
44 44
45 void SetText(const std::string& utf8, unsigned int fontSize, uint8_t foreground); 45 void SetText(const std::string& utf8, const std::string& font, unsigned int fontSize, uint8_t foregroundGreyLevel);
46 46
47 const std::string& GetText() const 47 const std::string& GetText() const
48 { 48 {
49 return text_; 49 return text_;
50 }
51
52 const std::string& GetFont() const
53 {
54 return font_;
50 } 55 }
51 56
52 unsigned int GetFontSize() const 57 unsigned int GetFontSize() const
53 { 58 {
54 return fontSize_; 59 return fontSize_;
55 } 60 }
56 61
57 uint8_t GetForeground() const 62 uint8_t GetForegroundGreyLevel() const
58 { 63 {
59 return foreground_; 64 return foregroundGreyLevel_;
60 } 65 }
61 66
62 static void SetFont(Orthanc::EmbeddedResources::FileResourceId fontResourceId) 67 static void RegisterFont(const std::string& name, Orthanc::EmbeddedResources::FileResourceId fontResourceId)
63 { 68 {
64 fontResourceId_ = fontResourceId; 69 fonts_[name] = fontResourceId;
65 fontHasBeenConfigured_ = true;
66 } 70 }
67 }; 71 };
68 } 72 }