16#ifndef RDKIT_DRAWTEXT_H
17#define RDKIT_DRAWTEXT_H
31namespace MolDraw2D_detail {
50 static constexpr double DEFAULT_FONT_SCALE =
53 DrawText(
double max_fnt_sz,
double min_fnt_sz);
88 virtual void getStringSize(
const std::string &label,
double &label_width,
89 double &label_height)
const;
93 double &x_min,
double &y_min,
double &x_max,
94 double &y_max,
bool dontSplit =
false)
const;
101 std::vector<std::shared_ptr<StringRect>> &rects,
102 std::vector<TextDrawType> &draw_modes,
103 std::vector<char> &draw_chars,
bool dontSplit =
false,
142 const Point2D &end2,
double padding)
const;
145 const Point2D &end2,
double padding)
const;
147 const std::vector<std::shared_ptr<StringRect>> &rects,
151 const Point2D &cds1,
const std::string &label2,
155 TextAlignType align,
const std::vector<TextDrawType> &draw_modes,
156 std::vector<std::shared_ptr<StringRect>> &rects)
const;
159 const std::vector<TextDrawType> &draw_modes,
160 std::vector<std::shared_ptr<StringRect>> &rects)
const;
166 constexpr static double SUBS_SCALE = 0.66;
167 constexpr static double SUPER_SCALE = 0.66;
173 double base_font_size_ = DEFAULT_FONT_SCALE;
179 std::vector<std::shared_ptr<StringRect>> &rects,
180 std::vector<TextDrawType> &draw_modes,
181 std::vector<char> &draw_chars)
const = 0;
183 const std::vector<std::shared_ptr<StringRect>> &rects,
184 const std::vector<TextDrawType> &draw_modes,
185 const std::vector<char> &draw_chars);
#define RDUNUSED_PARAM(x)
virtual void alignString(TextAlignType align, const std::vector< TextDrawType > &draw_modes, std::vector< std::shared_ptr< StringRect > > &rects) const
bool doesLineIntersect(const std::vector< std::shared_ptr< StringRect > > &rects, const Point2D &cds, const Point2D &end1, const Point2D &end2, double padding) const
DrawText(DrawText &&)=delete
void getStringRects(const std::string &text, OrientType orient, std::vector< std::shared_ptr< StringRect > > &rects, std::vector< TextDrawType > &draw_modes, std::vector< char > &draw_chars, bool dontSplit=false, TextAlignType textAlign=TextAlignType::MIDDLE) const
bool doesRectIntersect(const std::vector< std::shared_ptr< StringRect > > &rects, const Point2D &cds, const StringRect &rect) const
DrawText(const DrawText &)=delete
bool setFontScale(double new_scale, bool ignoreLimits=false)
double minFontSize() const
void setBaseFontSize(double new_size)
double selectScaleFactor(char c, TextDrawType draw_type) const
bool doesLineIntersect(const std::string &label, OrientType orient, const Point2D &cds, const Point2D &end1, const Point2D &end2, double padding) const
void adjustLineForString(const std::string &label, OrientType orient, const Point2D &end1, Point2D &end2) const
virtual void getStringSize(const std::string &label, double &label_width, double &label_height) const
using the current scale, work out the size of the label
double baseFontSize() const
virtual std::string getFontFile() const
void setFontSize(double new_size)
bool doesRectIntersect(const std::string &label, OrientType orient, const Point2D &cds, const StringRect &rect) const
virtual void getStringRects(const std::string &text, std::vector< std::shared_ptr< StringRect > > &rects, std::vector< TextDrawType > &draw_modes, std::vector< char > &draw_chars) const =0
bool doesStringIntersect(const std::vector< std::shared_ptr< StringRect > > &rects, const Point2D &cds1, const std::string &label2, OrientType orient2, const Point2D &cds2) const
DrawText(double max_fnt_sz, double min_fnt_sz)
void drawChars(const Point2D &a_cds, const std::vector< std::shared_ptr< StringRect > > &rects, const std::vector< TextDrawType > &draw_modes, const std::vector< char > &draw_chars)
virtual void drawChar(char c, const Point2D &cds)=0
virtual void drawString(const std::string &str, const Point2D &cds, TextAlignType align)
drawString centres the string on cds.
bool doesStringIntersect(const std::string &label1, OrientType orient1, const Point2D &cds1, const std::string &label2, OrientType orient2, const Point2D &cds2) const
virtual void setFontFile(const std::string &font_file)
void adjustStringRectsForSuperSubScript(const std::vector< TextDrawType > &draw_modes, std::vector< std::shared_ptr< StringRect > > &rects) const
double maxFontSize() const
void drawStringRects(const std::string &label, OrientType orient, TextAlignType talign, const Point2D &cds, MolDraw2D &mol_draw) const
DrawColour const & colour() const
void setColour(const DrawColour &col)
void setMinFontSize(double new_max)
void drawString(const std::string &label, const Point2D &cds, OrientType orient)
DrawText & operator=(const DrawText &)=delete
DrawText & operator=(DrawText &&)=delete
void getStringExtremes(const std::string &label, OrientType orient, double &x_min, double &y_min, double &x_max, double &y_max, bool dontSplit=false) const
void setMaxFontSize(double new_max)
MolDraw2D is the base class for doing 2D renderings of molecules.
#define RDKIT_MOLDRAW2D_EXPORT
std::vector< std::string > atomLabelToPieces(const std::string &label, OrientType orient)
RDKIT_MOLDRAW2D_EXPORT bool setStringDrawMode(const std::string &instring, TextDrawType &draw_mode, size_t &i)
std::ostream & operator<<(std::ostream &oss, const OrientType &o)
bool rdvalue_is(const RDValue_cast_t)