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:
twanvl
2008-05-18 20:30:16 +00:00
parent b8b2632baa
commit 6215bbd6dc
+4 -3
View File
@@ -318,8 +318,9 @@ void SymbolFont::drawSymbol(RotatedDC& dc, RealRect sym_rect, double font_size,
}
Image SymbolFont::getImage(double font_size, const DrawableSymbol& sym) {
if (!sym.symbol || !sym.symbol->text_font)
return Image(1,1);
if (!sym.symbol) 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));
// memory dc to work with
wxMemoryDC dc;
@@ -338,7 +339,7 @@ Image SymbolFont::getImage(double font_size, const DrawableSymbol& sym) {
while (true) {
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);
ts = rdc.GetTextExtent(sym.text);
ts = rdc.GetTextExtent(sym.draw_text);
if (ts.height <= sym_rect.height) {
if (ts.width <= sym_rect.width) {
break; // text fits