RDKit: DrawTextCairo.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
DrawTextCairo.h
Go to the documentation of this file.
1//
2// Copyright (C) 2020-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 the Cairo
13// toy API to draw text onto a surface.
14
15#ifndef RDKIT_DRAWTEXTCAIRO_H
16#define RDKIT_DRAWTEXTCAIRO_H
17
18#include <cairo.h>
19
20#include <GraphMol/MolDraw2D/DrawTextNotFT.h>
21
22namespace RDKit {
23
24class MolDraw2DCairo;
25namespace MolDraw2D_detail {
26
27// ****************************************************************************
28 class DrawTextCairo : public DrawTextNotFT {
29 public:
30 DrawTextCairo(double max_fnt_sz, double min_fnt_sz, cairo_t *dp_cr);
31 DrawTextCairo(const DrawTextCairo &) = delete;
32 DrawTextCairo(DrawTextCairo &&) = delete;
33 DrawTextCairo &operator=(const DrawTextCairo &) = delete;
34 DrawTextCairo &operator=(DrawTextCairo &&) = delete;
35 void drawChar(char c, const Point2D &cds) override;
36 void setCairoContext(cairo_t *cr);
37
38 private:
39 cairo_t *dp_cr_;
40
41 // return a vector of StringRects, one for each char in text, with
42 // super- and subscripts taken into account. Sizes in pixel coords,
43 // i.e. scaled by fontScale().
44 void getStringRects(const std::string &text,
45 std::vector<std::shared_ptr<StringRect>> &rects,
46 std::vector<TextDrawType> &draw_modes,
47 std::vector<char> &draw_chars) const override;
48};
49
50} // namespace MolDraw2D_detail
51} // namespace RDKit
52
53#endif // RDKIT_DRAWTEXTCAIRO_H
DrawTextNotFT.h
RDGeom::Point2D
Definition point.h:284
RDKit::MolDraw2DCairo
Definition MolDraw2DCairo.h:27
RDKit::MolDraw2D_detail::DrawTextCairo::operator=
DrawTextCairo & operator=(DrawTextCairo &&)=delete
RDKit::MolDraw2D_detail::DrawTextCairo::DrawTextCairo
DrawTextCairo(const DrawTextCairo &)=delete
RDKit::MolDraw2D_detail::DrawTextCairo::operator=
DrawTextCairo & operator=(const DrawTextCairo &)=delete
RDKit::MolDraw2D_detail::DrawTextCairo::DrawTextCairo
DrawTextCairo(DrawTextCairo &&)=delete
RDKit::MolDraw2D_detail::DrawTextCairo::DrawTextCairo
DrawTextCairo(double max_fnt_sz, double min_fnt_sz, cairo_t *dp_cr)
RDKit::MolDraw2D_detail::DrawTextCairo::drawChar
void drawChar(char c, const Point2D &cds) override
RDKit::MolDraw2D_detail::DrawTextCairo::setCairoContext
void setCairoContext(cairo_t *cr)
RDKit::MolDraw2D_detail::DrawTextNotFT::DrawTextNotFT
DrawTextNotFT(double max_fnt_sz, double min_fnt_sz)
RDKit::MolDraw2D_detail
Definition AtomSymbol.h:30
RDKit
Std stuff.
Definition Abbreviations.h:19