Basic text rendering working;

Added Font (done) and SymbolFont (skeleton);
Added styling to set;
Added CountourMap;
Some script fixes

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@73 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-11-17 17:57:04 +00:00
parent ea5be88bdb
commit ce6a83e34b
45 changed files with 1595 additions and 84 deletions
+22 -2
View File
@@ -22,6 +22,12 @@ String TextField::typeName() const {
return _("text");
}
void TextField::initDependencies(Context& ctx, const Dependency& dep) const {
Field ::initDependencies(ctx, dep);
script .initDependencies(ctx, dep);
default_script.initDependencies(ctx, dep);
}
IMPLEMENT_REFLECTION(TextField) {
REFLECT_BASE(Field);
@@ -48,10 +54,19 @@ TextStyle::TextStyle(const TextFieldP& field)
, line_height_line(1.0)
{}
bool TextStyle::update(Context& ctx) {
return Style::update(ctx)
| font.update(ctx);
}
void TextStyle::initDependencies(Context& ctx, const Dependency& dep) const {
Style::initDependencies(ctx, dep);
font.initDependencies(ctx, dep);
}
IMPLEMENT_REFLECTION(TextStyle) {
REFLECT_BASE(Style);
// REFLECT(font);
// REFLECT(symbol_font);
REFLECT(font);
REFLECT(symbol_font);
REFLECT(always_symbol);
REFLECT(allow_formating);
REFLECT(alignment);
@@ -75,6 +90,11 @@ IMPLEMENT_REFLECTION(TextStyle) {
String TextValue::toString() const {
return value();
}
bool TextValue::update(Context& ctx) {
Value::update(ctx);
return field().default_script.invokeOnDefault(ctx, value)
| field(). script.invokeOn(ctx, value);
}
IMPLEMENT_REFLECTION_NAMELESS(TextValue) {
REFLECT_NAMELESS(value);
+23 -12
View File
@@ -12,7 +12,10 @@
#include <util/prec.hpp>
#include <util/defaultable.hpp>
#include <data/field.hpp>
#include <data/font.hpp>
#include <data/symbol_font.hpp>
#include <script/scriptable.hpp>
#include <gfx/gfx.hpp>
// ----------------------------------------------------------------------------- : TextField
@@ -31,7 +34,9 @@ class TextField : public Field {
bool multi_line; ///< Are newlines allowed in the text?
bool move_cursor_with_sort; ///< When the text is reordered by a script should the cursor position be updated?
String default_name; ///< Name of "default" value
virtual void initDependencies(Context&, const Dependency&) const;
private:
DECLARE_REFLECTION();
};
@@ -44,21 +49,25 @@ class TextStyle : public Style {
TextStyle(const TextFieldP&);
DECLARE_STYLE_TYPE(Text);
// FontInfo font; ///< Font to use for the text
// SymbolFontInfo symbol_font; ///< Symbol font for symbols in the text
bool always_symbol; ///< Should everything be drawn as symbols?
bool allow_formating; ///< Is formating (bold/italic/..) allowed?
Alignment alignment; ///< Alignment inside the box
int angle; ///< Angle of the text inside the box
Font font; ///< Font to use for the text
SymbolFontRef symbol_font; ///< Symbol font for symbols in the text
bool always_symbol; ///< Should everything be drawn as symbols?
bool allow_formating; ///< Is formating (bold/italic/..) allowed?
Alignment alignment; ///< Alignment inside the box
int angle; ///< Angle of the text inside the box
double padding_left, padding_left_min; ///< Padding
double padding_right, padding_right_min; ///< Padding
double padding_top, padding_top_min; ///< Padding
double padding_bottom, padding_bottom_min; ///< Padding
double line_height_soft; ///< Line height for soft linebreaks
double line_height_hard; ///< Line height for hard linebreaks
double line_height_line; ///< Line height for <line> tags
String mask_filename; ///< Filename of the mask
// ContourMaskP mask; ///< Mask to fit the text to (may be null)
double line_height_soft; ///< Line height for soft linebreaks
double line_height_hard; ///< Line height for hard linebreaks
double line_height_line; ///< Line height for <line> tags
String mask_filename; ///< Filename of the mask
ContourMask mask; ///< Mask to fit the text to (may be null)
virtual bool update(Context&);
virtual void initDependencies(Context&, const Dependency&) const;
private:
DECLARE_REFLECTION();
};
@@ -74,6 +83,8 @@ class TextValue : public Value {
Defaultable<String> value; ///< The text of this value
virtual String toString() const;
virtual bool update(Context&);
private:
DECLARE_REFLECTION();
};