Re: [gtk-list] Re: Label layout




Jeff Dairiki <dairiki@mac-ceope.apl.washington.edu> writes:

> I have (slowly and privately) been working on patches to gtklabel to
> do just this (ie implemement GTK_JUSTIFY_FILL.)  I think my hacks are
> to the point where they work pretty well, so I will post/upload my
> patches tonight or maybe tomorrow night (at the latest) for your
> perusal.

I've taken a look at your label patch some. (I haven't investigated
the tooltips part yet.)

A few comments:

- I think GTK_JUSTIFY_FILL has been hijacked. That is, it should
  only specify full justification. (Actually, the whole thing is
  a (commonly accepted) abuse of terminology. Text can be set:
 
  Justified
  Flush left/ragged right 
  Flush right/ragged left

  See Robert Binghurst's _Elements of Typographic Style_)

  There should be a separate flag (break_lines?) to control whether
  the text should be automatically be line-broken or not. This is
  especially important becaues often labels will be too narrow to look good
  filled - so line breaking without filling is quite desirable.

- The vertical space between paragraphs is too large. If there is
  any extra space at all, it should just be a few pixels.

- I don't think any extra space should be added between sentences.
  This is a holdover from Victorian typographic horrors and from
  bad typewriter manuals. (See the above reference). (Plus, this
  would avoid having to use double spaces to mark sentence
  boundaries.)

- There are a few stylistic points in the code that need to be
  fixed up. In particular:

    if (blah)
      do_blah ();
    ^^ two spaces not four.


    GtkLabelWord *word, **tailp;
    gint space_width, line_width, max_line_width;
    const gchar *break_chars, *str;

  is better written as:

    GtkLabelWord *word;
    GtkLabelWord **tailp;
    gint space_width;
    gint line_width;
    gint max_line_width;
    const gchar *break_chars;
    const gchar *str;

  The static function declarations at the top of the file should
  be kept aligned.

  (Not to say that they is any major problem - In general the
  coding style is in excellent conformance with the GTK style - better
  than quite a bit of code in there now)

- The line breaking probably won't work very well for
  internationalized text. Probably not worth worrying about much 
  now. Eventually, we may want to go to using an internal wide
  character representation (Unicode probably) for all text, and
  have some standard utility functions to do word breaking, etc.

Regards,
                                        Owen





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