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  public:
32  DrawTextSVG(double max_fnt_sz, double min_fnt_sz, std::ostream &oss,
33  std::string &d_act_class);
34  DrawTextSVG(const DrawTextSVG &) = delete;
35  DrawTextSVG(DrawTextSVG &&) = delete;
36  DrawTextSVG &operator=(const DrawTextSVG &) = delete;
38 
39  void drawChar(char c, const Point2D &cds) override;
40 
41  std::ostream &oss_;
42  std::string &d_active_class_;
43 
44  // fills a vector of StringRects, one for each char in text, with
45  // super- and subscripts taken into account. Sizes in pixel coords,
46  // i.e. scaled by fontScale().
47  void getStringRects(const std::string &text,
48  std::vector<std::shared_ptr<StringRect>> &rects,
49  std::vector<TextDrawType> &draw_modes,
50  std::vector<char> &draw_chars) const override;
51 };
52 
53 } // namespace MolDraw2D_detail
54 } // namespace RDKit
55 
56 #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