GithubHelp home page GithubHelp logo

Comments (4)

AmeliaBR avatar AmeliaBR commented on August 30, 2024

The wrap-flow property is applied to the excluded element, to define how text wraps around it. It is therefore not appropriate for controlling wrapping within a shape.

A single element might need both external and internal wrapping controls. For example, a pull quote in a magazine layout: you want the quote to wrap to a shape, but you also want the column text to wrap around it. See an example here of dual wrapping. Now imagine the leaf shape was a maple leaf or something else with deep lobes that interrupt the text. Do you want to continue the text on the other side of the interruption or not?

I think it is important to have author control over this, so we would need a new property. It would also be needed for CSS Shapes 2 / CSS Exclusions (which would define how to create layouts like the linked example).

The values for the new property (wrap-inside?) would be similar to those for wrap-flow, but with the important distinction that there could be more than two shape regions that intersect any given line of text. I would suggest the following options:

  • all Text fills any region of the shape that it can fit into while respecting word breaks, continuing in straight lines.
  • start Text fills the first shape region on each line (based on text direction), continuing until it reaches a shape edge, then shifts to the next line.
  • end Text fills the first shape region on each line (based on text direction), continuing until it reaches a shape edge, then shifts to the next line.
  • minimum Text only fills the shortest continuous section of the shape for that line.
  • maximum Text only fills the longest continuous section of the shape for that line.

I would suggest that either all, start or maximum be chosen as the default value.

I can put together a demo of the options, if @Tavmjong does not already have something similar.

Note that I do not think that this property would be a reasonable way of dealing with flowing text from one shape to another, as describe in Issue #38. That is about filling one shape neatly, then moving to the next, like flowing from one column to another.

from svgwg.

AmeliaBR avatar AmeliaBR commented on August 30, 2024

From the CSS/SVG working group joint face to face in Sydney on 3 February 2016, the following were confirmed:

  • Default behavior for exclusions should be to break the text into separate line boxes before and after each interruption in the shape, similar to Tab's figure:

Text filling an X-shape

  • The ability to control this behavior is desirable, and could be added with a new property in future.

from svgwg.

AmeliaBR avatar AmeliaBR commented on August 30, 2024

Examples of the same shape with different wrapping scenarios. Text is manually positioned, so padding is not super precise and hyphenation may be non-standard, but you get the gist:

all wrapping (default)
N-shape filled with the introduction to the SVG 2 spec

start wrapping
Same shape, part of same text, but only the left side of the N is filled

maximum wrapping
Same N-shape, this time text fills the top left and then the bottom right

The example brings up a problem with maximum (and also minimum): what happens when multiple spans along a line have the same available width? (This is also an issue with minimum/maximum for wrap-flow, and correct behavior is not currently defined in the CSS Exclusions spec.) I have fallen back to start for the example here.

from svgwg.

Tavmjong avatar Tavmjong commented on August 30, 2024

It was decided at the joint CSS/SVG working meeting that text is laid out on both sides of a hole. The SVG 2 spec has been updated.

from svgwg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.