[SVGMobile12] Text in an area

Hi.

In section 10.11.5, the sentence

  Below is a recommended algorithm for implementing 'display-align'.

should probably read

  Below is a recommended algorithm for implementing
  display-align="center".

Also, this algorithm seems to have been made more general so that it can
handle flowing text into non-rectangular shapes, but there are a couple
of problems with the algorithm as it stands.

For example, this document illustrates how some text may flow into a
non-rectangular shape:

  <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"
       font-size="15" font-family="Arial">
    <polygon points="0,0 45,50 0,50 45,100 55,100 100,50 55,50 100,0"
             fill="#f80"/>
    <text x="15" y="15">abcdefghij</text>
    <text x="15" y="65">abcdefghij</text>
  </svg>

If the given algorithm were followed, it would go like this:

  ▪ D := 100
  ▪ Lay out text starting from y = 0
  ▪ A := 35, B := 0
  ▪ C := 35
  ▪ C ≥ 1 and C ≤ D, so don’t terminate
  ▪ D := C (= 35)
  ▪ New starting point of B + 0.5 (A - B) = 17.5
  ▪ Lay out text starting from y = 17.5 
  ▪ A := 20, B := 50 (since the both words now go into the rectangular
    region)
  ▪ C := 30
  ▪ C ≥ 1 and C ≤ D, so don’t terminate
  ▪ D := C (= 30)
  ▪ New starting point of B + 0.5 (A - B) = 35
  ▪ Lay out text starting from y = 35
  ▪ A := 20, B := 50 (layout is the same as the last iteration)
  ▪ C := 30
  ▪ C ≥ 1 and C ≤ D, so don’t terminate
  ▪ D := C (= 30)
  ▪ New starting point of B + 0.5 (A - B) = 35
  ▪ Loop infinitely…

Perhaps just having line 7 of the algorithm be

  7. If C is greater than or equal to D then layout terminates.

so that improvements are always made.  However I’m not convinced that
this algorithm won’t result in being stuck in a local minimum for C and
not find the best layout.  (But perhaps that is not the aim.)

Also, the algorithm does not say what to do if some words weren’t
positioned because they fell off the edge of the end of the shape.
Should A = 0 in this case?

-- 
 Cameron McCormack   ICQ: 26955922
 cam (at) mcc.id.au   MSN: cam (at) mcc.id.au
 http://mcc.id.au/   JBR: heycam (at) jabber.org

Received on Monday, 22 May 2006 01:26:33 UTC