Hello,
I just started implementing a custom Font wrapper class to my software, but I am having difficulty implementing font scaling (a feature which seems extremely easy to implement in 0.7.x). I have used the PointSize property to set the font's pixel size to 7 so that it will display properly on a 640x480 resolution and could be scaled on larger resolutions. My goal is to be able to have the font display within the same proportions, for example, on a 1024x768 resolution like the rest of the window (proportions being the same relative size to the window). I have set the native resolution after constructing the font object with the method provided, and then attempted to scale it by using the notifyScreenResolution method. Currently, the font gets smaller (logically, of course) on the larger resolutions. As I am quite new to CEGUI, I feel that this is a simple and quick issue. Any feedback would be greatly appreciated.
Best regards,
ReGeX
CEGUI 0.6.2b Quick Font Scaling Question
Moderators: CEGUI MVP, CEGUI Team
- Jabberwocky
- Quite a regular
- Posts: 86
- Joined: Wed Oct 31, 2007 18:16
- Location: Canada
- Contact:
Re: CEGUI 0.6.2b Quick Font Scaling Question
Hopefully someone will correct me if I'm wrong. I think the only way you can achieve font scaling is to "fake it", and actually define several different .font files, each with a different "Size".
So for example, you might have 3 font files:
tahoma-8.font
tahoma-10.font
tahoma-12.font
In the first would be: Size="8"
In the 2nd would be: Size="10"
In the 3rd would be: Size="12"
Then, you'd have to manually switch between these fonts to make your text smaller or larger.
So for example, you might have 3 font files:
tahoma-8.font
tahoma-10.font
tahoma-12.font
In the first would be: Size="8"
In the 2nd would be: Size="10"
In the 3rd would be: Size="12"
Then, you'd have to manually switch between these fonts to make your text smaller or larger.
The Salvation Prophecy
Space Combat. Planet Exploration. Strategic Domination.
Space Combat. Planet Exploration. Strategic Domination.
Re: CEGUI 0.6.2b Quick Font Scaling Question
I think you just need to set the Font Property AutoScaled to True either...
in the .font file:
or in code:
in the .font file:
Code: Select all
<Font Name="default" Filename="default.ttf" Type="FreeType" Size="14" NativeHorzRes="1024" NativeVertRes="768" AutoScaled="True"/>
or in code:
Code: Select all
font->setProperty("AutoScaled", "True");
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
Re: CEGUI 0.6.2b Quick Font Scaling Question
Absolutely perfect!
The combination of the setNativeResolution method and the AutoScaled property worked like a charm. Thank you for the suggestion, Jamarr.
Jabberwocky, I was planning to use that method at a last resort, but thank you for your reply.
Regards,
ReGeX
The combination of the setNativeResolution method and the AutoScaled property worked like a charm. Thank you for the suggestion, Jamarr.
Jabberwocky, I was planning to use that method at a last resort, but thank you for your reply.
Regards,
ReGeX
- Jabberwocky
- Quite a regular
- Posts: 86
- Joined: Wed Oct 31, 2007 18:16
- Location: Canada
- Contact:
Re: CEGUI 0.6.2b Quick Font Scaling Question
Thanks Jamarr,
Good to know there's a better alternative than my crappy hack.
Good to know there's a better alternative than my crappy hack.
Who is online
Users browsing this forum: No registered users and 18 guests