Add option for selecting which text should be upright.
This commit is contained in:
parent
6a7387f95e
commit
0b1c983d40
2 changed files with 32 additions and 13 deletions
|
@ -119,6 +119,16 @@ enum justify_alignment
|
||||||
|
|
||||||
DEFINE_ENUM(justify_alignment_e, justify_alignment);
|
DEFINE_ENUM(justify_alignment_e, justify_alignment);
|
||||||
|
|
||||||
|
enum text_upright
|
||||||
|
{
|
||||||
|
UPRIGHT_AUTO,
|
||||||
|
UPRIGHT_LEFT,
|
||||||
|
UPRIGHT_RIGHT,
|
||||||
|
text_upright_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_ENUM(text_upright_e, text_upright);
|
||||||
|
|
||||||
class text_layout;
|
class text_layout;
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,6 +179,7 @@ struct text_symbolizer_properties
|
||||||
unsigned text_ratio;
|
unsigned text_ratio;
|
||||||
unsigned wrap_width;
|
unsigned wrap_width;
|
||||||
bool rotate_displacement;
|
bool rotate_displacement;
|
||||||
|
text_upright_e upright;
|
||||||
/** Default values for char_properties. */
|
/** Default values for char_properties. */
|
||||||
char_properties_ptr format;
|
char_properties_ptr format;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -43,9 +43,7 @@ static const char * label_placement_strings[] = {
|
||||||
"interior",
|
"interior",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
IMPLEMENT_ENUM(label_placement_e, label_placement_strings)
|
||||||
|
|
||||||
IMPLEMENT_ENUM( label_placement_e, label_placement_strings )
|
|
||||||
|
|
||||||
static const char * vertical_alignment_strings[] = {
|
static const char * vertical_alignment_strings[] = {
|
||||||
"top",
|
"top",
|
||||||
|
@ -54,9 +52,7 @@ static const char * vertical_alignment_strings[] = {
|
||||||
"auto",
|
"auto",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
IMPLEMENT_ENUM(vertical_alignment_e, vertical_alignment_strings)
|
||||||
|
|
||||||
IMPLEMENT_ENUM( vertical_alignment_e, vertical_alignment_strings )
|
|
||||||
|
|
||||||
static const char * horizontal_alignment_strings[] = {
|
static const char * horizontal_alignment_strings[] = {
|
||||||
"left",
|
"left",
|
||||||
|
@ -65,9 +61,7 @@ static const char * horizontal_alignment_strings[] = {
|
||||||
"auto",
|
"auto",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
IMPLEMENT_ENUM(horizontal_alignment_e, horizontal_alignment_strings)
|
||||||
|
|
||||||
IMPLEMENT_ENUM( horizontal_alignment_e, horizontal_alignment_strings )
|
|
||||||
|
|
||||||
static const char * justify_alignment_strings[] = {
|
static const char * justify_alignment_strings[] = {
|
||||||
"left",
|
"left",
|
||||||
|
@ -76,9 +70,7 @@ static const char * justify_alignment_strings[] = {
|
||||||
"auto",
|
"auto",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
IMPLEMENT_ENUM(justify_alignment_e, justify_alignment_strings)
|
||||||
|
|
||||||
IMPLEMENT_ENUM( justify_alignment_e, justify_alignment_strings )
|
|
||||||
|
|
||||||
static const char * text_transform_strings[] = {
|
static const char * text_transform_strings[] = {
|
||||||
"none",
|
"none",
|
||||||
|
@ -87,9 +79,18 @@ static const char * text_transform_strings[] = {
|
||||||
"capitalize",
|
"capitalize",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
IMPLEMENT_ENUM(text_transform_e, text_transform_strings)
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_ENUM( text_transform_e, text_transform_strings )
|
static const char * text_upright_strings[] = {
|
||||||
|
"auto",
|
||||||
|
"left",
|
||||||
|
"right",
|
||||||
|
"capitalize",
|
||||||
|
""
|
||||||
|
};
|
||||||
|
IMPLEMENT_ENUM(text_upright_e, text_upright_strings)
|
||||||
|
|
||||||
|
|
||||||
text_symbolizer_properties::text_symbolizer_properties() :
|
text_symbolizer_properties::text_symbolizer_properties() :
|
||||||
orientation(),
|
orientation(),
|
||||||
|
@ -111,6 +112,7 @@ text_symbolizer_properties::text_symbolizer_properties() :
|
||||||
text_ratio(0),
|
text_ratio(0),
|
||||||
wrap_width(0),
|
wrap_width(0),
|
||||||
rotate_displacement(false),
|
rotate_displacement(false),
|
||||||
|
upright(UPRIGHT_AUTO),
|
||||||
format(boost::make_shared<char_properties>()),
|
format(boost::make_shared<char_properties>()),
|
||||||
tree_()
|
tree_()
|
||||||
{
|
{
|
||||||
|
@ -171,6 +173,8 @@ void text_symbolizer_properties::from_xml(xml_node const &sym, fontset_map const
|
||||||
if (orientation_) orientation = *orientation_;
|
if (orientation_) orientation = *orientation_;
|
||||||
optional<boolean> rotate_displacement_ = sym.get_opt_attr<boolean>("rotate-displacement");
|
optional<boolean> rotate_displacement_ = sym.get_opt_attr<boolean>("rotate-displacement");
|
||||||
if (rotate_displacement_) rotate_displacement = *rotate_displacement_;
|
if (rotate_displacement_) rotate_displacement = *rotate_displacement_;
|
||||||
|
optional<text_upright_e> upright_ = sym.get_opt_attr<text_upright_e>("upright");
|
||||||
|
if (upright_) upright = *upright_;
|
||||||
optional<double> dx = sym.get_opt_attr<double>("dx");
|
optional<double> dx = sym.get_opt_attr<double>("dx");
|
||||||
if (dx) displacement.x = *dx;
|
if (dx) displacement.x = *dx;
|
||||||
optional<double> dy = sym.get_opt_attr<double>("dy");
|
optional<double> dy = sym.get_opt_attr<double>("dy");
|
||||||
|
@ -279,6 +283,10 @@ void text_symbolizer_properties::to_xml(boost::property_tree::ptree &node,
|
||||||
{
|
{
|
||||||
set_attr(node, "rotate-displacement", rotate_displacement);
|
set_attr(node, "rotate-displacement", rotate_displacement);
|
||||||
}
|
}
|
||||||
|
if (upright != dfl.upright || explicit_defaults)
|
||||||
|
{
|
||||||
|
set_attr(node, "upright", upright);
|
||||||
|
}
|
||||||
format->to_xml(node, explicit_defaults, *(dfl.format));
|
format->to_xml(node, explicit_defaults, *(dfl.format));
|
||||||
if (tree_) tree_->to_xml(node);
|
if (tree_) tree_->to_xml(node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue