Sign In/My Account | View Cart  
advertisement

Article:
 Simple Text Wrapping
Subject: Making this work!!!
Date: 2004-02-09 13:16:05
From: Nicolas Jones

Hi,
I spent many hours trying to make this work with no success!! But by chance, I tried again a few months later (tonight) and finally got it. So I thought I might as well post a small message here for those of you in a similare situation. My problem was simply that I wasn't understanding what is needed in a minimal way to make all this work. Here is how I see all this, and how it has allowed me to make this work.


1) get the javascript file http://www.xml.com/2002/09/11/examples/TextWrap.es and put it in the same folder as your svg file where you are tying to do text wrap


2a) If you want to test the tutorial file, just download it, stick it in the same folder as the javascript file of point 1) and launch the svg file -> it works.


2b) If you want to try using the text wrap in another svg doc, you need to include the following things in your svg doc:
- you will need to add the following namespaces to the first <svg> tag of your document:
xmlns="http://www.w3.org/2000/svg" xmlns:text="http://xmlns.graougraou.com/svg/text/" xmlns:a3="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" a3:scriptImplementation="Adobe" onload="TextWrap._init()"
- you will need to add a definition to your code: <defs>
<script type="text/ecmascript" xlink:href="TextWrap.es" a3:scriptImplementation="Adobe" />
</defs>


With these to things, you can simply use:
<text:wrap x="20" y="20" width="100">your text</text:wrap> and it works great!!! That's how I made it work. Now you can start playing around with all the rest.
Hope this can help someone who is stuck like I was...
Dj Jay


PS
One problem I have already seen: if a word is longer than the width of the wrap-box, then Adobe's SVG viewer (v3.0) just get's stuck, and therefore youre browser too... :(


Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • Making this work!!!
    2005-08-07 17:59:34 adrianbj

    Hi All, Thanks for this script - but for some reason I keep getting a "TypeError: style has no properties" error. I have tried for hours to debug this. Would really appreciate any input on what I need to change.


    I get the rest of the output for the document (not included in the code below), but don't see anything at all of the text that is within the <text:wrap>


    Thanks,


    Adrian


    <?xml version="1.0" standalone="no"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"
    "http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd">
    <svg a3:scriptImplementation="Adobe" onload="TextWrap._init()" width="670" height="550" xmlns:a3="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" xmlns:text="http://xmlns.graougraou.com/svg/text/" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg-20000303-stylable" zoomAndPan="magnify">



    <defs>
    <script type="text/ecmascript" xlink:href="TextWrap.es" a3:scriptImplementation="Adobe"/>
    </defs>




    <text:wrap x="250" y="25" width="100" style="font-family: arial; font-size: 10px; font-weight: normal; fill: #000000; text-rendering: optimizeLegibility; text-align: justify; line-interval: 1.5em"> High secondary symptoms indicate serious problems, but low primary indicates other factors may also be involved in causing the conditions.</text:wrap>


    </svg>


    • Making this work!!!
      2006-08-20 16:40:13 ErikBorgen

      Hi,


      Have just joined the SVG world and got same problem. With some patience I found the reason: The text string is not allowed to start with a space.


Sponsored By: