-
Notifications
You must be signed in to change notification settings - Fork 6
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
Text height and some other issues #8
Comments
I am using the library with core graphics. |
Height is calculated at the end of -(void)drawRect method as (numLines * singleLineHeight). You can save it there. Regarding the other issue, I cannot tell what's happening. will have to take a look at your sample project. |
Thank you, but i think the problem is that drawRect is the view is first displayed so i cannot save the outcomes before the run time!. |
Finally i was a able to get the exact height by duplicating the drawRect as stated earlier, my code was ok but the call to init the frame was slightly wrong. for the other issue, i have overridden your project by changing the font and the text and by setting the flags to use CG. There is the link for the project: Or you can just use font: and the text from here: I really appreciate your help |
Yes, its a bug. I'm currently working on new version which is free from this bug. will push it in few days. You'll have to wait till then. |
Thank you. |
OK, just pushed the new version. |
Great, but seems it doesn't work with ARC enabled although i disabled it for the SSLabel files. |
You don't need to disable ARC for SSLabel files. It's been written to support both ARC and non-ARC. |
Everything seems to work great. Thank you! |
I need to get hight before display the view, I have try to take numLines * singleLineHeight from
|
You could use [_ssText measureHeightForFrameWidth:self.frame.size.width] I am not sure if it is the best thing to do, it works for me but sometimes it doesn't calculate the height correctly. (Ignores lines) |
thank you it works but unfortunately as you said is not accurate |
I hope Mohammad can look at this issue. |
Probably you are facing this issue because you are not subtracting padding from frame width. |
same thing still not accurate height specially in long text also I faced same problem mentioned above some words at the end of the line are clipped or the last char was missed |
I've tested with the above font and text and it has been working all right. almousa1990! Are you still facing the same problem? ZainabA! I'll have to take a look at your font, text and modified class. Then I'll be able to say something. |
Thank you Mohammad the problem was with the padding as you mentioned, it works as a charm now. |
Glad to hear that :) |
my font is (UthmanicHafs1 Ver09.otf ) SSLabel *label = nil; and I create getHeight method in SSLabel class and I use it to return the height of label to use it to draw the cell -(int)getHeight{
} |
I use the same font and it works correctly, maybe the CELL_CONTENT_WIDTH is not correct. For the other problem it is a bug that happens sometimes with words that ends with "ر", but you can solve the problem by adding a space after the word. |
thats right the space fixed the missed char thanks :) about CELL_CONTENT_WIDTH how may be incorrect? I read the return value from( getHight)and from( _measuredHeight inside generateCachedPages method in SSLabel class ) by NSLog there is big difference !! |
Do you call getHeight after you set the font and the size? |
yes |
Please check the text in TextEdit with same font and let me know if it is different. |
Positioning information is read from font file and every glyph is positioned according to that. Therefore your problem lies in the font and not in the code. |
Thanks .... |
Hi Muhammad Tayyab Akram; Thanks |
Hello,
I would like to thank you again for this great library, i see how much effort you put in.
I am having two issues with the library. I need to get the actual height of rendered text to customized the super view based on the height of the text, seems there is no direct way to do that although it is extremely important.
The other issue was that in some situations the words at the end of the line are clipped.
I am not sure why it happens but it seems to be a bug.
The text was updated successfully, but these errors were encountered: