discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to know the geometry of a string on the screen ?


From: Bertrand Gmail
Subject: Re: How to know the geometry of a string on the screen ?
Date: Fri, 27 Oct 2017 21:34:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1



Le 27/10/2017 à 20:36, Josh Freeman a écrit :
I think you meant to use 'string', not '[NSString string]' - the latter returns an empty string.

stringSize=[[NSString string] sizeWithAttributes:attributes];
  ->
stringSize=[string sizeWithAttributes:attributes];

I introduced  [NSString string] because of this warning at compile time :

GSPanel.m:75:23: warning: 'NSMutableAttributedString' may not respond to
      'sizeWithAttributes:'
   stringSize=[string sizeWithAttributes:attributes];

And the executable doesn't work.


Alternatively, since string's an NSAttributedString:

stringSize=[string sizeWithAttributes:attributes];
  ->
stringSize=[string size];

This works. So simple ! Thanks a lot.

Bertrand



reply via email to

[Prev in Thread] Current Thread [Next in Thread]