Re: AtkText attributes
- From: Peter Korn <peter korn sun com>
- To: Brian Cameron <Brian Cameron sun com>
- Cc: gnome-accessibility-list gnome org
- Subject: Re: AtkText attributes
- Date: Thu, 24 May 2001 14:58:14 -0700
Hi Brian,
> > ...
> > > I call the function saying I am interested in the text from 18-21. I
> > > am returned perhaps an array of two structures which have the
> > > following info:
> > >
> > > struct[0]->attribute = font
> > > struct[0]->value = times
> > > struct[0]->start = 0
> > > struct[0]->end = 26
> > > struct[1]->attribute = style
> > > struct[1]->value = italics
> > > struct[1]->start = 11
> > > struct[1]->end = 21
> > >
> > > Using this data it is very easy for me to see what attributes apply to
> > > the text that I am interested in. I can quickly see that the font
> > > attribute applies to all of the text between 18-21 and that the italics
> > > style applies to just 18-21.
> > >
> > > Does this seem like an overly burdened interface to you?
> >
> > Your approach returns an array of unknown size that has to be allocated and
> > thende-allocated. When if we've got a ransom letter, every character a
> > different font (or some other attribute). I ask for a range [0-500]. I now
> > get a huge struct back. Especially again in the Java case, where we don't
> > support range info, every situation will look like a ransom letter.
>
> Isn't this the same with your proposal too? Your example above where the
> "attrStruct returned would give you the information "font times, bold, italic,
> 12-point" would also require an array of name,value structures wouldn't it?
> Or are you proposing returning a string that has all the name value pairs
> separated by commas? I mean you could return the range info this way too.
> "font times start end, style bold start end, style italic start end" would
> similiarly avoid requiring a structure that needs allocation/deallocation.
> Perhaps I'm missing something here.
Ok. I'm suggesting we return an attribute struct that looks more or less like
this.
GetAttributeStruct {
int startIndex;
int endIndex;
boolean isBold;
boolean isItalic;
...
char *fontName;
int (or maybe char *) fontSize; // char * if we deal with fractional nos.
char *attributeStr; // full string form, including attrs not
} in our boolean list
Yes we're returning a struct, but it's one that can be allocated on the stack by
the caller. We're not malloc-ing an array of potentially very large size.
Does this proposal make more sense now?
Peter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]