After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 515432 - Add function to get bidirectional character type of a unicode character
Add function to get bidirectional character type of a unicode character
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.19.x
Other All
: Normal enhancement
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2008-02-09 16:18 UTC by Jürg Billeter
Modified: 2008-04-21 23:56 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Proposed patch (6.41 KB, patch)
2008-04-21 18:48 UTC, Jürg Billeter
none Details | Review

Description Jürg Billeter 2008-02-09 16:18:03 UTC
There is currently no API in Pango to get the bidirectional character type of a unicode character (section 3.2 in UAX #9), pango_unichar_direction() only returns the direction, not the exact character type.

Pango already has access to this information by using fribidi_get_type(), so it should be easy to add a corresponding function to the API. This function would make it possible to replace the ICU dependency in WebKit GTK+ by GLib and Pango without an additional dependency on fribidi.
Comment 1 Behdad Esfahbod 2008-02-09 17:46:17 UTC
Fair enough.  When adding that, we should add a bidi-type iterator too...
Comment 2 alp 2008-04-19 06:20:21 UTC
This bug is blocking http://bugs.webkit.org/show_bug.cgi?id=15914

If this isn't going to happen for 2.24 we should consider proposing ICU as an external dependency ASAP.
Comment 3 Behdad Esfahbod 2008-04-19 20:36:49 UTC
I may add this tomorrow, so it makes it to the pango release on monday.
Comment 4 Behdad Esfahbod 2008-04-21 17:27:37 UTC
Umm, feel a bit lazy doing this today.  Can someone cook a patch?

Put it in pango-bidi-types.[hc], adding enum PangoBidiType that copies name and order from http://www.unicode.org/reports/tr9/.  Then use a switch to convert from fribidi types.  Then add pango_bidi_type_for_unichar().

For bonus, do an iterator ala pango_script_iter_*() on it.  But that can be added later.

Thanks.
Comment 5 Jürg Billeter 2008-04-21 18:48:05 UTC
Created attachment 109643 [details] [review]
Proposed patch

Does that look ok?
Comment 6 Behdad Esfahbod 2008-04-21 18:59:46 UTC
I can work it out from there.  Thanks!
Comment 7 Behdad Esfahbod 2008-04-21 23:56:18 UTC
2008-04-21  Behdad Esfahbod  <behdad@gnome.org>

        Bug 515432 – Add function to get bidirectional character type of a
        unicode character
        Patch from Jürg Billeter

        * docs/pango-sections.txt:
        * docs/tmpl/layout.sgml:
        * docs/tmpl/main.sgml:
        * docs/tmpl/pangocairo.sgml:
        * pango/Makefile.am:
        * pango/pango-bidi-type.c (pango_bidi_type_for_unichar):
        * pango/pango-bidi-type.h:
        * pango/pango-types.h:
        * pango/pango-utils.c (pango_log2vis_get_embedding_levels),
        (pango_unichar_direction):
        * pango/pango.def:
        * pango/pango.h:
        New public API:

                enum PangoBidiType;
                pango_bidi_type_get_type()
                pango_bidi_type_for_unichar()