Cocoa text auto-scale?

Is there a way to get a text label or similar object to auto-scale with the container window? That is, as the window grows, I want the text size to grow to fill all available space without clipping, and to shrink back down again as the window shrinks. I'm sure I could do some sort of calculation based on font metrics and the displayed string to figure out the best size based on the window, and then somehow tie that into when the user resizes the window, but is there a better/easier method? Thanks.

RayNewbie wrote:
I would register for the [NSWindowDidResizeNotification|http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Application Kit/Classes/NSWindowClass/Reference/Reference.html#//appleref/doc/uid/20000013-BCIIHIHC], which is posted continuously as the window is resized.
This seems to work perfectly to get the visual result, and is precisely what I was thinking of. Thanks.
RayNewbie wrote:
In any case, this Wil Shipley blog might be of interest to you. Note the example code seems to be manually calculating the point size: [Pimp My Code, Part 6: The Pimp Before Christmas|http://www.wilshipley.com/blog/2005/12/pimp-my-code-part-6-pimp-before.html].
Definitely helpful, primarily in that their method of calculating the font size is noticeably more efficient than what I had come up with. Still inefficient though- processor usage spikes to around 50% on my mac mini 2.0 core2duo machine when resizing the window. I suppose it might not be too big a deal, but I'd hate to see window resizing lag on slower or more heavily loaded machines. I'm not sure there's much choice when doing a live resize, however- waiting to resize the text until the window resize is completed would look horrible.
Hope that helps!
\- Ray

Similar Messages

  • How do I turn off auto scale text to fit?

    how do I turn off auto scale to fit slide or box?  There used to be a check box in the tool bar of previous versions. can't find it now.

    Use the text tool in the menu bar to create a custom text box. Cutom text does not use the text auto sizing feature.

  • Text auto-correction is turning on again!

    Hi all!
    My iPhone4 is running iOS 5.0.1 and I'm very happy!
    But it recently turns text auto-correction on. I turn it off, but sometime later I found it turned on again
    I can't understand what causes it to do this. How can I turn this feature absolutely off?

    What troubleshooting have you tried over these few days? You charging the phone? Try a reset. Hold the sleep/wake and home buttons together until you see the Apple logo and then release. The phone should reboot. This can take up to 60 seconds.

  • Xy Graph Auto Scale Bug - Need AutoScale VI

    I have another bug to report, I have come across more bugs in the past year than before.
    This bug is present in all versions since 7.1 to the latest 8.5.
    Here is the bug.
    Create and Graph.
    Make sure the X-Scale is set to Auto Scale.
    Go to Properties and Choose "Formatting and Representation" and Choose Relative Time for X-Axis . Select HH:MM. 
    Click OK
    Now Set the scale to say 20 Hours. You Should see 10 Divisions of X-Axis
    Right Click on the Graph and Select "Scale Object with Pane"
    Maximize the VI now.
    The Graph will scale nicely!!
    Look at the X- Axis Scale. It is 20 Hours.
    What happened to the 10 Divisions? It is one big Division of 20 Hours.!! Why?
    Set the Scale to 10 Hours and all the divisions reappear!!
    Restore the VI window to Previous and Now All divisions of the scale are gone.
    This Behavior is random based on the size of the graph and Screen resolution.
    Can someone suggest a VI that does Auto Scaling elegantly
    Attached find Pictures of the Phenomenon and VI which exhibits this behavior. Any one to help...
    Mache
    Good Luck!
    Mache
    Attachments:
    XY Graph 2.jpg ‏370 KB
    XY Graph Autoscale bug.vi ‏9 KB
    XY Graph 1.jpg ‏116 KB

    Here are the additional attachments
    Good Luck!
    Mache
    Attachments:
    XY Graph 3.jpg ‏124 KB
    XY Graph 4.jpg ‏350 KB

  • Difficulty controlling X-axis time display in auto-scale mode

    Auto-scale mode is great in that I can zoom and pan and all the axes are updated, but the display of time is not very controlable. I specifically want the start and end time to always be displayed on the far right and left, and I want a decent number of subdivisions to always be displayed. In auto-scale mode non of this appears to be controllable. What can I do short of taking over control of all aspects of the chart scaling and axes control to get auto-scale behavior that is more reasonable?
    Thank you,
    Martin

    Hopefully a picture is worth a thousand words..
    I think this has something to do with Mode = AutoScaleLoose or something along those lines.
    Attachments:
    ni-chart1.JPG ‏53 KB
    ni-chart2.JPG ‏61 KB

  • How do I turn off text auto-formatting in Keynote?

    How do I turn off text auto-formatting in Keynote?

    You may uncheck some preferences in the Pages > Preferences menu item.
    You may also define your own custom default template.
    But you certainly are aware of that because it's described in the PDF User Guide delivered with every copy of iWork.
    Yvan KOENIG (from FRANCE mercredi 27 août 2008 18:06:16)

  • Auto scale/crop with lens correction tool in Camera Raw 8.4

    Does anyone know if this type of functionality exists in Camera Raw 8.4 similar to the Auto scale function in the lens correction filter? I understand the straighten tool offers this effect but I'm looking for in auto crop or autoscale feature when using the lens correction tool. Thanks in advance!

    Good day!
    I notice no difference to prior to 8.4.
    But maybe the ACR Forum may be a better place for questions realted to ACR.
    http://forums.adobe.com/community/cameraraw
    Regards,
    Pfaffenbichler

  • How can I turn off text auto-correct in Number IOS?

    I use Numbers as a project workbook and it drives me insane I cant turn off text auto-correct. I use a bunch of abbreviations that Numbers wont allow without constantly changing to the extent that its almost useless.

    Auto correct is controlled at the system, not apps, level (with a few possible exceptions, but Numbers isn't one of them).
    Settings app > General > Keyboard

  • How can I get text to scale to fit div?

    I am using a fluid div layout and want the text to scale itself with a maximum and minimum size so that it does not cause the div to expand excessively.
    Example - I scale the browser so that the code for the middle size, ipads, kicks in.
    I have then sized the text so that it looks right, but when I expand the screen so UNTIL the next media size kicks in, the text appears too small and the box is oversized.
    On the other hand I shrink the browser and the text wraps around causing the box div to expand too much causing the photograph to be outsized.
    I can not post an example as the client information is now on the site and I don't want to fall foul of group policy by posting links to a live site or 'appear' to advertise it.
    Thanks
    Terry

    Did you put your font-size properties inside your media queries?
    /* Special Rules for tablets */
    @media only screen and (max-width: 768px) {
       body {font-size: 110%}
    /* Special Rules for desktops */
    @media only screen and (min-width: 769px) and (max-width: 1223px) {
      body {font-size: 135%}
    Nancy O.

  • Changing cloud services auto scale weekends

    hi
    i want to change the default weekends in the azure auto scale ( our weekend is from Friday to Saturday ).
    can it be done using the portal or in any other way ?

    hi,
    >>( our weekend is from Friday to Saturday )?
    Base on my experience, if your weekend has two days, you could set weekend by selected the prior time zone .
    About customize the weekend time, it may be difficult on azure portal.
    Another way, I suggest you could try to auto scale could service by customize time using the Windows Azure Monitoring Services Management Library . I recommend you could refer to this code sample about how to use this library (http://blogs.msdn.com/b/cie/archive/2014/02/20/how-to-use-windows-azure-monitoring-services-management-library-to-create-an-autoscale-rule.aspx
    ). And you also see this document (http://msdn.microsoft.com/en-us/library/hh680945(v=pandp.50).aspx ).
    Hope this helps.
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • BO XI 3.1 SP3 Auto Scale, how it works...

    Hi,
    I thought that the new feature: "auto scale" in graphs (SP3), helps us to create X-Y graphs with the same scale...
    But I don't know how I have to use...
    Could anybody give me a example?
    Thanks

    Hi,
    What kind of SSO authentication are you trying to set up? (AD, LDAP,...)
    I think it's AD regarding your command line.
    But be aware that in SSO, you don't need to configure the command line to run the client.
    Have a look at the following guide.
    [Configuring Manual Kerberos Authentication and-or SSO in Distributed Environments with XI 3.1 SP3.pdf|https://bosap-support.wdf.sap.corp/sap/support/sapnotes/public/services/attachment.htm?iv_key=002007204200000183782010&iv_version=0005&alt=2BCE4CB10DF674B172F4F3F7B32A284F49333135358877720E883731B332AF34CACD2AB52C0A2C8DCACA09084EF4CB494E4E0F2ECE8E2F89772908C9CE70CD2DF77675F7F2D1750C09514BCECFCFCE4C8DCF4BCC4DB5F575F4F4F3F57771F571F6F70B01B25D83D4120B0A722092A599504EB16D715E3E00&iv_guid=DF838310BFAAE8F1B486001A64C54696]
    Regarding accessing CMC with SSO, it's not recomended at all as if you break this access, than you can't connect anymore to the CMC and modify settings.
    Regards,
    Philippe
    Edited by: Philippe Tavares on Feb 15, 2011 4:11 PM

  • Cloud service auto scale delay

    Hi team, 
    We have a cloud service that have 10 worker roles,  to let the cloud service can auto scale up/down, we configure the autoscale settings that if the average CPU reaches 70% and keeps last 30 minutes, new worker role instance will be created.
    We also configure a email notification monitor that if the worker role average CPU reach 75% and keeps last 30 minute it will send a notification to our administrator, we receivce the notification at 2015/1/26 0:55 and 1 hour later the instances ware scaled
    up, is that means  the autoscale have been delayed about 1 hour , is there some best practise that avoid this kind of problem and let the instances can be scaled up immeditatly
    thanks in advance.

    Hi,
    Please have a look at this article:
    http://azure.microsoft.com/en-us/documentation/articles/cloud-services-how-to-scale/, here is a snippet.
    All instances are included when calculating the average percentage of CPU usage and the average is based on use over the previous hour. Depending on the number of instances that your application is using, it can take longer than the specified wait time
    for the scale action to occur if the wait time is set very low. The minimum time between scaling actions is five minutes. Scaling actions cannot occur if any of the instances are in a transitioning state.
    Hope this helps.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • VM Auto Scale Problem

    Hi Team,
    I encountered a VM auto scale problem, 
    We have 3 VMs in a Availibility Set and configure VM auto scale, what we configured is that let 2 VMs running,  the third one as a standby server.
    when I  look at the auto scale log, it's wired that the logs say it will scale from 1 instance to 2 instances.
    paste part of the logs.
    ActiveAutoscaleProfile:
      "Name": "No scheduled times",
      "Capacity": {
        "Minimum": "2",
        "Maximum": "3",
        "Default": "3"
    Description:
    The autoscale engine attempting to scale resource 'daonortheuie2:EUIE-2-Media' from 1 instances count to 2 instances count.
    LastScaleActionTime:
    20140124T152458Z
    NewInstancesCount:
    2
    OldInstancesCount:
    1
    Thanks in advance.

    hi Baker,
    According to your description, it seems the issue is related to Azure Monitor, alert and auto scale , I will move this thread to Azure Monitor, alert and auto scale Discussions forums to get a better support.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Highlighting Text & Auto Text Options

    I've recently migrated from MS Word to Pages, and I'm determined to make this new relationship work. In Word I used its highlighting text (as with a real highlighter--yellow, pink, etc.) feature, as well as its Auto Text feature, in which I had a number of prescribed, hyperlinked comments. (I'm a teacher, and I would auto text things like, "comma error," which would then be linked to a web page about comma errors.
    Can anyone help me discover ways to do both of these in Pages? Also, is there anything for Pages like MS Word's macros?
    Thanks in advance,
    Brad Carpenter

    Welcome to the forums, Brad.
    There is no direct analogue in Pages to Word's highlighting feature. However, you can use the Comments feature to add specific comments to a specific piece of text (with the advantage that the comments can be easily hidden, since you are not changing the characteristics of the actual text). Simply select a bit of text and click the Comment icon in the toolbar, or from the Insert menu select "Comment". The selected text will highlight in document, and a comments box will appear to the left of the page, in which you can type whatever you want. In the comments box you can select whatever text you want and make it a hyperlink, by going to the Hyperlink Inspector. Unfortunately, there is not an easy way to automate the creation of a hyperlink, at least as far as I know.
    There are plenty of third-party applications that will let you store and add snippets of text easily to any Mac document, including Pages. These include TypeIt4Me, Butler, and even Quicksilver, which has a fanatical following and may be more than you need for this kind of task. I'm sure others here might be able to suggest other apps.
    One caution, however: If you intend to be sharing documents with others, they must be using Pages themselves to take advantage of these features. Unless your students are also using Pages, these workarounds won't really help.

  • Text auto reply

    Is there an app that will auto reply to incoming text messages

    I have been asking this question for ages.  I have sent emails and letters (below) to Apple numerous times without even a simple response..............
    As a stockholder in Apple and a large user of the Appleproducts, I have a suggestion and a question which in my opinion will capturean additional market share away from Blackberry, including my own.
    By way of background, I am one of the business leaders ina group of approximately 600 people.  Wehave deployed Blackberries as the device of choice.  I have tried and returned the iPhone and iPadas I find that it does not serve my needs for the lack of one simple functionthat I would think has a very easy solution.  I feel that if Apple could enhance itsportable operating systems by a simple function, it would sway hundreds ofthousands, if not millions of users to switch to Apple products.
    I use my device as a communications device for bothbusiness and personal use.  I am constantly emailing and texting and everykey touch is important to me as I do not have time to waste with repeatedkeystrokes.
    The autotext function of the Blackberry has keptme with Blackberry as it allows the user to define abbreviations on a systemwide platform.  Examples: Users can setup abbreviation for frequently used multiple key strokes.
    I frequently set up a lot of conference calls using thesame dial in number and passcodes so I set up an abbreviation called“icrl”.  I type in icrl and hit the space bar and it automatically typesin the entire phone number and the access codes for the call. 
    I fly a lot so I abbreviated “hstdn”.  Thistranslates into “I have to shut down now, my flight is leaving.  Will callyou when I land”.
    “CMCP” translates into “Please call me on my cell phone248-417-7900”.
    Since this function is native to the operating system, itfunctions on all functions and apps and in any field, unlike add on apps thatrequire messages to be created using an app and cannot be used to answer anincoming message.
    I would like to use the Apple products as I am attractedto their designs but this lack of functionality has rendered them fairlyuseless to me.  Can you please explain tome the likelihood of including this in future enhancements and why this has notbeen included to date?  I am trying tounderstand it and fail to see why unless it is an IP issue, but even that makesno sense as Microsoft has it included in its products as “autocorrect” and evenon the Mac platform.
    The addition of this simple functionality would enable meto truly change the way I work and sell a lot more Apple products.  If Apple could add this to its functionality,I think Apple would win over a good percentage of those users who will notmigrate because of this function.
    Thank you for your time

Maybe you are looking for

  • Itunes does not sync with iphone in windows 7 64 bit

    We iTunes is not syncing with my iphone 3g in 64-bit Windows 7, how can I fix this? observation (AMD Turion X2 Dual-Core 4GB Ram ATI Radeon). Thanks for the attention of everyone. null

  • Green dots on black background

    Hello! I have a problem with iPhone 2G. Screen shows only 5 vertical dote lines and background is black. Also phone not respond when usb cable is plugged in PC. Please help! Regards Sindijs Message was edited by: sindijs Message was edited by: sindij

  • How to use Type Casting in JSF Expression Language

    I have an attribute CategoryId in my VO of type oracle.jbo.domain.Number. I am trying to use the expression of Boolean item in JSF as #{row.CategoryId != 4} Here is the JSF code:                       <af:column id="s141NewItem3Col" noWrap="true" wid

  • How to monitor transactions in OEM

    Hi All, Can anyone please tell me how can I monitor transactions in OEM 12c Cloud Control? Thanks in Advance!!

  • Regarding authorization obects

    hello everyone,                       plz tell me who has the authority to assign authorization obects.