Jump to content

Changing font size moves text in X


wctltya

Recommended Posts

Hi,

I've the following label, which is in a container:

// Create label widget: ghLabelUserFunctions
    wi.g.show = TRUE;
    wi.g.x = 82;
    wi.g.y = 12;
    wi.g.width = 218;
    wi.g.height = 20;
    wi.g.parent = ghContainerUserFunctions;
    wi.text = "ACTIVE FUNCTIONS";
    wi.customDraw = gwinLabelDrawJustifiedLeft;
    wi.customParam = 0;
    wi.customStyle = 0;
    ghLabelUserFunctions = gwinLabelCreate(0, &wi);
    gwinLabelSetBorder(ghLabelUserFunctions, FALSE);
   //gwinSetFont(ghLabelUserFunctions, roboto_16);
   //gwinRedraw(ghLabelUserFunctions);

If the last two lines are active the text is shifted about 12pxs right. The default font is roboto_12.

On the uGFX Studio (project Screen) is OK, although in the preview screen is a mess.

What could be the reason and how to fix it?

Link to comment
Share on other sites

Hi,

Can you please create a minimum test case that allows us to reproduce, observe & examine the problem?
A minimum test case consists of nothing else but the absolute minimum code to show the problem. In your case that would be the application code with nothing but a label, the configuration file and the corresponding font files. There really shouldn't be anything else in there. This way we can ensure that it has nothing to do with other parts of your application and we can try it on multiple platforms.

Link to comment
Share on other sites

Hi Joel,

I just locate the issue. It is caused by the font, although I don't know why. Because the issue exists on the preview screen too, I tried with the integrated fonts which are OK. See the attached screenshots, please. I'm attaching the ttf font and both converted files. I don't think it is relevant to the issue, but you'll see 3 ranges inside.

20 hours ago, wctltya said:

although in the preview screen is a mess

I was wrong about this, due to my lack of knowledge/experience about the Studio. Once I've added the .ttf file and the engine name in the studio font manager, it became OK. 

Roboto12_OK.png

Roboto16_Shifted.png

RobotoTtfAndConverted12and16.zip

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...