diff --git a/src/data/symbol_font.cpp b/src/data/symbol_font.cpp index d887f9e5..8b943ad7 100644 --- a/src/data/symbol_font.cpp +++ b/src/data/symbol_font.cpp @@ -283,10 +283,14 @@ void SymbolFont::drawSymbol(RotatedDC& dc, RealRect sym_rect, double font_size, // find bitmap Bitmap bmp = sym.getBitmap(*this, dc.trS(font_size)); // draw aligned in the rectangle - dc.DrawBitmap(bmp, align_in_rect(align, dc.trInvS(RealSize(bmp.GetWidth(), bmp.GetHeight())), sym_rect)); + RealSize bmp_size = dc.trInvS(RealSize(bmp)); + RealPoint bmp_pos = align_in_rect(align, bmp_size, sym_rect); + dc.DrawBitmap(bmp, bmp_pos); // 2. draw text if (text.empty() || !sym.text_font) return; + // only use the bitmap rectangle + sym_rect = RealRect(bmp_pos, bmp_size); // subtract margins from size sym_rect.x += font_size * sym.text_margin_left; sym_rect.y += font_size * sym.text_margin_top; diff --git a/src/data/symbol_font.hpp b/src/data/symbol_font.hpp index 4a464c4a..ec9b56e4 100644 --- a/src/data/symbol_font.hpp +++ b/src/data/symbol_font.hpp @@ -101,10 +101,10 @@ class SymbolFont : public Packaged { /// Draws a single symbol inside the given rectangle void drawSymbol (RotatedDC& dc, RealRect sym_rect, double font_size, const Alignment& align, SymbolInFont& sym, const String& text); - /// Size of a single symbol + /// Size of a single symbol, including spacing RealSize symbolSize (double font_size, const DrawableSymbol& sym); public: - /// The default size of symbols + /// The default size of symbols, including spacing RealSize defaultSymbolSize(double font_size); DECLARE_REFLECTION();