Future gtk-text widget



I did some brainstorming on what I would like to see in a future
gtk text widget. I think that now is a good time to discuss these
issues before coding actuall starts. (Or did you start already, Owen?).

Personally I'm especially interested in working on Bi-Directional 
support of the widget.

Notes about an ideal text widget
================================

* The internal representation of the text widget is Unicode.

* It should be possible to toggle the display of "invisible" unicode
  characters - e.g. zero-width-space, left-to-right-mark, left-to-right-
  override, etc..

* The widget should support all BiDirectional aspects, including 
  display, cursor movement, and selections. 

* The text widget should allow embedding of external objects, especially
  images but more generally any gtk widget. The alignment of any embedded
  object should be specifiable.

* Input of unicode characters is taken care of by X.

* The text widget should support the idea of tags that span a certain 
  text range. (Idea borrowed from the Tk text widget). 

* The tags define the following properties (and possibly lots of other
  properties):

    - Background color.
    - Background pixmap.
    - Foreground color.
    - Relief(?)
    - Unicode chars to font mapping.

  (Once the tag system is established it shouldn't be too difficult to
  add arbitrary mouse bindings to a tag as well.)

* Copy and paste within and between two text-widgets (including if
  they are belonging to different processes) should preserve and
  copy the tags. (Is this at all possible for plain gtk without GNOME?)

* The Unicode chars to font mapping needs more explanation. The idea is
  that it should be possible to map different ranges of unicode characters 
  to a different font. E.g. to use "Helvetica" for the ISO-Latin-1
  range and the font web1 for Hebrew characters the following tag may 
  be defined:

    Tag: {
       Name => "latin1+hebrew",
       Background => "yellow",
       Foreground => "red3",
      
       Fontmap => 
       {
           {
               Font=>        "-*-helvetica-medium-r-*-*-*-160-*-*-*-*-*-1",
               Mapping=> {
                   From=>    {U+0021..U+007E, U+00A0..U+00FF},
                   To=>      {0x21..0x7E, 0xA0..0xFF}
               }
           },
           {
               Font=>        "-*-web1-medium-r-*-*-*-160-*-*-*-*-*-8",
               Mapping=> {
                   From=>    {U+05D0..U+05EA},
                   To=>      {0xE0..0xFA}
               }
           }
       }
    }

  A syntax for efficiently defining these tags needs to be established.
     
* A tag may inherit from a different tag and overload a subset of 
  properties.

* A special tag always spans the whole text widget and by changing the
  attributes of this tag, the default attributes of the text widget is
  changed.

* Another special tag defines the attributes of selected text. 

* It should be possible to import and export a XML representation of the
  entire contents of the text widget.

* The concept of tag may be used for l10n as well by making it possible
  to define a fontmap in the gtkrc file so that the gettext resource files
  can be interpreted in Unicode and displayed in the desired font for 
  all widgets with default widgets that display text.

  (How are the l10n concerns that are addressed in the latest version of the
  perl journal addressed btw? There it is basically claimed that the static
  gettext method don't work for a lot of languages of the world! The
  article defines a way of writing subroutines that given a set of
  paremeters returns a resolved string.)

--Dov



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]