Solving the Font Size Puzzle for Thumbnail Layers

  • MHB
  • Thread starter Echilon1
  • Start date
  • Tags
    Font Puzzle
In summary: CGFloat ratioWidth = (parentSize.width/100); CGFloat ratioFontSize = (textEle.textProperties.fontSize/100)*(adjustedFontSize/100); [self.lbl setFontSize:ratioFontSize*element.textProperties.fontSize];In summary, the user is trying to size a font on a layer, but is having trouble getting the calculation correct. They are using a percentage to locate the layer and a font size, but are having trouble getting it right.
  • #1
Echilon1
2
0
I'm drawing a scene with, trying to size my font correctly. I have both a big and small version of the layer on the screen at the same time.

I want to set the font in a label on this layer (both the thumbnail and the full size version) to, for example, size 30. This works fine for the full size layer (call it ratio 1), but if I make the thumbnail 1/3 as big, how do I calculate that the font should be 1/3 as big? I can't get the logic right despite multiplying these numbers all ways.

The properties which the user can change are:

- Font size (pts)
- Thumbnail size (px wide)

To position the label correctly I'm using this (which works):

Code:
// 'element' is the customizable element. element.location is  the percentage across the layer where it's located. Eg: 50 is half way
        CGPoint relativeCoords = ccp (self.contentSize.width/(100/element.location.x),
                                      self.contentSize.height/(100/element.location.y));
        layer.position = relativeCoords;

To determine the right font size, I've tried, among other variants, this (to no avail):

Code:
-(void)sizeToRelative(CGSize)parentSize {
      // self.lbl is the layer within my element
      CGFloat ratioWidth = (parentSize.width/100);
      CGFloat ratioFontSize = (textEle.textProperties.fontSize/100)*(1/3)*(parentSize.width/100);
      [self.lbl setFontSize:ratioFontSize*element.textProperties.fontSize];

The idea is that if I pass in a `parentSize`, to calculate the relative font size. The 'default' size should be as big as 30px in a 100px wide layer. If I have a layer 200px wide, it should return 60 if the user sets the font at size 30.
 
Mathematics news on Phys.org
  • #2
In psuedo code, this would be:
Code:
        // 'element' is the customizable element. element.location is   the percentage across the layer where it's located. Eg: 50 is half way
        xFromOrigin = width/(100/location.x)
        yFromOrigin = height/(100/location.y));

To determine the right font size, I've tried, among other variants, this (to no avail):
Code:
Given a parentSize with a width and height:
       ratioWidth = (parentSize.width/100);
       ratioFontSize = (fontSize/100)*(1/3)*(parentSize.width/100);
       adjustedFontSize = ratioFontSize*fontSize];
 

1. What is the font size puzzle for thumbnail layers?

The font size puzzle for thumbnail layers refers to the challenge of determining the appropriate font size for text on images or thumbnails, in order to achieve optimal readability and visual appeal.

2. Why is solving the font size puzzle important?

Solving the font size puzzle is important because it can greatly impact the overall user experience and engagement with the content. If the font size is too small, it can be difficult to read and discourage users from engaging with the content. On the other hand, if the font size is too large, it can disrupt the visual balance and make the content look unprofessional.

3. What factors should be considered when solving the font size puzzle?

There are several factors that should be considered when solving the font size puzzle, such as the size and resolution of the image or thumbnail, the font type and style, the length of the text, and the overall design aesthetic.

4. Are there any guidelines or best practices for solving the font size puzzle?

Yes, there are some general guidelines and best practices that can help in solving the font size puzzle. These include using a font size that is at least 16px for optimal readability, adjusting the font size based on the length of the text, and using a font that is easy to read on a variety of backgrounds.

5. Is there any scientific research on the font size puzzle for thumbnail layers?

While there is limited scientific research specifically on the font size puzzle for thumbnail layers, there are some studies that have explored the impact of font size on readability and user experience. Additionally, there are design principles and theories that can be applied to solving the font size puzzle, based on human perception and visual cognition.

Similar threads

  • Sticky
  • Science and Math Textbooks
Replies
27
Views
3K
  • Programming and Computer Science
Replies
3
Views
1K
  • Introductory Physics Homework Help
Replies
7
Views
1K
  • Sticky
  • Science and Math Textbooks
Replies
10
Views
5K
  • Special and General Relativity
Replies
6
Views
1K
  • Linear and Abstract Algebra
Replies
8
Views
2K
  • Programming and Computer Science
Replies
1
Views
933
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
5K
  • General Math
Replies
2
Views
6K
Back
Top