mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Fixed exporting of symbol font images without text
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@866 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -318,8 +318,9 @@ void SymbolFont::drawSymbol(RotatedDC& dc, RealRect sym_rect, double font_size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Image SymbolFont::getImage(double font_size, const DrawableSymbol& sym) {
|
Image SymbolFont::getImage(double font_size, const DrawableSymbol& sym) {
|
||||||
if (!sym.symbol || !sym.symbol->text_font)
|
if (!sym.symbol) return Image(1,1);
|
||||||
return Image(1,1);
|
if (sym.draw_text.empty()) return sym.symbol->getImage(*this, font_size);
|
||||||
|
// with text
|
||||||
Bitmap bmp(sym.symbol->getImage(*this, font_size));
|
Bitmap bmp(sym.symbol->getImage(*this, font_size));
|
||||||
// memory dc to work with
|
// memory dc to work with
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
@@ -338,7 +339,7 @@ Image SymbolFont::getImage(double font_size, const DrawableSymbol& sym) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
if (size <= 0) return sym.symbol->getImage(*this, font_size); // text too small
|
if (size <= 0) return sym.symbol->getImage(*this, font_size); // text too small
|
||||||
rdc.SetFont(*sym.symbol->text_font, size / sym.symbol->text_font->size);
|
rdc.SetFont(*sym.symbol->text_font, size / sym.symbol->text_font->size);
|
||||||
ts = rdc.GetTextExtent(sym.text);
|
ts = rdc.GetTextExtent(sym.draw_text);
|
||||||
if (ts.height <= sym_rect.height) {
|
if (ts.height <= sym_rect.height) {
|
||||||
if (ts.width <= sym_rect.width) {
|
if (ts.width <= sym_rect.width) {
|
||||||
break; // text fits
|
break; // text fits
|
||||||
|
|||||||
Reference in New Issue
Block a user