long text wrap.

View: New views
3 Messages — Rating Filter:   Alert me  

long text wrap.

by Nicolas Gillet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I would like to have some hints about how to use xml "text_ratio" and "wrap_width" attribute.

I can't find any info. :'(
e.g. I have a shape file with long city names (~25 characters) and words are separated by "-" in some cases.
the "wrap_character" does not seems to exist (anymore ?) in text symbolizer.

Can someone telle me more about this "wrap" and "ratio".
What I found is :
wrap_width :
* Length before wrapping long names (found in wiki)
* width to wrap text at, or trigger ratio (found in text_symbolizer.hpp)

->"lenght/width" ?! what width ? in pixel ? number of characters ? another unit ?
-> "or trigger ratio" so there is a link between ratio and wrap_width ... I suppose
-> think that when a text is bigger than this "length" something is done but what ?

ratio :  
* ? (found in wiki)
* target ratio for text bounding box in pixels (found in text_symbolizer.hpp)

Not enough for my understanding of the basic way to use them.
Whatever values I tried, I didn't see any change ... :'(

What I would like to do, and I think it is possible, is to set very long names on several lines
eg: my-very-long-name would be :
 my-very-
long-name
And I would like to know if it is possible to have such effect for a given polygon to make it so that the text will stay inside the polygon (e.g. the name of a park would stay inside park's geometry)

Thank for any answer.

Regards

Nicolas
Gillet

Re: long text wrap.

by Warren Vick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Nicolas,

I believe wrap_width is in pixels as I usually work with values of around 30-40.

I'd love to see better text wrapping with *multiple* wrap characters. I was generating maps for France recently which is a country which hyphenates town names a lot (e.g. "very-long-town-name"). So, in this case I'd like to break on spaces and "-". There was some good progress in label control in (http://trac.mapnik.org/changeset/1254) but I think it fell short of multiple character breaks. I guess there may be cases where there needs to be an expression of "break before" or "break after" (as current).

Previously discussed, I'd also like to see a hard break, perhaps with a C-style "\n". This would be very helpful when a label really needs to be split for some reason. e.g.

ROMA
(ROME)

text_ratio sounds intriguing but I've never tried it as it's documented with "?". If you find out what it does, please share!

Regards,
Warren

-----Original Message-----
From: mapnik-users-bounces@... [mailto:mapnik-users-bounces@...] On Behalf Of Nicolas Gillet
Sent: 16 September 2009 13:37
To: mapnik-users@...
Subject: [Mapnik-users] long text wrap.


Hello,

I would like to have some hints about how to use xml "text_ratio" and
"wrap_width" attribute.

I can't find any info. :'(
e.g. I have a shape file with long city names (~25 characters) and words are
separated by "-" in some cases.
the "wrap_character" does not seems to exist (anymore ?) in text symbolizer.

Can someone telle me more about this "wrap" and "ratio".
What I found is :
wrap_width :
* Length before wrapping long names (found in wiki)
* width to wrap text at, or trigger ratio (found in text_symbolizer.hpp)

->"lenght/width" ?! what width ? in pixel ? number of characters ? another
unit ?
-> "or trigger ratio" so there is a link between ratio and wrap_width ... I
suppose
-> think that when a text is bigger than this "length" something is done but
what ?

ratio :  
* ? (found in wiki)
* target ratio for text bounding box in pixels (found in
text_symbolizer.hpp)

Not enough for my understanding of the basic way to use them.
Whatever values I tried, I didn't see any change ... :'(

What I would like to do, and I think it is possible, is to set very long
names on several lines
eg: my-very-long-name would be :
 my-very-
long-name
And I would like to know if it is possible to have such effect for a given
polygon to make it so that the text will stay inside the polygon (e.g. the
name of a park would stay inside park's geometry)

Thank for any answer.

Regards

Nicolas
Gillet
--
View this message in context: http://www.nabble.com/long-text-wrap.-tp25471485p25471485.html
Sent from the Mapnik - Users mailing list archive at Nabble.com.

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users
_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: long text wrap.

by Nicolas Gillet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Okay ! Thank you.
I get it a little better now.
I was working on Belgian map, which is close France.
The "wrap_character" attributes works only with trunk rev, so that why my trials (in 0.6.1) where fruitless.
I will have a look at it.
Still having only one breaking char is short as depending on the country standards are changing but I think we can handle a part of this problem with filters (depending on the data source and info we have we could for instance defines different symbols filtering on countries).

I'll keep investigate around ratio and of course share if anything comes out.

Regards,

Nicolas


Warren Vick wrote:
Hello Nicolas,

I believe wrap_width is in pixels as I usually work with values of around 30-40.

I'd love to see better text wrapping with *multiple* wrap characters. I was generating maps for France recently which is a country which hyphenates town names a lot (e.g. "very-long-town-name"). So, in this case I'd like to break on spaces and "-". There was some good progress in label control in (http://trac.mapnik.org/changeset/1254) but I think it fell short of multiple character breaks. I guess there may be cases where there needs to be an expression of "break before" or "break after" (as current).

Previously discussed, I'd also like to see a hard break, perhaps with a C-style "\n". This would be very helpful when a label really needs to be split for some reason. e.g.

ROMA
(ROME)

text_ratio sounds intriguing but I've never tried it as it's documented with "?". If you find out what it does, please share!

Regards,
Warren
_______________________________________________
Mapnik-users mailing list
Mapnik-users@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mapnik-users