[OSM-dev] arabic shaping support in Mapnik

Artem Pavlenko artem.mapnik at googlemail.com
Mon Oct 8 22:04:51 BST 2007


Hello list,

I was looking into solving 'shaping' support for right-to-left
languages (arabic) and I found - PostArabic
(http://dcmms.sourceforge.net/postarabic.php). It is a postgresql
module which provides shape_arabic(text) and couple other methods I
extended it with 'is_arabic (text)' and now it's possible to do:

(select place,case when is_arabic(name) then
shape_arabic(str_reverse(name)) else name end as name,
leisure,amenity,"natural",tourism, way from planet_osm_point) as
places;

The above SQL conditionally reverses and shapes arabic text in
planet_osm_point table. 'is_arabic' check is simply testing for first
2 bytes (UTF-8) expand to be in 0x0600 - 0x6ff range (arabic unicode).

There are two ways we can integrate this :
1. Modify osm.xml sql as above
2. Modify osm2psql to do 'inserts' with conditional shaping.

Second approach is better, IMHO.

Also, mapnik dosn't need to be built with BIDI anymore. This is a
great news , because libfribidi is not threadsafe.

Attaches is the patch against postarabic-1.0.5.

Thought?
Cheers,
Artem
-------------- next part --------------
A non-text attachment was scrubbed...
Name: is_arabic.patch
Type: application/octet-stream
Size: 2553 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071008/12901832/attachment.obj>


More information about the dev mailing list