Loading ...
Sorry, an error occurred while loading the content.

Re: Embarrassingly basic viewport/viewbox Q

Expand Messages
  • steltenpower
    viewBox / preserveAspectRatio / view/width / units / clipping (?) / overflow seem like things people have a hard time understanding, both as standalone SVG, or
    Message 1 of 7 , Aug 8, 2009
    • 0 Attachment
      viewBox / preserveAspectRatio / view/width / units / clipping (?) / overflow seem like things people have a hard time understanding, both as standalone SVG, or 'embedded' in HTML or other SVG

      Maybe you could make an interactive experiment that shows how all (many of) these things work, to save people a lot of time figuring it out. That would make good content for planetsvg.com

      Anyway, good luck



      --- In svg-developers@yahoogroups.com, alex <alyxtmp-netbeans@...> wrote:
      >
      > After searching the archives and reading the spec, i still have some
      > sort of mental block about the viewBox and user units. If someone could
      > show me what a svg tag would look like that would print an area of 8" x
      > 10", at 300dpi, such that a line with a stroke-size of 1px is 1/300"
      > wide, and 10pt text is 10pt, i'd very much appreciate it. (Most of the
      > samples i've found are in dimensionless user units, and i simply don't
      > understand how long "20" is.)
      >
      > Thanks,
      >
      > --alex.
      >
    • alex
      That s an excellent suggestion, and after playing around with basic settings, i think i ve finally got a handle on things... Apparently you can have a
      Message 2 of 7 , Aug 8, 2009
      • 0 Attachment
        That's an excellent suggestion, and after playing around with basic
        settings, i think i've finally got a handle on things... Apparently you
        can have a resolution higher than the default (screen), or
        properly-sized absolute units (in, cm, etc.), but not both at the same
        time, as the sizes of the latter are calculated based on the initial
        (screen) resolution.

        So, a 1" x 1", 300dpi graphic would look something like:

        // 1" at screen resolution - <object> won't take absolute units
        (<object width="96" height="96">)

        <svg width="96" height="96" viewBox="0 0 300 300"
        preserveAspectRatio="xMinYMin meet">

        (etc.)

        </svg>
        (</object>)

        However, within the graphic, "1in" won't be 1in, but rather 96/300 =
        0.32in. This, coupled with the fact that you can't use absolute units
        in <path> data, would seem to make them pretty much useless in any case
        other than a non-transformed, screen-destined graphic. Which i suppose
        the spec does get around to pointing out, but i sure wish _SVG
        Essentials_ had. As i'm just about to roof-test the damn thing, has
        anyone a recommendation for a good (and recent) SVG book?

        If i'm *still* wrong, please correct me; otherwise, hope this might help
        any other pathetic newbies with this same confusion in the future.

        --alex.

        steltenpower wrote:
        >
        >
        > viewBox / preserveAspectRatio / view/width / units / clipping (?) /
        > overflow seem like things people have a hard time understanding, both as
        > standalone SVG, or 'embedded' in HTML or other SVG
        >
        > Maybe you could make an interactive experiment that shows how all (many
        > of) these things work, to save people a lot of time figuring it out.
        > That would make good content for planetsvg.com
        >
        > Anyway, good luck
        >
        > --- In svg-developers@yahoogroups.com
        > <mailto:svg-developers%40yahoogroups.com>, alex <alyxtmp-netbeans@...>
        > wrote:
        > >
        > > After searching the archives and reading the spec, i still have some
        > > sort of mental block about the viewBox and user units. If someone could
        > > show me what a svg tag would look like that would print an area of 8" x
        > > 10", at 300dpi, such that a line with a stroke-size of 1px is 1/300"
        > > wide, and 10pt text is 10pt, i'd very much appreciate it. (Most of the
        > > samples i've found are in dimensionless user units, and i simply don't
        > > understand how long "20" is.)
        > >
        > > Thanks,
        > >
        > > --alex.
      Your message has been successfully submitted and would be delivered to recipients shortly.