GNOME Bugzilla – Bug 377085
family-name text attribute is malformed for multi-word family names
Last modified: 2006-11-23 00:09:36 UTC
As has been discussed in Bug #372964, the family-name text attribute is being incorrectly formatted for multi-word family names. For example: 'family-name:DejaVu', 'Sans', 'Mono;' Passing along Rich's comment (http://bugzilla.gnome.org/show_bug.cgi?id=372964#c15): ----- Tell 'em the problem is around line 611 in .../gail/libgail-util/gailmisc.c: case ATK_TEXT_ATTR_FAMILY_NAME: value = g_strdup (pango_font_description_get_family (attrs->font)); break; The string returned by pango_font_description_get_family() needs to be munged into the correct format as the font name might have spaces in it. Maybe: case ATK_TEXT_ATTR_FAMILY_NAME: value = g_strdup_printf ("%s", pango_font_description_get_family (attrs->font)); break; Maybe. I dunno. I didn't try testing it. ----- Thanks!!
Reassigning to Padraig as Bill is in China this week. Thanks.
Can you provide a test case for this bug?
Created attachment 76981 [details] Python script to help show the problem. The attached Python script has a comment section at the beginning, given full details on how to reproduce the problem. I'll also include them below. I've just added a bit of debug into the version of Orca from CVS HEAD, so you will need to configure, build and run that to easily see how the text attribute string is incorrect. Note that if you have never run Orca before, then you initially won't have a ~/.orca/user-settings.py file. You will first need to run Orca in setup mode to create that. % orca -t is probably the best way to do this. For the purpose of testing this bug, you can answer the questions however you want. Here are the comments from the bug_377085.py script: """Bug reproducer for bug 377085. This standalone module talks directly with the AT-SPI Registry via its IDL interfaces. No Orca logic or code is stuck in the middle. To run this module, merely type 'python bug_377085.py' in an xterm. Steps to Reproduce: 1. Via the desktop menu Preferences->Font menu item, change your Application font and the Fixed width font to something with spaces in it like "Monotype Century Schoolbook". 2. Run gedit 3. Run the attached standalone python application in an xterm 4. Click in the gedit window to give it focus. 5. Press F11. 6. Press F12 to terminate the python application. Results: In the xterm window, you will see all a lot of information about all the text in the gedit application. There will be entries like: ... Text (len=7): Replace attributes: left-margin:0; right-margin:0; indent:0; invisible:false; editable:false; pixels-above-lines:0; pixels-below-lines:0; pixels-inside-wrap:0; bg-full-height:0; scale:1; rise:0; underline:none; strikethrough:false; bg-stipple:false; fg-stipple:false; fg-color:0,0,0; bg-color:65535,65535,65535; wrap-mode:word; justification:left; size:10; weight:400; family-name:Monotype Century Schoolbook; stretch:normal; variant:normal; style:normal; language:c; direction:ltr line (start=0, end=7, x=492, y=111, width=45, height=17): Replace ... You will see that the family-name text attribute is of the form: "<key>:<value>;" (i.e. family-name:Monotype Century Schoolbook;). This is correct. The problem is that when the equivalent call is done in Orca, the text attribute string returned is malformed. To recreate in Orca, run the following: 1. Via the desktop menu Preferences->Font menu item, change your Application font and the Fixed width font to something with spaces in it like "Monotype Century Schoolbook". 2. Build Orca from CVS HEAD. % cvs co orca % cd orca % ./autogen.sh --prefix=/usr % make % sudo make install 3. In your Orca user settings file (~/.orca/user-settings.py), make sure the following two lines are uncommented (i.e. no initial "#" character): orca.debug.debugLevel = orca.debug.LEVEL_FINEST orca.debug.debugFile = open('debug.out', 'w', 0) 4. Run gedit 5. Run Orca in an xterm 6. Click in the gedit window to give it focus. 7. Type Insert-f 8. To quit Orca, type Insert-q and click on the "Yes" button in the popup window that is displayed. There will be a "debug.out" file in the directory where you started Orca. Open it in an editor. Search for "readCharAttributes". You will see debug output of the form: readCharAttributes: default text attributes: left-margin:2; right-margin:2; indent:0; invisible:false; editable:true; pixels-above-lines:0; pixels-below-lines:0; pixels-inside-wrap:0; bg-full-height:false; rise:0; underline:none; strikethrough:false; size:8; scale:1; weight:400; language:c; family-name:Monospace; bg-color:65535,65535,65535; fg-color:0,0,0; bg-stipple:false; fg-stipple:false; wrap-mode:word; direction:ltr; justification:left; stretch:normal; variant:normal; style:normal You will see that the family-name text attribute malformed: family-name:Monospace; This is incorrect. """
Is the complaint that it is malformed or is it that it is just wrong? What value are you expecting for family-name?
Nothing appears to happen when I run python bug_377085.py in an xterm when I press F11.
If I start gedit after the python script I get data spewed in the xterm window. I see that the text typed into the window has family-name Monosp[ace and some other text with len= 0 has family-name Monotype Century Schoolbook.
The interesting part of bug #372964 is comment #9 Here's what the text attributes look like when we get them in Orca. ['left-margin:2;', 'right-margin:2;', 'indent:0;', 'invisible:false;', 'editable:true;', 'pixels-above-lines:0;', 'pixels-below-lines:5;', 'pixels-inside-wrap:0;', 'bg-full-height:false;', 'rise:0;', 'underline:none;', 'strikethrough:false;', 'size:10;', 'scale:1;', 'weight:400;', 'language:en-us;', 'family-name:DejaVu', 'Sans;', 'bg-color:65535,65535,65535;', 'fg-color:0,0,0;', 'bg-stipple:false;', 'fg-stipple:false;', 'wrap-mode:none;', 'direction:ltr;', 'justification:left;', 'stretch:normal;', 'variant:normal;', 'style:normal'] The malformed one is: 'family-name:DejaVu', 'Sans;', I believe this should be deliver as a single <key>:<value>; entity, namely: 'family-name:DejaVu Sans;',
I have been building some packages in the background when I ran the previous test which may have caused some strange behavior. In gedit I chose Edit | Preferences. In gedit Preferences dialog I chose Fonts and Colors and changed the editor font to Monotype Century Schoolbook. Now when I run the test I see readCharAttributes: default text attributes: left-margin:2; right-margin:2; inde nt:0; invisible:false; editable:true; pixels-above-lines:0; pixels-below-lines:0 ; pixels-inside-wrap:0; bg-full-height:false; rise:0; underline:none; strikethro ugh:false; size:12; scale:1; weight:400; language:c; family-name:Monotype Centur y Schoolbook; bg-color:65535,65535,65535; fg-color:0,0,0; bg-stipple:false; fg-s tipple:false; wrap-mode:word; direction:ltr; justification:left; stretch:normal; variant:normal; style:normal This seems to be formed correctly. I do not have DejaVu Sans font on my system. I have not seen any evidence yet that there is a bug in gail.
Joanie, would you like to step in here. You are the one seeing this problem on Ubuntu Fiesty Fawn with gaim 2.0.0beta5. Can you give Padraig a reliable test case please? Thanks.
Padraig, it looks like we owe you an apology. Joanie did a little more detective work and worked out that this is indeed an Orca bug, not a gail problem. Transferring the bug to me. Sorry for all the inconvenience caused.
Joanie, found the offending line. It's the: allTokens = str.split() line in the textAttrsToDictionary() routine in default.py. This is spliting the string into tokens using whitespace as the separator. It really should use the ";" character. I'll create a patch for testing...
Created attachment 77042 [details] [review] Patch to hopefully fix the problem. I haven't checked the patch in. Joanie, could you give it a test and let me know if it solves the problem of reporting fonts with spaces in their names. Thanks.
Padraig: I'm afraid I jumped to an erroneous conclusion which made it seem like a gail problem. I should have thought things through first. I'm really sorry! Rich: That does seem to solve the problem. Given my track record today, here's proof: ;-) vvvvv PROCESS KEY PRESS EVENT f vvvvv readCharAttributes: default text attributes: left-margin:2; right-margin:2; indent:0; invisible:false; editable:true; pixels-above-lines:0; pixels-below-lines:0; pixels-inside-wrap:0; bg-full-height:false; rise:0; underline:none; strikethrough:false; size:12; scale:1; weight:400; language:en-us; family-name:DejaVu Sans Mono; bg-color:65535,65535,65535; fg-color:0,0,0; bg-stipple:false; fg-stipple:false; wrap-mode:word; direction:ltr; justification:left; stretch:normal; variant:normal; style:normal SPEECH OUTPUT: ' family-name DejaVu Sans Mono' ^^^^^ PROCESS KEY PRESS EVENT f ^^^^^
Thanks Joanie. I've checked the fix into CVS HEAD and am closing the bug as FIXED.