Font name can now be scripted

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@291 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-04-22 22:37:20 +00:00
parent b0c6669384
commit e4500ce490
12 changed files with 100 additions and 74 deletions
+11 -9
View File
@@ -8,6 +8,7 @@
#include <util/rotation.hpp>
#include <gfx/gfx.hpp>
#include <data/font.hpp>
// ----------------------------------------------------------------------------- : Rotation
@@ -179,19 +180,20 @@ void RotatedDC::SetTextForeground(const Color& color) { dc.SetTextForeground(col
void RotatedDC::SetLogicalFunction(int function) { dc.SetLogicalFunction(function); }
void RotatedDC::SetFont(const wxFont& font) {
if (quality == QUALITY_LOW) {
if (quality == QUALITY_LOW && zoom == 1) {
dc.SetFont(font);
} else {
SetFont(font, font.GetPointSize());
wxFont scaled = font;
if (quality == QUALITY_LOW) {
scaled.SetPointSize((int) trS(font.GetPointSize()));
} else {
scaled.SetPointSize((int) (trS(font.GetPointSize()) * text_scaling));
}
dc.SetFont(scaled);
}
}
void RotatedDC::SetFont(wxFont font, double size) {
if (quality == QUALITY_LOW) {
font.SetPointSize((int) trS(size));
} else {
font.SetPointSize((int) (trS(size) * text_scaling));
}
dc.SetFont(font);
void RotatedDC::SetFont(const Font& font, double scale) {
dc.SetFont(font.toWxFont(trS(scale) * (quality == QUALITY_LOW ? 1 : text_scaling)));
}
double RotatedDC::getFontSizeStep() const {
+4 -2
View File
@@ -13,6 +13,8 @@
#include <util/real_point.hpp>
#include <gfx/gfx.hpp>
class Font;
// ----------------------------------------------------------------------------- : Rotation
/// An object that can rotate coordinates inside a specified rectangle
@@ -158,8 +160,8 @@ class RotatedDC : public Rotation {
void SetFont(const wxFont& font);
/// Set the font, scales for zoom and high_quality
/** The font will get the given (internal) point size */
void SetFont(wxFont font, double size);
/** The font size will be multiplied by 'scale' */
void SetFont(const Font& font, double scale);
/// Steps to use when decrementing font size
double getFontSizeStep() const;