how to set font's size with pixel ?

zxwinmain

30-08-2010 16:29:15

Hello everybody, i'm Chinese, please excuse my English

how can i set a font size with pixel and no anti-aliasing?

like this webpage's font (12px or 14px)

and this is my core_font.xml


<Resource type="ResourceTrueTypeFont" name="Default">
<Property key="Source" value="simsun.ttc"/>
<Property key="Size" value="12"/>
<Property key="Resolution" value="40"/>
<Property key="Antialias" value="false"/>
<Property key="SpaceWidth" value="0"/>
<Property key="TabWidth" value="0"/>
<Property key="CursorWidth" value="0"/>
<Property key="Distance" value="0"/>
<Property key="OffsetHeight" value="0"/>
<Codes>
<Code range="33 126"/>
<Code range="19968 39999"/>
<Code hide="128"/>
<Code hide="1026 1039"/>
<Code hide="1104"/>
</Codes>
</Resource>

zxwinmain

31-08-2010 03:02:23

who can help me ...

my.name

31-08-2010 09:14:09

1. create font
2. run app
3. open log MyGUI.log
4. found line with creating font
5. using height in pix in your code

zxwinmain

01-09-2010 06:01:31

I found this:

13:35:54 | Core | Info | ResourceTrueTypeFont 'font.14' using texture size 4096 x 2048 | ..\..\MyGUIEngine\src\MyGUI_ResourceTrueTypeFont.cpp | 203
13:35:54 | Core | Info | ResourceTrueTypeFont 'font.14' using real height 20 pixels | ..\..\MyGUIEngine\src\MyGUI_ResourceTrueTypeFont.cpp | 204


but how can i use this?

my.name

01-09-2010 09:23:34

StaticText* text = ...
text->setFontName("font.14");
text->setFontHeight(20); // pix


or change skin StaticText

<Resource type="ResourceSkin" name = "StaticText" size = "16 16">
<Property key="FontName" value = "font.14" />
<Property key="TextAlign" value = "Default" />

<BasisSkin type="SimpleText" offset = "0 0 16 16" align = "Stretch"/>
</Resource>

or set default font
MyGUI::FontManager::getInstance().setDefaultSetFont("font.14");

zxwinmain

01-09-2010 14:25:02

Thank you my.name,but it's not work in my project

I want show a font without anti-aliasing

here is a image you can contrast it:

[attachment=0]test.jpg[/attachment]

i want a font show like in the Macromedia Fireworks 8

and thank you again !

my.name

02-09-2010 09:15:49

True Tape font is vector graphics and always has smooth.
Create your font in texture and using Manual Font.

zxwinmain

03-09-2010 05:16:10

oh,so i can't use .ttf files?

i'm sorry i don't understand .. can you give me some code ?