Chapter 7. Anchoring in International Waters
Think you’ve got a handle on SVG text alignment now? Not too complicated, is it? (Is it?) Maybe you’re wondering, though, why the text-anchor
keywords are not simply left
, center
, and right
. It’s a good question, and the start of a whole other level of complication.
The examples in the book so far have used English text, laid out left to right the way English text normally is. However, other languages arrange text right to left or top to bottom. Even within English and other Western languages, you may want to use vertical text to fit within the layout of a chart or diagram, or for artistic effect.
SVG includes a number of features to support alternative text modes, and this chapter and the next explain how they are supposed to work. However, some of the features were not well designed, and most are not well implemented in web browsers at the time of writing. These chapters therefore contain many warnings about browser incompatibilities. Where practical, they also offer suggestions for workarounds.
If you are developing designs that use non-Western languages, you will want to test your code thoroughly in any software you need to support.
You can also get involved to make things better in the future: provide feedback on web standards in development, and file bug reports and feature requests with browsers. Many developers involved in SVG and CSS have limited experience with non-European languages. Even if all you can do is provide practical ...
Get SVG Text Layout now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.