Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Chinese text annotation along (near-)vertical paths #550

Open
artemp opened this Issue · 4 comments

2 participants

Artem Pavlenko gisupc
Artem Pavlenko
Owner

hi, I came to the Chinese, when I made using mapnik mark along the text, using a Chinese version, because of their different ways, the effect seems not very good, detailed look at maps, I hope a similar effect to the google map ! I modified the placement_finder.cpp the corresponding code, which can be achieved a similar effect but there are still some bug, details, please refer to the attached picture and the code, my English is not good, hope you can understand what I mean!

Artem Pavlenko
Owner

[springmeyer] can you attach a diff file of the placement_finder.cpp?

So, from:

$ svn diff src/placement_finder.cpp

Also, zip or tar are easier to handle than rar for attaching the other items.

Artem Pavlenko
Owner

[wiml] I attached a diff of placement_finder.cpp from bug.rar against the version in SVN (also converted it to utf8 from gb18030, but trac's diff formatter still garbles it). The other contents of the rar files are images demonstrating the problem and fix, and a mapstyle.xml file.

I'm not sure I 100% understand the bug and fix. If I understand correctly, the problem is that mapnik doesn't take advantage of the fact that Chinese can be written vertically. When arranging Latin text on a line, mapnik (effectively) lays out the text horizontally and then rotates/bends the text's baseline to match the line. If the line is close to vertical, then Mapnik could get better results by laying out the text vertically and rotating the (vertical) baseline to match the line.

The patch from mmtxcp rotates the individual characters and adjusts their spacing to achieve this effect.

IIRC, Chinese (and Japanese) have some characters which are written differently depending on whether you're writing horizontally or vertically. It would be nice if Mapnik were smart enough to correctly choose the horizontal or vertical glyph forms. Maybe that should be in a separate trac ticket though?

Artem Pavlenko
Owner

[wiml] I went looking for hand-drawn Chinese maps to see what typographic conventions people follow when not constrained by software. The first (oldest, from 1825) [http://wason.library.cornell.edu/Tianjin/maps.html map of Tianjin in this archive at Cornell] has some interesting features:

  • Vertical ways are labeled using vertical layout
  • Horizontal ways are labeled using horizontal layout
  • The near-vertical diagonal way (just to the right of the center) is labeled using vertical layout, with both the baseline and the characters rotated to match the way (that is, the characters rotate with the baseline, like we do for Latin text)
  • The entrances on the left and right, oddly, are labeled with vertical layout rotated horizontally. Some of the text near the walls is also laid out as if to be read by rotating the entire map 90 degrees. I guess this is because of the importance of those gates as approaches to the city?
  • There are a couple of examples of horizontal layout along a curving baseline: for example on the gate at the bottom of the map.

A more modern example is [http://mappery.com/map-of/Chengdu-City-Map this map of Chengdu]:

  • Many examples of both horizontal and vertical layout for road labels
  • In a couple of cases, though, the individual characters of a vertically-laid label are not rotated to match the rotation of the baseline (for example, the road three map squares to the left and one up from the city's central square). I don't know what the significance of this is.
gisupc

this question has solved ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.