GNOME Bugzilla – Bug 323173
Add layout of mixed direction text for vertical layout
Last modified: 2007-01-16 00:25:27 UTC
Splitting bug 99523. Phase two is adding proper support for more interesting layout, as per Unicode's tn22. We should be able to correctly layout vertical text, containig mix-ins of Latin, Arabic, etc., as well as different directionality vertical (Mongolian with Japanese). To do that, we need: 1) bug 323172 2) expand bidi algorithm from UAX#9 to cover vertical case (details in tn22). Will also need adding hints on preferred rotation for natively horizontal text. 3) probably some more hacking to make lines flow work in case of Mongolian meeting some other vertical script
I decided to go by not changing the bidi algorithm directly, but patching its result by changing resolved levels afterwards. The main complexion of this approach is to correctly update line direction, but I think we can handle that too. I've made per-item gravity work already. All remaining is to correctly assign gravity to items based on context gravity, script, and gravity hints.
Created attachment 71275 [details] [review] Gravity resolution logic for foreign scripts inlining This is the core logic only, stripped of everything else, so I don't expect it to compile.
Created attachment 71301 [details] [review] Cleaned up patch to implement per-item gravity resolution A cleaned up version, with all comments implemented, should be good to commit
Thanks mathrick. Please attach the data table.
http://mces.blogspot.com/2006/08/vertical-pango-updates.html
From Ed Trager: Here's a fragment of Japanese text: ... 衆参両院に特別委員会を設置し、2006年度予算案成立後の月末以降に ... In tate nake yoko layout, the section with the year would look like: . . . 設 置 し 、 2006 年 度 予 算 . . . As far as I am aware, this is most often used, as shown here, for printing years. I would suppose that 2- or 3-digit numbers could also be layed out this way. It is probably obvious that the "2006" is composed of regular width, not full-width characters since one certainly doesn't want to use up to much space. Maybe they use a narrow font for the digits, I don't know. I'm definitely not a Japanese expert: we would need to talk to a native Japanese or Japanese expert to understand how common this is in modern printed Japanese media compared to the vertical layout option shown on your blog or compared to simply turning "2006" on its side.
The effect in Ed's example should require markup. In HTML+CSS, it would be handled by putting an element around the date and turning it into an inline-block; from the paragraph's point of view, that date would be only a box, just like an image.
(In reply to comment #7) > The effect in Ed's example should require markup. In HTML+CSS, it would be > handled by putting an element around the date and turning it into an > inline-block; from the paragraph's point of view, that date would be only a > box, just like an image. Ok, perfect.
Created attachment 74215 [details] Script directions table Looks like I forgot the table. Here it is.
2007-01-15 Behdad Esfahbod <behdad@gnome.org> Bug 323173 – Add layout of mixed direction text for vertical layout * pango/pango-gravity.h: * pango/pango-gravity.c: Moved gravity stuff here. New public API: PangoGravityHint pango_gravity_get_for_matrix() pango_gravity_get_for_script() * pango/pango-context.h: * pango/pango-context.c (pango_context_init), (update_resolved_gravity), (itemize_state_update_for_new_run): Support gravity hint. New public API: pango_context_set_gravity_hint() pango_context_get_gravity_hint() * pango/pango-utils.c: * pango/pango-matrix.c: * pango/pango-matrix.h: * pango/pango-types.h: Moved gravity and matrix stuff into its own header. pango-types.h includes both pango-matrix.h and pango-gravity.h * pango/pango.h: Include new headers. * pango/pango.def: * pango/Makefile.am: Update. * docs/pango-docs.sgml: * docs/pango-sections.txt: * docs/tmpl/glyphs.sgml: * docs/tmpl/main.sgml: * docs/tmpl/vertical.sgml: Add a section for Vertical Text. * examples/renderdemo.c (do_output), (parse_gravity_hint), (parse_options): Support gravity hint. * examples/test-mixed.txt: New test, mixed Latin, Arabic, Chinese text.