Project proposal: Implementing vertical writing support for Pango library
mathrick at mathrick org
Google Summer of Code 2006
The GNOME Project
Implementation of vertical writing support for Pango according to the CSS3 vertical writing model proposal.
Pango provides robust support for rendering of many of the world's scripts. This includes facilities such as contextual shaping, clustering, glyph substitution and Unicode-compliant BiDi (bi-directional) layout algorithm. There are, however, no provisions for displaying text running vertically, which is the traditional writing direction of many Asian scripts, including Japanese and Chinese. While support for CJK scripts within Pango today is 'good enough' and sufficient for displaying UI elements, it's not enough for adequate treatment of more elaborate texts, for which users have need and desire to be able to display them vertically. This includes wide range of applications, ranging from reading long runs of text, to browsing web pages prepared for vertical display, to WYSIWYG document processing. Additionally, there exist scripts, such as traditional Mongolian, for which no solution exists for writing them horizontally, and which require vertical writing before any kind of support for them can be added.
Today, the vertical writing support is limited to specialised applications, such as word-processors, which need to implement special modes in order to allow vertical text, often with need of significant user intervention before appropriate display of mixed text is obtained. There is little or no support for free-flow display of vertical and mixed text, and none of widely available user interfaces offer it. One traditional obstacle was lack of integrated and agreed-upon approach towards treatment of vertical text, and widespread perception that it's inherently difficult and impossible to implement within existing text frameworks oriented towards horizontal text, similar to BiDi situation a few years ago. However, with work progressing on a CSS3 proposal in W3C and related workgroups, it became apparent that vertical text can and should be treated comprehensively within existing solutions, with relatively minor and well-defined changes to the core logic. It also becomes necessary, as with CSS3 nearing completion, for the first time in computing history the vertical scripts have a chance of getting proper support from standards, and consequently, widespread adoption in publicly-available documents and World Wide Web.
Goals and deliverables
The project would consist of implementation of vertical writing support within the Pango library, according to the Unicode Technical Note #22, available at:
The tasks would include:
- Evaluation of existing APIs and necessary extension points for vertical text
- Draft of new APIs needed
- Code audit of existing shapers and language engines for their compatibility with vertical rendering
Initial naïve implementation of vertical rendering without support for mixed or BiDi text
Adjustments of the existing BiDi algorithm in the context of vertical text, as outlined in TN#22
- Testing and debugging, and porting of existing language engines and shapers (if deemed necessary by code audit)
- Preparing new APIs for consumption by higher-level GUI toolkits, particularly GTK+. This includes end-user docs and implementation of any missing APIs, such as protocol to allow higher layers to hint about preferred direction, user overrides, etc.
The desired end-goal is API and implementation suitable as the basis of vertical UI in client GUI toolkits, particularly allowing GTK+ to offer vertical text-aware widgets in a subsequent release.
- High-level logic regarding layout of multi-paragraph text. Pango naturally works on a paragraph basis, and should not try to determine base direction or multi-paragraph layout by itself, instead relying on a user, such as a GUI toolkit. Part of it may be a protocol for assisted layout, in situations such as mixed Japanese-Mongolian text, where subsequent paragraphs or even lines may run in opposite directions (right-to-left and left-to-right, respectively).
I intend to start working in the second half of May (week 20). First and start of the second task will take around a week, at which point it'll be possible to start working on task 4, which will take one to one and a half week. Initial implementation and API draft will give enough insight to perform meaningful code audit of existing modules, which should hopefully be ready for use in vertical rendering, with minor or no changes necessary. At the end of week 23 task 3 and 4 should be completed, allowing work on subsequent tasks. Each of tasks 5, 6 and 7 should take around a week, leaving about a week or two out of projected 8-9 weeks schedule for bugfixing and tying loose ends. About 4-5 weeks out of total 13 before the deadline are left aside for unrelated tasks, such as university exams and being with the family.
I am a graduate student in Computer Science, currently on an exchange programme studying at Syddansk Universitet, Denmark. I've been programming since elementary school, and involved in Open Source since high school. I've been involved in GTK+ and GNOME programming for a long time, with occasional patches contributed. I have also written a series of GTK+-related articles for IBM developerWorks, with some of them already published.
My personal interest in Pango work stems from my other hobby, natural languages, and vertical writing is particularly important to me as a Japanese language learner. I've always missed useful support for vertical text in my toolkit of choice, and was wanting to work on it for a long time.