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