Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Know the maximum font size allowed for a given font name?

Is there any way to know the maximum size a font allowed.

I am doing

textInputTextView.font = [UIFont fontWithName:currentFontName size:doubleFontSize];
frame.size = textInputTextView.contentSize;

For different fonts I am getting wrong contentSize when doubleFontSize is more than 70. For some fonts I get wrong contentSize when doubleFontSize variable is only 40.

I am guessing textView.font = doubleSizeFont is too big for those particular fonts. All are ok when font size is small between 10 to 30.

Is there any way to know the maximum size allowed by a particular font?

Details:

I need an image from UITextView. I am using UIGraphicsGetImageFromCurrentImageContext image is producing ok. But I realized image quality is low. So I tried to make the TextView frame and font double.

When I Write in big font "I am a good boy" if good is the right most word. I get "I am a boy" the right most word good disappears I get some blank space on right side of the image. How tragic :)

like image 405
Warif Akhand Rishi Avatar asked May 22 '12 05:05

Warif Akhand Rishi


People also ask

What is the maximum size of font?

The Font Size list includes commonly used font point sizes, but you can type in font sizes that aren't listed. Available font sizes range from . 5 point to 999.9 points.

How do you determine a font size?

A font is often measured in pt (points). Points dictate the height of the lettering. There are approximately 72 (72.272) points in one inch or 2.54 cm. For example, the font size 72 would be about one inch tall, and 36 would be about a half of an inch.

What is the maximum font size and minimum font size?

The correct answer is 8 and 72. You can access the Fonts dialog box or use the tools in the Home tab in MS Word. The list contains font size in points 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48 and 72. Word supports font size between 1 and 1638.

What is the maximum font size in HTML?

The size attribute specifies how large a font will be displayed in either relative or absolute terms. Close the <font> tag with </font> to return to a normal text size. The default font size is 3, and the largest font size that can be displayed in a browser is 7.


1 Answers

You Can Calculate height/Width of the content by using the following code.Then resize your frame. Here my Width is fixed (290) and Calculating the height.

CGSize strSize= [DataToBeDisplayed sizeWithFont:[UIFont systemFontOfSize:17.0] constrainedToSize:CGSizeMake(290.0,99999.0)];
frame.size.height = strSize.height
like image 123
muthukumar Avatar answered Sep 19 '22 18:09

muthukumar