<prstTxWarp> (Preset Text Warp)

This element specifies when a preset geometric shape should be used to transform a piece of text. This operation is known formally as a text warp. The generating application should be able to render all preset geometries enumerated in the <ST_TextShapeType> list.

example:
<p:sp>
  <p:txBody>
    <a:bodyPr wrap="none" rtlCol="0">
      <a:prstTxWarp prst="textInflate">
      </a:prstTxWarp>
      <a:spAutoFit/>
    </a:bodyPr>
    <a:lstStyle/>
    <a:p><a:t>Sample Text</a:t></a:p>
  </p:txBody>
</p:sp>

The resulting text that has now had the Inflate text warp applied to it is shown above. ]

Using any of the presets listed under the ST_TextShapeType list below it is possible to apply a text warp to a run of DrawingML text via the following steps.

If you look at any of the text warps in the file format you will notice that each consists of two paths. This corresponds to a top path (first one specified) and a bottom path (second one specified). Now the top path and the bottom path represent the top line and base line that the text needs to be warped to. How this is done is in the following way.

  1. Compute the rectangle that the unwarped text resides in. (tightest possible rectangle around text, no white space except for “space characters”)

  2. Take each of the quadratic and cubic Bezier curves that are used to calculate the original character and change their end points and control points by the following method…

  3. Move a vertical line horizontally along the original text rectangle and find the horizontal percentage that a given end point or control point lives at. (.5 for the middle for instance)

  4. Now do the same thing for this point vertically. Find the vertical percentage that this point lives at with the top and bottom of this text rectangle being the respective top and bottom bounds. (0.0 and 1.0 respectively)

  5. Now that we have the percentages for a given point in a Bezier equation we can map that to the new point in the warped text environment.

  6. Going back to the top and bottom paths specified in the file format we can take these and flatten them out to a straight arc (top and bottom might be different lengths)

  7. After they are straight we can measure them both horizontally to find the same percentage point that we found within the original text rectangle. (0.5 let’s say)

  8. So then we measure 50% along the top path and 50% along the bottom path, putting the paths back to their original curvy shapes.

  9. Once we have these two points we can draw a line between them that will serve as our vertical line in the original text rectangle (note: this might not be truly vertical as 50% on the top does not always line up with 50% on the bottom)

  10. Taking this new line we then follow it from top to bottom the vertical percentage amount that we got from step 4.

  11. This is then the new point that should be used in place of the old point in the original text rectangle.

  12. We will then continue doing these same steps for each of the end points and control points within the body of text. (is applied to a whole body of text only)

Note:

[: Since this is a shape it does have both a shape coordinate system and a path coordinate system. ]

Parent Elements

<bodyPr>5.1.5.1.1)

Child Elements

Subclause

<avLst> (List of Shape Adjust Values)

§5.1.11.5

Attributes

Description

<prst> (Preset Warp Shape)

Specifies the preset geometry that will be used for a shape warp on a piece of text. This preset can have any of the values in the enumerated list for <ST_TextShapeType>. This attribute is required in order for a text warp to be rendered.

<p:sp>
  <p:txBody>
    <a:bodyPr wrap="none" rtlCol="0">
      <a:prstTxWarp prst="textInflate">
      </a:prstTxWarp>
      <a:spAutoFit/>
    </a:bodyPr>
    <a:lstStyle/>
    <a:p><a:t>Sample Text</a:t></a:p>
  </p:txBody>
</p:sp>

In the above example a preset text shape geometry has been used to define the warping shape. The shape utilized here is the sun shape. ]

The possible values for this attribute are defined by the ST_TextShapeType simple type (§5.1.12.76).

The following XML Schema fragment defines the contents of this element:

<complexType name="CT_PresetTextShape">
	<sequence>
	<element name="avLst" type="CT_GeomGuideList" minOccurs="0" maxOccurs="1"/>
	</sequence>
	<attribute name="prst" type="ST_TextShapeType" use="required"/>
</complexType>