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 377085 - family-name text attribute is malformed for multi-word family names
family-name text attribute is malformed for multi-word family names
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: general
0.2.x
Other All
: Normal normal
: ---
Assigned To: Rich Burridge
bill.haneman
Depends on:
Blocks:
 
 
Reported: 2006-11-19 18:25 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2006-11-23 00:09 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Python script to help show the problem. (18.73 KB, text/plain)
2006-11-21 16:35 UTC, Rich Burridge
  Details
Patch to hopefully fix the problem. (734 bytes, patch)
2006-11-22 22:19 UTC, Rich Burridge
none Details | Review

Description Joanmarie Diggs (IRC: joanie) 2006-11-19 18:25:50 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!!
Comment 1 Rich Burridge 2006-11-19 19:43:11 UTC
Reassigning to Padraig as Bill is in China this week. Thanks.
Comment 2 padraig.obriain 2006-11-21 08:47:59 UTC
Can you provide a test case for this bug?
Comment 3 Rich Burridge 2006-11-21 16:35:27 UTC
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.

"""
Comment 4 padraig.obriain 2006-11-22 10:13:20 UTC
Is the complaint that it is malformed or is it that it is just wrong?

What value are you expecting for family-name?
Comment 5 padraig.obriain 2006-11-22 11:50:25 UTC
Nothing appears to happen when I run python bug_377085.py in an xterm when I press F11.
Comment 6 padraig.obriain 2006-11-22 12:51:52 UTC
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.
Comment 7 Rich Burridge 2006-11-22 15:36:12 UTC
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;',
Comment 8 padraig.obriain 2006-11-22 16:39:43 UTC
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.
Comment 9 Rich Burridge 2006-11-22 17:46:02 UTC
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.
Comment 10 Rich Burridge 2006-11-22 22:05:38 UTC
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.
Comment 11 Rich Burridge 2006-11-22 22:08:15 UTC
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...
Comment 12 Rich Burridge 2006-11-22 22:19:36 UTC
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.
Comment 13 Joanmarie Diggs (IRC: joanie) 2006-11-22 22:41:37 UTC
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 ^^^^^
Comment 14 Rich Burridge 2006-11-23 00:09:36 UTC
Thanks Joanie. I've checked the fix into CVS HEAD 
and am closing the bug as FIXED.