RDKit: DrawTextJS.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
DrawTextJS.h
Go to the documentation of this file.
1//
2// Copyright (C) 2020-2022 Greg Landrum 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: Greg Landrum
11//
12// A concrete class derived from DrawText that uses the JS Canvas
13// to draw text onto a picture.
14// Requires emscripten
15
16#ifndef RDKIT_DRAWTEXTJS_H
17#define RDKIT_DRAWTEXTJS_H
18
19#include <iosfwd>
20
21#include <emscripten.h>
22#include <emscripten/val.h>
23#include <GraphMol/MolDraw2D/DrawTextNotFT.h>
24
25namespace RDKit {
26namespace MolDraw2D_detail {
27// ****************************************************************************
28
29 class DrawTextJS : public DrawTextNotFT {
30 public:
31 DrawTextJS(double max_fnt_sz, double min_fnt_sz, emscripten::val &context);
32 DrawTextJS(const DrawTextJS &rhs) = delete;
33 DrawTextJS(const DrawTextJS &&rhs) = delete;
34 DrawTextJS &operator=(const DrawTextJS &rhs) = delete;
35 DrawTextJS &operator=(const DrawTextJS &&rhs) = delete;
36
37 void drawChar(char c, const Point2D &cds) override;
38
39 emscripten::val &context_;
40
41 // fills 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_DRAWTEXTSVG_H
DrawTextNotFT.h
RDGeom::Point2D
Definition point.h:284
RDKit::MolDraw2D_detail::DrawTextJS::DrawTextJS
DrawTextJS(double max_fnt_sz, double min_fnt_sz, emscripten::val &context)
RDKit::MolDraw2D_detail::DrawTextJS::DrawTextJS
DrawTextJS(const DrawTextJS &&rhs)=delete
RDKit::MolDraw2D_detail::DrawTextJS::drawChar
void drawChar(char c, const Point2D &cds) override
RDKit::MolDraw2D_detail::DrawTextJS::DrawTextJS
DrawTextJS(const DrawTextJS &rhs)=delete
RDKit::MolDraw2D_detail::DrawTextJS::context_
emscripten::val & context_
Definition DrawTextJS.h:39
RDKit::MolDraw2D_detail::DrawTextJS::getStringRects
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
RDKit::MolDraw2D_detail::DrawTextJS::operator=
DrawTextJS & operator=(const DrawTextJS &&rhs)=delete
RDKit::MolDraw2D_detail::DrawTextJS::operator=
DrawTextJS & operator=(const DrawTextJS &rhs)=delete
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