Re: [MacPerl-Toolbox] Re: TESetStyle problem
[email protected] (Matthias Neeracher) 14 May 2001 05:42:28 +0200
| Newsgroups | perl.macperl.toolbox |
|---|---|
| Message-ID | <[email protected]> |
In article <p05010400b722c60468b0@[158.152.146.73]>, Alan Fry <[email protected]> writes: > I think there is definitely something wrong with the TextEdit.xs in > relation to TextStyle. Specifically if a 'style field' is invoked > with: > However the paramenters returned by TEGetStyle() do not: > ($text_style, $height, $ascent) = TEGetStyle(0, $hte); > print $text_style, "\n"; returns TextStyle=SCALAR(0x3335a64) > print $text_style->tsFont, "\n"; returns 1 OK > print $text_style->tsFace, "\n"; returns 0 OK > print $text_style->tsSize, "\n"; returns 0 not OK > print $text_style->tsColor, "\n"; returns RGBColor=SCALAR(0x3335a70) > The value of tsSize is certainly wrong since the actual font size was > 12 0 can sometimes stand for the default Application font size, which could very well be 12. > Moreover RGBColor does not behave as expected since: > print $text_style->tsColor->red, "\n"; returns 0 OK (text was black) > $text_style->tsColor->red(65535); Well, that is one limitation of my struct approach: The RGBColor returned by tsColor is a copy, so to set it, you'd need to call: $text_color = $text_style->tsColor; $text_color->red(65535); $text_style->tsColor($text_color); Your code is equivalent to inly the first two of these lines. > TESetStyle(doAll, $text_style, 1, $hte); > using the value of $text_style from TEGetStyle() fails returning 'undef'. Hmm. Can you file a bug on that? I'll need to investigate further. > The only thing I can see is that TextEdit.xs for TESetStyle() has: > void > TESetStyle(mode, newStyle, fRedraw, hTE) > short mode > TextStyle &newStyle > Boolean fRedraw > TEHandle hTE > whereas TextEdit.h defines it as: > TESetStyle( > short mode, > const TextStyle * newStyle, > Boolean fRedraw, > TEHandle hTE) > Is that significant? No, this is typical XS jargon for a parameter passed in by value which needs to passed further by reference. Matthias -- Matthias Neeracher <[email protected]> http://www.iis.ee.ethz.ch/~neeri "And that's why I am going to turn this world upside down, and make of it a fire so *bright* that someone real will notice" -- Vernor Vinge, _Tatja Grimm's World_