TextShape

From SVG

The SVG WG has had many requests to provide text wrapped to an arbitrary shape, and also the ability to autosize a shape to fit the content, and to change the the text font-size to best-fit in an arbitrary shape. There are several aspects and challenges to these problems.

We also need to coordinate with the CSS and XSL-FO WGs.

Use Cases, Requirements, and Specifications


Optical Kerning

Conversations

fantasai: "There are two problems with filling shapes: one is optical kerning, which is relatively easy; the other is having the shape wrap to the content and that is hard it's a multipass algorithm, because you have a dependency of the box on the content and the content on the box. you don't get that as much with rectangles. CSS defines line boxes, and we define that line boxes stack CSS defines how content fills inside a line box; if SVG just focuses on how long the line box is, then there's no overlap with CSS definitions, and you can address the optical kerning issue by explaining how the shape of the box and the contents affect the length of the line box."

shepazu: "we've talked about that... cameron has some ideas from his constraints work"


Challenges

line-breaking algorithm

Goal: Specify a line-breaking algorithm so that a document looks the same in different UAs/browsers/authoring tools

  • XSL-FO has never specified a line breaking algorithm -- it's an area where implementations compete in terms of price and quality
  • i18n difficulties
    • define problems?
    • the Knuth-Plass TeX stuff has flaws (?)
  • hard problem to get right; DSSSL tried for years
  • different environments:
    • screen size
    • resolution
      • (SVG helps the screen size/resolution issue, but even 1 pixel in a character width is significant and may affect rendering)
    • fonts
      • font rasterizing engine
      • level of font hinting
      • (WOFF fonts may help solve the font problem)
    • target printer
    • hyphenation dictionary
    • locale

Solutions

  • for testing, define a first-fit algorithm that works OK for some languages?