-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single line label will not full justify #44
Comments
Hi Chris I've seen your question but I don't think CoreText enables this behavior. In any text layout system (word processor, etc) as well as in CoreText, text justification applies on multiline paragraphs and never on the last line. In case you only have one line, it won't be justified. I'm not sure there is an option in CoreText (thus in OHAttributedLabel) to override this behavior. If there is anyway, it would be in the NSAttributedString attributes to apply on your string. Check on the CoreText String Attributes Reference and maybe the CTParagraphStyle attribute? Sorry I won't have much time those days to look at this, really busy. let me know if you find something useful in CoreText doc to implement this unusual behavior of text justification. |
I will investigate it and post any results I find. Actually, most word processors do have a way to do this, it's usually called force-justify. After looking around a little bit in Core Text, I believe there is a way to do this, but it involves setting the text up line-by-line rather than a single framesetter. I have a total of about 3 hours of Core Text experience at this point, but if I educate myself enough on this subject, I'll post the results. |
Yup, I think some day I'll need to switch the The problem is that our own framing mechanism for the whole So if you investigate on implementing even the premicises of manual layout of the CTLines of the text (for the multiline cases too -- even if you only need single line for your code we need this to work for everyone), even if it not a final implementation it will be greatly appreciated and save some time ;) Thanks |
BUMP! |
When creating a simple single line label, the text within it will not fully justify. The text of the label is justified just like any single-line paragraph or the last line of a paragraph: it is left justified rather than having a line run that is significantly shorter than the frame extend out with a lot of spaces between the words and letters. Doing full justify on a single line of text or the last line of a paragraph is called force-justify.
I am trying to set up a single-line label using OHAttributedLabel, but even with the alignment property set to UITextAlignmentJustify, it remains left-justified because it is a single line of text. Is there a way to force-justify a single line label? Even if the text in the label is significantly shorter than the width of the label, in this case I actually want the text to expand with spaces between the words and so on so that the first letter in the label is on the left margin and the last character is on the right margin.
The text was updated successfully, but these errors were encountered: