Git Product home page Git Product logo

Comments (23)

nicklockwood avatar nicklockwood commented on July 17, 2024

I didn't know that method existed. Seems like it would make a handy addition to the library.

The biggest problem seems to be working out the size of the text because you can't use the simple NSString size functions if you're using a non-standard letter spacing.

I'll look at adding it to the core library myself, but in the meantime, here's a stackoverflow thread with some possible solutions (I notice you commented on another stackoverflow thread):

http://stackoverflow.com/questions/2544905/how-to-change-an-uilabel-uifonts-letter-spacing

Nick

On 14 Nov 2011, at 16:25, kyleplattner wrote:

Is it possible to add CGContextSetCharacterSpacing(context, n) to FXLabel? If so, how?


Reply to this email directly or view it on GitHub:
#1

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

I tried adding in the line and couldn't get any of my FXLabels to respond to it (it is very possible I was adding it in the wrong spot). Please let me know as soon as you get something, I am very interested in adding this in. Thanks,

Kyle

On Nov 14, 2011, at 10:47 AM, Nick Lockwood wrote:

I didn't know that method existed. Seems like it would make a handy addition to the library.

The biggest problem seems to be working out the size of the text because you can't use the simple NSString size functions if you're using a non-standard letter spacing.

I'll look at adding it to the core library myself, but in the meantime, here's a stackoverflow thread with some possible solutions (I notice you commented on another stackoverflow thread):

http://stackoverflow.com/questions/2544905/how-to-change-an-uilabel-uifonts-letter-spacing

Nick

On 14 Nov 2011, at 16:25, kyleplattner wrote:

Is it possible to add CGContextSetCharacterSpacing(context, n) to FXLabel? If so, how?


Reply to this email directly or view it on GitHub:
#1


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

I've managed to get it working. The problem is that you have to use CGContextShowTextAtPoint to display the text instead of the NSString drawInRect methods, and that seems to be much more primitive. In addition to not giving you the final size before drawing, it also doesn't provide any options for wrapping or text alignment.

I'll keep looking into it, but it seems that the only way to take advantage of this feature without losing existing functionality is to write my own text layout engine.

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Would you be willing to share the code you used to get it working?

Kyle

On Nov 15, 2011, at 8:20 PM, Nick Lockwood wrote:

I've managed to get it working. The problem is that you have to use CGContextShowTextAtPoint to display the text instead of the NSString drawInRect methods, and that seems to be much more primitive. In addition to not giving the final size before drawing, it also doesn't provide any options for wrapping or text alinement.

I'll keep looking into it, but it seems that the only way to take advantage of this feature without losing existing functionality is to write my own text layout engine.


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

Here you go - it's buggy though, I need to tie the adjusted text size calculation in earlier in the process so that the effects are applied over the whole width of the string:

http://charcoaldesign.com/resources/FXLabel_1.2.1b.zip

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Thanks, it appears to work fine for me. Let me know when you get ironed out completely though if you would.

Kyle

On Nov 16, 2011, at 2:08 PM, Nick Lockwood wrote:

Here you go - it's buggy though, I need to tie the adjusted text size calculation in earlier in the process so that the effects are applied over the whole width of the string:

http://charcoaldesign.com/resources/FXLabel_1.2.1b.zip


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Nick,
Do you know if it is possible to use FXLabel inside of a UITextField?

Kyle

On Nov 16, 2011, at 2:08 PM, Nick Lockwood wrote:

Here you go - it's buggy though, I need to tie the adjusted text size calculation in earlier in the process so that the effects are applied over the whole width of the string:

http://charcoaldesign.com/resources/FXLabel_1.2.1b.zip


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

Hi Kyle,

That's tricky. I've not tried it, but you might be able to use a subclass or category on UITextField to replace some of the internal UILabels with FXLabels, but looking at the header for UITextField it looks like a lot of the heavy listing is done with a private class called UITextFieldLabel, which you can't replace with an FXLabel, and attempting to do so would probably require you to make private API calls.

So the short answer is no.

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Thanks for the reply. Also while I am at it: is there anyway to clean up aliasing seen when using FXLabel?

Kyle

On Jan 23, 2012, at 3:23 PM, Nick Lockwood wrote:

Hi Kyle,

That's tricky. I've not tried it, but you might be able to use a subclass or category on UITextField to replace some of the internal UILabels with FXLabels, but looking at the header for UITextField it looks like a lot of the heavy listing is done with a private class called UITextFieldLabel, which you can't replace with an FXLabel, and attempting to do so would probably require you to make private API calls.

So the short answer is no.


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

Have you tried increasing the oversampling value?

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

I have not, how do I determine what to set it at?

On Jan 23, 2012, at 3:57 PM, Nick Lockwood wrote:

Have you tried increasing the oversampling value?


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

Erm... by reading the documentation?

"For best results, set oversampling to a power of two, i.e. 1, 2, 4, 8, 16, etc. For performance reasons, you should use the lowest value that yields acceptable results."

Basically, try a value of 2 and see if your aliasing goes away. If it doesn't, try 4, and so on.

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Nick,
With the code you gave us from the link below to accommodate character spacing right justified doesn't seem to behave correctly with applied effects. Do you have any ideas on how to fix this?

Kyle

On Nov 16, 2011, at 2:08 PM, Nick Lockwood wrote:

Here you go:

http://charcoaldesign.com/resources/FXLabel_1.2.1b.zip


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

The version I forked to add character spacing predates the edge insets feature that allows the effects to work properly with right justification. I'll update it at some point when I have some spare time.

Nick

(Sent from my iPhone)

On 10 Feb 2012, at 18:55, kyleplattner [email protected] wrote:

Nick,
With the code you gave us from the link below to accommodate character spacing right justified doesn't seem to behave correctly with applied effects. Do you have any ideas on how to fix this?

Kyle

On Nov 16, 2011, at 2:08 PM, Nick Lockwood wrote:

Here you go:

http://charcoaldesign.com/resources/FXLabel_1.2.1b.zip


Reply to this email directly or view it on GitHub:
#1 (comment)


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Just noticed that you posted an update to FXLabel. Do you anticipate being able to add character spacing officially in the near future? I am still using an old version you had put together to include this and I would love to update.

On Feb 10, 2012, at 3:02 PM, Nick Lockwood [email protected] wrote:

The version I forked to add character spacing predates the edge insets feature that allows the effects to work properly with right justification. I'll update it at some point when I have some spare time.

Nick

(Sent from my iPhone)

On 10 Feb 2012, at 18:55, kyleplattner [email protected] wrote:

Nick,
With the code you gave us from the link below to accommodate character spacing right justified doesn't seem to behave correctly with applied effects. Do you have any ideas on how to fix this?

Kyle

On Nov 16, 2011, at 2:08 PM, Nick Lockwood wrote:

Here you go:

http://charcoaldesign.com/resources/FXLabel_1.2.1b.zip


Reply to this email directly or view it on GitHub:
#1 (comment)


Reply to this email directly or view it on GitHub:
#1 (comment)


Reply to this email directly or view it on GitHub:
#1 (comment)

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

Yes, but it will be a major change and I've been concentrating on quick wins and bug fixes for the time being.

It's on my todo-list for FXLabel 1.4, but the version I made for you was a bit of a hack and I'm not ready to merge it into the main release yet because it would break too many things.

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

Sorry, I didn't manage to squeeze this into 1.4. I did make a number of internal enhancements to the layout code that will make it easier to add this in future however. I'll try for the next version.

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Do you have an estimation of when it will be done? I am still running on a really old one-off version and have a tough time keeping up to date with the latest changes. Thanks.

Kyle

On Dec 18, 2012, at 11:42 AM, Nick Lockwood <[email protected]mailto:[email protected]> wrote:

Sorry, I didn't manage to squeeze this into 1.4. I did make a number of internal enhancements to the layout code that will make it easier to add this in future however. I'll try for the next version.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-11497075.

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Is there a good way to hack character spacing into the current version so I can take advantage of your recent fixes?

On Dec 18, 2012, at 11:42 AM, Nick Lockwood <[email protected]mailto:[email protected]> wrote:

Sorry, I didn't manage to squeeze this into 1.4. I did make a number of internal enhancements to the layout code that will make it easier to add this in future however. I'll try for the next version.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-11497075.

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

This is now implemented in the current 1.5 beta. I've not done any performance tuning yet, so let me know if it's noticeably slower to render than before.

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

Thanks so much. I can't wait to try this.

On Dec 23, 2012, at 5:09 PM, Nick Lockwood <[email protected]mailto:[email protected]> wrote:

This is now implemented in the current 1.5 beta. I've not done any performance tuning yet, so let me know if it's noticeably slower to render than before.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-11651772.

from fxlabel.

kyleplattner avatar kyleplattner commented on July 17, 2024

I am having some trouble with some labels rendering. Would you be interested in taking a look at our project?

On Dec 23, 2012, at 7:16 PM, Kyle Plattner <[email protected]mailto:[email protected]> wrote:

Thanks so much. I can't wait to try this.

On Dec 23, 2012, at 5:09 PM, Nick Lockwood <[email protected]mailto:[email protected]> wrote:

This is now implemented in the current 1.5 beta. I've not done any performance tuning yet, so let me know if it's noticeably slower to render than before.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-11651772.

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

Sure. Email it to support at charcoaldesign dot co dot uk and I'll take a look.

Nick

On 2 Jan 2013, at 04:54 PM, kyleplattner [email protected] wrote:

I am having some trouble with some labels rendering. Would you be interested in taking a look at our project?

On Dec 23, 2012, at 7:16 PM, Kyle Plattner <[email protected]mailto:[email protected]> wrote:

Thanks so much. I can't wait to try this.

On Dec 23, 2012, at 5:09 PM, Nick Lockwood <[email protected]mailto:[email protected]> wrote:

This is now implemented in the current 1.5 beta. I've not done any performance tuning yet, so let me know if it's noticeably slower to render than before.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-11651772.

Reply to this email directly or view it on GitHub.

from fxlabel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.