Quantcast
Channel: bugs, errors - openFrameworks
Viewing all articles
Browse latest Browse all 636

Why does ofTrueTypeFont::setLineHeight() not scale in proportion to ofTrueTypeFont::Load()'s fontSize parameter?

$
0
0

@Drazinut wrote:

I am building UI displays that need to scale proportionally to different screen resolutions. So I set the fontSize parameter with which I Load() the ofTrueTypeFonts:

MainFontSize =  30.0f * DisplayHeight / ReferenceH;
MainFont.load("fonts/OpenSans-Regular.ttf", MainFontSize);

And this works fine, as long as I don’t try to Draw() multiple lines of text. If I set

MainFont.setLineHeight(MainFontSize);

or even:

MainFont.setLineHeight(MainFontSize * MainFontSize / 10.0f);

However, as DisplayHeight increases, while the font’s displayed size keeps up in proportion due to my code above, the line height FALLS BEHIND for some mysterious reason, so that on high-res displays, the lines start to scrunch together. It’s like I’m going to need to plot out the distortion curve to make a compensation function, which is quite strange.

I can brute force it but I’d really rather not have to.

Do I need to set some other property to get a proportionate line spacing? Does anyone know what’s going on here and/or what to do about it?

EDIT: OK, NEVER MIND. I FIGURED OUT IT WAS A PROBLEM IN MY BUILD PROCESS WHEN MOVING TO ANDROID STUDIO. I"D DELETE THE TOPIC BECAUSE I WAS WRONG ABOUT THERE BEING A PROBLEM RELEVANT TO OF.

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 636

Trending Articles