| 1 | package SVG::DOM2::Element::Text; | ||
| 2 | |||
| 3 | use base "SVG::DOM2::Element::Shape"; | ||
| 4 | use base "SVG::DOM2::Element::Shape::Font"; | ||
| 5 | use base "SVG::DOM2::Element::Shape::Fill"; | ||
| 6 | use base "SVG::DOM2::Element::Shape::Stroke"; | ||
| 7 | use strict; | ||
| 8 | use warnings; | ||
| 9 | |||
| 10 | use SVG::DOM2::Attribute::Metric; | ||
| 11 | |||
| 12 | sub new | ||
| 13 | { | ||
| 14 | my ($proto, %args) = @_; | ||
| 15 | my $self = $proto->SUPER::new('text', %args); | ||
| 16 | return $self; | ||
| 17 | } | ||
| 18 | |||
| 19 | sub _attribute_handle | ||
| 20 | { | ||
| 21 | my ($self, $name, %opts) = @_; | ||
| 22 | return SVG::DOM2::Attribute::Metric->new(%opts) if $name eq 'x' or $name eq 'y'; | ||
| 23 | return $self->SUPER::_attribute_handle($name, %opts); | ||
| 24 | } | ||
| 25 | |||
| 26 | sub _has_attribute | ||
| 27 | { | ||
| 28 | my ($self, $name) = @_; | ||
| 29 | return $self->SUPER::_has_attribute($name); | ||
| 30 | } | ||
| 31 | |||
| 32 | sub attr | ||
| 33 | { | ||
| 34 | my ($self, $name, $set) = @_; | ||
| 35 | $self->setAttribute($name, $set) if defined($set); | ||
| 36 | return $self->getAttribute($name); | ||
| 37 | } | ||
| 38 | |||
| 39 | sub x { shift->attr('x', @_); } | ||
| 40 | sub y { shift->attr('y', @_); } | ||
| 41 | |||
| 42 | sub has_font { 1 } | ||
| 43 | |||
| 44 | return 1; |