mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
42ab8c84c0
Added wrapping of <> around parameters to TextElement; Added colors for keyword parameters; Added menu & toolbar for keyword panel; Fixed bug in package, save/save-as was the wrong way around; Added third quality setting to RotatedDC: using SetUserScale, this gets you more precise positioning. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@250 0fc631ac-6414-0410-93d0-97cfa31319b6
32 lines
1.4 KiB
C++
32 lines
1.4 KiB
C++
//+----------------------------------------------------------------------------+
|
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
|
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
|
//+----------------------------------------------------------------------------+
|
|
|
|
// ----------------------------------------------------------------------------- : Includes
|
|
|
|
#include <render/text/element.hpp>
|
|
#include <data/symbol_font.hpp>
|
|
|
|
// ----------------------------------------------------------------------------- : SymbolTextElement
|
|
|
|
void SymbolTextElement::draw(RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const {
|
|
if (font.font) {
|
|
font.font->draw(dc, ctx, rect, font.size * scale, font.alignment, content.substr(start - this->start, end-start));
|
|
}
|
|
}
|
|
|
|
void SymbolTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& out) const {
|
|
if (font.font) {
|
|
font.font->getCharInfo(dc, ctx, font.size * scale, content.substr(start - this->start, end-start), out);
|
|
}
|
|
}
|
|
|
|
double SymbolTextElement::minScale() const {
|
|
return min(font.size, font.scale_down_to) / max(0.01, font.size);
|
|
}
|
|
double SymbolTextElement::scaleStep() const {
|
|
return 1. / max(font.size, 1.);
|
|
}
|