Bug 71937 - gdm word wrap problem for CJK
Summary: gdm word wrap problem for CJK
Alias: None
Product: Red Hat Public Beta
Classification: Retired
Component: gdm (Show other bugs)
(Show other bugs)
Version: null
Hardware: All Linux
Target Milestone: ---
Assignee: Havoc Pennington
QA Contact: Mike McLean
Depends On:
Blocks: 67218
TreeView+ depends on / blocked
Reported: 2002-08-20 12:30 UTC by Nakai
Modified: 2007-04-18 16:45 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2002-08-28 22:25:56 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Nakai 2002-08-20 12:30:35 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020528

Description of problem:
When I input wrong username or password into gdm, it will
show up the long error message on the root window, but
it won't word wrap for CJK strings, so users cannot see
the whole error message.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Use gdm in Japanese mode
2.Input wrong username/password
3.error messsage is too wide

Actual Results:  No word wrap

Expected Results:  It should word wrap

Additional info:

Comment 1 Havoc Pennington 2002-08-21 23:14:15 UTC
Probably just a matter of pango_layout_set_width() on the relevant PangoLayout

Comment 2 George Lebl 2002-08-25 19:02:51 UTC
Perhaps it's just the redhat theme, to me it seems nothing is cut off (but I
can't read japanese so I can't really tell) ... try it with the circles theme.

Comment 3 Havoc Pennington 2002-08-25 19:28:51 UTC
jrb said there was a way to handle this in the theme - alex do you remember how
to do it? we need to let garrett know.

Comment 4 Alexander Larsson 2002-08-26 18:20:35 UTC
I don't understand why it's wrapping the english string but not the japanese.

Comment 5 Havoc Pennington 2002-08-26 18:31:27 UTC
maybe the japanese text is just longer without good word breaks? German also
overflows the boxes.

the fix I had in mind was a way to grow the boxes in the theme as the text grows.

Comment 6 Alexander Larsson 2002-08-26 18:34:39 UTC
Hmm? Isn't the problem already that the box grows to much?
I tried to set the width on the pam-error text, but that didn't seem to help.

Comment 7 Havoc Pennington 2002-08-26 18:47:41 UTC
maybe pango just doesn't word wrap for japanese at all?

Comment 8 Nakai 2002-08-27 04:47:45 UTC
Japanese sentence doesn't need any white space even if it's long.

Comment 9 Havoc Pennington 2002-08-27 04:55:46 UTC
Right but Pango's word wrap code is way more complicated than just a whitespace
thing. It has special cases for Japanese as recommended by the Unicode book.

Maybe look at pango/pango/break.c and see if it is working correctly. Does it work 
in message and error dialogs? If it works there it should work in gdm, if gdm
enables word wrap.

The relevant pango code is:

            case G_UNICODE_OTHER_LETTER:
              if (current_word_type == WordLetters)
                  /* Japanese special cases for ending the word */
                  if (JAPANESE (last_word_letter) ||
                      JAPANESE (wc))
                      if ((HIRAGANA (last_word_letter) &&
                           !HIRAGANA (wc)) ||
                          (KATAKANA (last_word_letter) &&
                           !(KATAKANA (wc) || HIRAGANA (wc))) ||
                          (KANJI (last_word_letter) &&
                           !(HIRAGANA (wc) || KANJI (wc))) ||
                          (JAPANESE (last_word_letter) &&
                           !JAPANESE (wc)) ||
                          (!JAPANESE (last_word_letter) &&
                           JAPANESE (wc)))
                        attrs[i].is_word_end = TRUE;

Comment 10 Havoc Pennington 2002-08-28 21:18:51 UTC
Eh, bad alex - not using Pango. I'm working on a hack here.

static char *
break_at (const char *orig, int len)
  char *text, *p, *newline;
  int i;

  text = g_strdup (orig);
  p = text;
  while (strlen (p) > len)
      newline = strchr (p, '\n');
      if (newline &&
	  ((newline - p) < len))
	  p = newline + 1;

      for (i = MIN (len, strlen (p)-1); i > 0; i--)
	  if (p[i] == ' ')
	      p[i] = '\n';
	      p = p + i + 1;
	      goto out;
      /* No place to break. give up */
      p = p + 80;
  return text;

Comment 11 Havoc Pennington 2002-08-28 22:25:49 UTC should fix.

Comment 12 Jay Turner 2002-09-03 20:03:56 UTC
Fix confirmed with gdm-

Note You need to log in before you can comment on or make changes to this bug.