In addition to the methods listed above, class
RVG::Text
also implements the styles method.
RVG::Text.new(x=0, y=0, text=nil) [ { |text| ...} ] -> aText
This method is usually invoked indirectly via the text method in the RVG::ClipPath, RVG::Group, RVG::Pattern, and RVG classes.
Text objects are containers, so this method yields to a block if one is present. A text object can contain RVG::Tspan objects that are added directly via tspan, or indirectly via tref.
All arguments are optional. You can omit all the arguments
when you just want to use the text
object as a
container for tspans
.
text.d(dx[, dy=0]) [ { |self| ...} ] -> self
The dx and dy arguments are added to the x and y text
arguments to form the initial text position. Yields to a block
if one is present.
self
text.rotate(degrees) [ { |text| ...} ] -> self
Rotates the text about the initial text position by the specified number of degrees. Yields to a block if one is present.
self
text.tref(tspan, x=0, y=0) -> self
Adds the referenced Tspan object to the text container.
Tspan
object.text.tspan(string=nil, x=nil, y=nil) [ { |tspan| ...} ] -> aTspan
Calls RVG::Tspan.new to construct a tspan and adds it to the enclosing RVG::Text object. Yields to a block if one is present, passing the new tspan as an argument.
Although tspan
has the same arguments as
RVG::Text.new
they are not in the same order. The
tspan
method has the string argument first followed by the
[x, y]
arguments. The RVG::Text.new
arguments are just
the opposite.
The new tspan, so other RVG::Tspan
methods can
be chained to it.
The basic styles include font styles and text styles. Note that ×Magick uses the font styles to select a font from the available fonts. If it cannot find a font that exactly matches it will use the closest matching font. Unlike MS Windows, ×Magick will not alter a font - by artificially slanting it to to simulate italics, for example - to produce a match.
font stylesDepending on the fonts that ×Magick is configured with you may not see the effect of some of the styles used in this example.
These styles are emulated by RVG by orienting and positioning each glyph individually. Consequently any use of a non-default value for one of these styles will probably cause your script to dramatically slow down. If you specify an invalid value for any of these styles RVG ignores the value and uses the default. RVG frequently uses approximate measurements to emulate these styles so the results will not be as precise as when ×Magick is doing the work.
::Magick::RVG::WORD_SEP
constant. By default
the value of ::Magick::RVG::WORD_SEP
is
/ /
.