Curved lines in Word?

  • Thread starter Peter T. Daniels
  • Start date
P

Peter T. Daniels

I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?

When I try WordArt, and I increase the curve of the line of type, it
stretches the type rather than simply curving the line.

If it can be done in Publisher or PowerPoint, that would be fine too.
 
M

macropod

I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?

Yes, but not in a way that is in any sense feasible for most users. Doing so requires the use of Word's PRINT field, a good command
of postscript code and a postscript printer (or to PDF via Adobe Acrobat's 'print driver', for example). Presumably, the same could
be done by someone well versed in other printer languages.

Just as an example, the following PRINT field uses postscript code to print "The quick brown fox jumps over the lazy dog." around a
circle:

{PRINT \p page "
/pi 3.14159265358979 def

% The circletext routine describes how to print text in a circle
/circletext
{cirtextdict begin
/radius exch def
/centreangle exch def
/ptsize exch def
/str exch def
/xradius radius ptsize 3 div sub def
gsave
centreangle str findhalfangle sub rotate
str
{/charcode exch def
( ) dup 0 charcode put placechar
} forall
grestore
end
}def

/cirtextdict 20 dict def
cirtextdict begin
/findhalfangle
{stringwidth pop 2 div
2 xradius mul pi mul div 360 mul
}def

/placechar
{/char exch def
/halfangle char findhalfangle def
gsave
halfangle rotate
radius 0 translate
90 rotate
char stringwidth pop 2 div neg 0 moveto
char show
grestore
halfangle 2 mul rotate
}def

end

% Define the circle's size, position and text
wp$x wp$right sub wp$left add 2 div wp$y wp$top sub wp$bottom add 2 div translate
/Right 0 def % Set the circle's horizontal position
/Up 0 def % Set the circle's vertical position
/CRadius 45 def % Set the circle's radius
/TRadius CRadius 4 sub def % Position the text inside the circle
/Text (The quick brown fox jumps over the lazy dog.) def
/MyCircle {/saveobj save def % save current state
.5 setlinewidth % set thickness of line
newpath % create a new path
Right Up CRadius 0 360 arc % define the circle's arc
closepath stroke % close the path and draw it
/Courier findfont % select the font
9 scalefont setfont % set the font size & make it current
Right Up translate % set a new origin to match the circle
Text % the text to output
180 rotate Text
8 270 TRadius circletext % use the circletext to write the text
saveobj restore} def % restore current state
% Output the result
MyCircle"}

There are a numerous variables in the latter parts of this code that you could adjust. First off, you can change the text, in this
case "The quick brown fox jumps over the lazy dog.". You could also change the circle's position, defined by the 'Right' and 'Up'
coordinates, its radius 'Cradius' and the radius of the text 'TRadius' - in this case, 'CRadius 4 sub' puts the bottom edge of the
text 4pts inside the circle, whereas 'CRadius 5 add' would put it 5pts outside the circle. These units are all in points. Similarly,
you could change the '0 360' to alter the start and end points of the arc, which you can also leave open by deleting 'closepath'.

To work with the lower left corner of the page as the origin, delete the line:
wp$x wp$right sub wp$left add 2 div wp$y wp$top sub wp$bottom add 2 div translate
and adjust the 'Right' and 'Up' coordinates to suit.

And that's just a simple example. The postscript manuals, from which the above is adapted, have sample code for printing text along
more complex arcs.

Note: Word doesn't even give you a preview of the output.

So, as I said: "not in a way that is in any sense feasible for most users".
 
P

Peter T. Daniels

Good grief!

And that's only for segments of a circle? I'd need Bezier curves at
the least ...

I'm sure I've seen instructions for typing on a curved path but
certainly can't say where.

Couldn't find anything in Photoshop or Illustrator either, but that's
not surprising.

I'm using arrows instead.

I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?

Yes, but not in a way that is in any sense feasible for most users. Doingso requires the use of Word's PRINT field, a good command
of postscript code and a postscript printer (or to PDF via Adobe Acrobat's 'print driver', for example). Presumably, the same could
be done by someone well versed in other printer languages.

Just as an example, the following PRINT field uses postscript code to print "The quick brown fox jumps over the lazy dog." around a
circle:

{PRINT \p page "
/pi 3.14159265358979 def

% The circletext routine describes how to print text in a circle
/circletext
      {cirtextdict begin
           /radius exch def
           /centreangle exch def
           /ptsize exch def
           /str exch def
           /xradius radius ptsize 3 div sub def
           gsave
             centreangle str findhalfangle sub rotate
             str
               {/charcode exch def
                ( ) dup 0 charcode put placechar
               } forall
           grestore
         end
      }def

/cirtextdict 20 dict def
cirtextdict begin
  /findhalfangle
    {stringwidth pop 2 div
      2 xradius mul pi mul div 360 mul
    }def

/placechar
 {/char exch def
   /halfangle char findhalfangle def
   gsave
     halfangle rotate
     radius 0 translate
     90 rotate
     char stringwidth pop 2 div neg 0 moveto
     char show
   grestore
   halfangle 2 mul rotate
 }def

end

% Define the circle's size, position and text
wp$x wp$right sub wp$left add 2 div wp$y wp$top sub wp$bottom add 2 div translate
/Right 0 def                           % Set the circle's horizontal position
/Up 0 def                              % Set the circle's vertical position
/CRadius 45 def                        % Set the circle's radius
/TRadius CRadius 4 sub def             % Position the text inside the circle
/Text (The quick brown fox jumps over the lazy dog.) def
/MyCircle {/saveobj save def           % save current state
    .5 setlinewidth            % set thickness of line
    newpath                    % create a new path
    Right Up CRadius 0 360 arc % define the circle's arc
    closepath stroke           % close the path and draw it
    /Courier findfont          % select the font
    9 scalefont setfont        % set the font size & make it current
    Right Up translate         % set a new origin to match the circle
    Text        % the text to output
    180 rotate Text
    8 270 TRadius circletext   % use the circletext to write the text
    saveobj restore} def       % restore current state
% Output the result
MyCircle"}

There are a numerous variables in the latter parts of this code that you could adjust. First off, you can change the text, in this
case "The quick brown fox jumps over the lazy dog.". You could also change the circle's position, defined by the 'Right' and 'Up'
coordinates, its radius 'Cradius' and the radius of the text 'TRadius' - in this case, 'CRadius 4 sub' puts the bottom edge of the
text 4pts inside the circle, whereas 'CRadius 5 add' would put it 5pts outside the circle. These units are all in points. Similarly,
you could change the '0 360' to alter the start and end points of the arc, which you can also leave open by deleting 'closepath'.

To work with the lower left corner of the page as the origin, delete the line:
wp$x wp$right sub wp$left add 2 div wp$y wp$top sub wp$bottom add 2 div translate
and adjust the 'Right' and 'Up' coordinates to suit.

And that's just a simple example. The postscript manuals, from which the above is adapted, have sample code for printing text along
more complex arcs.

Note: Word doesn't even give you a preview of the output.

So, as I said: "not in a way that is in any sense feasible for most users".

--
Cheers
macropod
[Microsoft MVP - Word]



I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?
When I try WordArt, and I increase the curve of the line of type, it
stretches the type rather than simply curving the line.
If it can be done in Publisher or PowerPoint, that would be fine too.-
 
S

Suzanne S. Barnhill

Text on a path can be done in CorelDRAW, but not in Word.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

Good grief!

And that's only for segments of a circle? I'd need Bezier curves at
the least ...

I'm sure I've seen instructions for typing on a curved path but
certainly can't say where.

Couldn't find anything in Photoshop or Illustrator either, but that's
not surprising.

I'm using arrows instead.

I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?

Yes, but not in a way that is in any sense feasible for most users. Doing
so requires the use of Word's PRINT field, a good command
of postscript code and a postscript printer (or to PDF via Adobe Acrobat's
'print driver', for example). Presumably, the same could
be done by someone well versed in other printer languages.

Just as an example, the following PRINT field uses postscript code to
print "The quick brown fox jumps over the lazy dog." around a
circle:

{PRINT \p page "
/pi 3.14159265358979 def

% The circletext routine describes how to print text in a circle
/circletext
{cirtextdict begin
/radius exch def
/centreangle exch def
/ptsize exch def
/str exch def
/xradius radius ptsize 3 div sub def
gsave
centreangle str findhalfangle sub rotate
str
{/charcode exch def
( ) dup 0 charcode put placechar
} forall
grestore
end
}def

/cirtextdict 20 dict def
cirtextdict begin
/findhalfangle
{stringwidth pop 2 div
2 xradius mul pi mul div 360 mul
}def

/placechar
{/char exch def
/halfangle char findhalfangle def
gsave
halfangle rotate
radius 0 translate
90 rotate
char stringwidth pop 2 div neg 0 moveto
char show
grestore
halfangle 2 mul rotate
}def

end

% Define the circle's size, position and text
wp$x wp$right sub wp$left add 2 div wp$y wp$top sub wp$bottom add 2 div
translate
/Right 0 def % Set the circle's horizontal position
/Up 0 def % Set the circle's vertical position
/CRadius 45 def % Set the circle's radius
/TRadius CRadius 4 sub def % Position the text inside the circle
/Text (The quick brown fox jumps over the lazy dog.) def
/MyCircle {/saveobj save def % save current state
.5 setlinewidth % set thickness of line
newpath % create a new path
Right Up CRadius 0 360 arc % define the circle's arc
closepath stroke % close the path and draw it
/Courier findfont % select the font
9 scalefont setfont % set the font size & make it current
Right Up translate % set a new origin to match the circle
Text % the text to output
180 rotate Text
8 270 TRadius circletext % use the circletext to write the text
saveobj restore} def % restore current state
% Output the result
MyCircle"}

There are a numerous variables in the latter parts of this code that you
could adjust. First off, you can change the text, in this
case "The quick brown fox jumps over the lazy dog.". You could also change
the circle's position, defined by the 'Right' and 'Up'
coordinates, its radius 'Cradius' and the radius of the text 'TRadius' -
in this case, 'CRadius 4 sub' puts the bottom edge of the
text 4pts inside the circle, whereas 'CRadius 5 add' would put it 5pts
outside the circle. These units are all in points. Similarly,
you could change the '0 360' to alter the start and end points of the arc,
which you can also leave open by deleting 'closepath'.

To work with the lower left corner of the page as the origin, delete the
line:
wp$x wp$right sub wp$left add 2 div wp$y wp$top sub wp$bottom add 2 div
translate
and adjust the 'Right' and 'Up' coordinates to suit.

And that's just a simple example. The postscript manuals, from which the
above is adapted, have sample code for printing text along
more complex arcs.

Note: Word doesn't even give you a preview of the output.

So, as I said: "not in a way that is in any sense feasible for most
users".

--
Cheers
macropod
[Microsoft MVP - Word]

message

I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?
When I try WordArt, and I increase the curve of the line of type, it
stretches the type rather than simply curving the line.
If it can be done in Publisher or PowerPoint, that would be fine too.-
 
P

Peter T. Daniels

So the only place I could have seen something about it was a long-ago
magazine article or ad.

Isn't it lurking somewhere in Illustrator? My map opened fine in both
Photoshop and Illustrator, but in both of those, the Type Tool only
gives a straight line (that can then be rotated if needed).
 
S

Suzanne S. Barnhill

I feel sure that if CorelDRAW can do it, Illustrator can as well. Look in
the Help for "text on a path" or "fit text to a path" or "text on a curve"
or the like.

But if you just want text to be arched, then WordArt can do what you want;
you just have to know how to tweak it. I find that, to get the curve I want,
I often have to add spaces on either side of the text (while increasing the
height of the WordArt object).

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

So the only place I could have seen something about it was a long-ago
magazine article or ad.

Isn't it lurking somewhere in Illustrator? My map opened fine in both
Photoshop and Illustrator, but in both of those, the Type Tool only
gives a straight line (that can then be rotated if needed).
 
Y

Yves Dhondt

Yes and no. It is possible, but not simply through the user interface as far
as I know.

The following macro (watch for linewraps!!!) inserts a curved text where you
can change the settings whatever way you want through the variables.
http://img14.imageshack.us/img14/579/curvedtext.png shows a screenshot of
the effect of changing the value of the fitPath variable as well as the
curve on which the text is displayed.

============== Begin Macro 1 ==============
Sub CurvedTextPOC()
' Variable which will hold the VML definition.
Dim xml As String
' Defines the Bezier curve.
' curve(1,.) = from
' curve(2,.) = control1
' curve(3,.) = control2
' curve(4,.) = to
Dim curve(1 To 4, 1 To 2) As Single
' The text to display.
Dim text As String
' The style of the text.
' CSS-2 definition of the text style.
Dim style As String
' Indicates if the text should fit the entire curve or not.
Dim fitPath As Boolean

' Set values for variables
curve(1, 1) = 50 ' from
curve(1, 2) = 100
curve(2, 1) = 200 ' control 1
curve(2, 2) = 200
curve(3, 1) = 300 ' control 2
curve(3, 2) = 200
curve(4, 1) = 400 ' to
curve(4, 2) = 100

text = "An example of curved text"

style = "font:normal normal normal 14pt Calibri"

fitPath = False


' Start the xml.
xml = "<w:wordDocument xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'><w:body><w:p><w:r><w:pict>"

' Curved text.
xml = xml & "<v:curve from='" & curve(1, 1) & "," & curve(1, 2) & "' "
xml = xml & "control1='" & curve(2, 1) & "," & curve(2, 2) & "' "
xml = xml & "control2='" & curve(3, 1) & "," & curve(3, 2) & "' "
xml = xml & "to='" & curve(4, 1) & "," & curve(4, 2) & "'>"

xml = xml & "<v:path textpathok='true' />"

xml = xml & "<v:textpath on='true' style='" & style & "' string='" & text
& "' fitpath='" & fitPath & "' />"

xml = xml & "</v:curve>"

' Finish the xml.
xml = xml & "</w:pict></w:r></w:p></w:body></w:wordDocument>"

' Insert the result.
Selection.InsertXML (xml)

End Sub
============== End Macro 1 ==============

The following macro (watch linewrapping!!!) is just a piece of code to show
that Word can actually display text along any defined path. The result of
this macro can be seen at
http://img191.imageshack.us/img191/3426/curvedtext2.png

============== Begin Macro 2 ==============
Sub ComplexCurvedTextPOC()
Dim xml As String

xml = "<w:wordDocument xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'><w:body><w:p><w:r><w:pict><v:shape
path='m337,2045c168,1216,,388,337,425v337,37,1435,1862,2025,1845c2952,2253,3412,283,3877,320v465,37,833,2170,1275,2175c5594,2500,6090,382,6532,350v442,-32,868,1972,1275,1950c8214,2278,8667,430,8977,215,9287,,9530,840,9667,1010e'
filled='false'><v:path textpathok='true'/><v:textpath on='true'
style='font:normal normal normal 16pt Calibri' string='A complex curved text
in Word, it is possible if you know some VML.'
/></v:shape></w:pict></w:r></w:p></w:body></w:wordDocument>"

Selection.InsertXML (xml)

End Sub
============== End Macro 2 ==============

Yves
 
P

Peter T. Daniels

Yes, those are effects I would have liked to use. But it looks as
though you need to know how to describe a Bezier curve numerically in
order to use it?
 
Y

Yves Dhondt

I'm guessing it should be possible to assign handles to the curve so you can
change its layout in Word, but you might want to ask someone more
knowledgable about VML (or DrawingML) to help you with that. If I have some
time left, I might take a look at it, but no promises.

Yves

Yes, those are effects I would have liked to use. But it looks as
though you need to know how to describe a Bezier curve numerically in
order to use it?
 
Y

Yves Dhondt

Try the following macro (watch for line wraps). Once the object is inserted,
you should have a lot of freedom in manipulating it (just click it to
activate it):
- there is a bounding box which you can resize and rotate (green bullet)
- there are 4 handles (yellow diamonds) with which you can set the from,
to, and the 2 control points of your Bezier curve
- from the WordArt Tools 'Format' tab, you can access the 'Edit Text'
button to change the text

In the macro, there is are severable variables you can set. The most
interesting ones are:
- fitPath : indicates if the text should use the entire path (and be
stretched) of the curve or not (default: false)
- curve: defines the Bezier curve to start from

============== Begin Macro 1 ==============
Sub CurvedTextPOC()
' Variable which will hold the VML definition.
Dim xml As String
' Defines the initial Bezier curve.
' A curve is defined by 4 set of points: from, control1, control2, and
to.
Dim curve As String
' The text to display.
Dim text As String
' The style of the text.
' CSS-2 definition of the text style.
Dim style As String
' Indicates if the text should fit the entire curve or not.
Dim fitPath As Boolean

' Set values for variables.
curve = "110,220,440,440,660,440,880,220"
text = "An example of curved text"
style =
"font-weight:normal;font-style:normal;font-size:14pt;font-family:Arial"
fitPath = False

' Start the xml.
xml = "<w:wordDocument xmlns:v='urn:schemas-microsoft-com:vml'
xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'><w:body><w:p><w:r><w:pict>"

' Add a shape.
xml = xml & "<v:shape style='width:150pt;height:150pt' adj='" & curve & "'
path='m@0@1c@2@3@4@5@6@7e' filled='false'>"

' Add formulas.
xml = xml & "<v:formulas><v:f eqn='val #0'/><v:f eqn='val #1'/><v:f
eqn='val #2'/><v:f eqn='val #3'/><v:f eqn='val #4'/><v:f eqn='val #5'/><v:f
eqn='val #6'/><v:f eqn='val #7'/></v:formulas>"

' Add text.
xml = xml & "<v:path textpathok='true' />"
xml = xml & "<v:textpath on='true' style='" & style & "' string='" & text
& "' fitpath='" & fitPath & "' />"

' Add handles.
xml = xml & "<v:handles><v:h position='#0,#1' xrange='0,1000'
yrange='0,1000'/><v:h position='#2,#3' xrange='0,1000' yrange='0,1000'
/><v:h position='#4,#5' xrange='0,1000' yrange='0,1000' /><v:h
position='#6,#7' xrange='0,1000' yrange='0,1000' /></v:handles>"

' Finish the shape.
xml = xml & "</v:shape>"

' Finish the xml.
xml = xml & "</w:pict></w:r></w:p></w:body></w:wordDocument>"

' Insert the result.
Selection.InsertXML (xml)

End Sub
============== End Macro 1 ==============

Yves
 
Y

Yves Dhondt

The Word macro I offered in this thread (post of 02/02/2010) generates
simple WordArt, something used in Publisher as well. I exectured the macro
in Word and copy/pasted the result from Word into Publisher. It seems like
it is fully functional, including all the handles and text setting stuff.

The macro can probably be rewritten to work in Publisher directly, but as I
am not a Publisher user, I can't offer much assistance here. I checked and
couldn't find an InsertXml function at first glance, so that could be a
major problem.

Yves

JoAnn Paules said:
We've been asking for that function in Publisher for quite some time.

--
JoAnn Paules
MVP Microsoft [Publisher]
Tech Editor for "Microsoft Publisher 2007 For Dummies"



Peter T. Daniels said:
I'd like to draw a path -- a simple arc -- and type along it (to make
labels on a map). Is this possible in Word?

When I try WordArt, and I increase the curve of the line of type, it
stretches the type rather than simply curving the line.

If it can be done in Publisher or PowerPoint, that would be fine too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top