Search the web
Sign In
New User? Sign Up
svg-developers · SVG Developers
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.

Messages

  Messages Help
Advanced
Non-scalable text labels in scalable graphics?   Message List  
Reply Message #61064 of 63354 |
RE: [svg-developers] Re: Non-scalable text labels in scalable graphics?

My first thought was to create some sort of class or even a range of
object id's that would allow all the things you want not to scale to be
identified, and then to set the scale, on those, independently from the
scale of everything else, through script.



Then I thought that I had seen a "noscale" attribute value somewhere in
the SVG spec. A little bit of poking around revealed that with vector
effects in SVG1.2 there is a 'non-scaling-stroke' associated with vector
effects (see http://www.w3.org/TR/SVGMobile12/attributeTable.html). I
thought there was another way and suspect there still may be. Seems like
your situation is common enough that one might want a fairly ubiquitous
attribute called @scale - scale="normal" (the default) and scale="none"
when things like text and boundaries should not scale. One can imagine
that authors might have (for whatever reason) other objects (like
distant mountains that we might like to stay in the background). Maybe
@scale should have a number scale="1" means it scales normally like all
content, scale="0" means it is unaffected by zooming, anything in
between (scale =.25) would be a multiplier. That would give declarative
access to what we might call "sleeping beauty" space* (or "Scooby doo"
space)- like in http://srufaculty.sru.edu/david.dailey/svg/balloon.svg
where different layers have different virtual viewports.



I still think we may be overlooking something that's already there in
SVG 1.1.



David

*In recognition of Disney's quite elegant usage of 2+epsilon-dimensional
space or of Scooby Doo's quite inelegant usage of it.

From: svg-developers@yahoogroups.com
[mailto:svg-developers@yahoogroups.com] On Behalf Of gfc22
Sent: Wednesday, September 10, 2008 12:28 PM
To: svg-developers@yahoogroups.com
Subject: [svg-developers] Re: Non-scalable text labels in scalable
graphics?



Thanks Peter,

That looks good for what I asked for. But unfortunately I also want some
lines to remain the same
width under scaling.

So I've gone ahead and excluded the relevant texts and lines from the
scaled group, then computed
and assigned their required new coordinates after every scale operation.
Laborious, but it seems to
be the only way - but I'm a relative newby at SVG, so maybe someone
knows a better way.

The problem is that it isn't possible to exclude the font size or
stroke-width from scaling operations
in SVG.

George

--- In svg-developers@yahoogroups.com
<mailto:svg-developers%40yahoogroups.com> , Peter Thompson
<plthompson2004@...> wrote:
>
> Does this do what you want?
>
> <?xml version="1.0"?>
> <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
> <circle cx="50" cy="200" r="2" stroke="green" stroke-width="1"
fill="green"/>
> <g id="Labels" transform="translate(50,200)" font-size="20pt"
fill="red">
> <text>Text scales, but doesn't change font size.</text>
> </g>
> <script>
> <![CDATA[
> function SyncUI()
> {
> var root = document.rootElement;
> var scaleUI = 1/parseFloat(root.currentScale);
> var obj = document.getElementById("Labels");
> obj.setAttribute("font-size", (20 * scaleUI) + "pt");
> }
> document.rootElement.addEventListener( "SVGScroll", SyncUI, false );
> document.rootElement.addEventListener( "SVGResize", SyncUI, false );
> document.rootElement.addEventListener( "SVGZoom", SyncUI, false );
> SyncUI();
> // ]]>
> </script>
> </svg>
>
> --- On Sun, 9/7/08, gfc22 <george@...> wrote:
> From: gfc22 <george@...>
> Subject: [svg-developers] Non-scalable text labels in scalable
graphics?
> To: svg-developers@yahoogroups.com
<mailto:svg-developers%40yahoogroups.com>
> Date: Sunday, September 7, 2008, 8:48 AM
>
> I expect this is a FAQ, but Google doesn't offer anything relevant:
>
> I have text labels in scalable SVG groups. I want the positions of the
labels to scale with the
> other elements but not their text size. This must be a common
requirement. Suggestions
> welcome.
>
> George
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>





[Non-text portions of this message have been removed]




Wed Sep 10, 2008 5:05 pm

david.dailey@...
Send Email Send Email

Message #61064 of 63354 |
Expand Messages Author Sort by Date

I expect this is a FAQ, but Google doesn't offer anything relevant: I have text labels in scalable SVG groups. I want the positions of the labels to scale with...
gfc22
Offline Send Email
Sep 7, 2008
8:50 pm

Does this do what you want? <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"> <circle cx="50" cy="200" r="2"...
Peter Thompson
plthompson2004
Offline Send Email
Sep 9, 2008
12:25 am

Thanks Peter, That looks good for what I asked for. But unfortunately I also want some lines to remain the same width under scaling. So I've gone ahead and...
gfc22
Offline Send Email
Sep 10, 2008
4:27 pm

My first thought was to create some sort of class or even a range of object id's that would allow all the things you want not to scale to be identified, and...
Dailey, David P.
david.dailey@...
Send Email
Sep 10, 2008
5:05 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help