RDKit
Open-source cheminformatics and machine learning.
DrawTextSVG.h
Go to the documentation of this file.
1 //
2 // @@ All Rights Reserved @@
3 // This file is part of the RDKit.
4 // The contents are covered by the terms of the BSD license
5 // which is included in the file license.txt, found at the root
6 // of the RDKit source tree.
7 //
8 // Original author: David Cosgrove (CozChemIx) on 29/04/2020.
9 //
10 // A concrete class derived from DrawText that uses SVG
11 // to draw text onto a picture.
12 
13 #ifndef RDKIT_DRAWTEXTSVG_H
14 #define RDKIT_DRAWTEXTSVG_H
15 
16 #include <iosfwd>
17 
19 
20 namespace RDKit {
21 
22 // ****************************************************************************
23 
24 class DrawTextSVG : public DrawText {
25  public:
26  DrawTextSVG(double max_fnt_sz, double min_fnt_sz, std::ostream &oss,
27  std::string &d_act_class);
28 
29  void drawChar(char c, const Point2D &cds) override;
30 
31  private:
32  std::ostream &oss_;
33  std::string &d_active_class_;
34 
35  // fills a vector of StringRects, one for each char in text, with
36  // super- and subscripts taken into account. Sizes in pixel coords,
37  // i.e. scaled by fontScale().
38  void getStringRects(const std::string &text,
39  std::vector<std::shared_ptr<StringRect>> &rects,
40  std::vector<TextDrawType> &draw_modes,
41  std::vector<char> &draw_chars) const override;
42 };
43 
44 } // namespace RDKit
45 
46 #endif // RDKIT_DRAWTEXTSVG_H
void drawChar(char c, const Point2D &cds) override
DrawTextSVG(double max_fnt_sz, double min_fnt_sz, std::ostream &oss, std::string &d_act_class)
Std stuff.
Definition: Abbreviations.h:18