[SOLVED] Making a basic text window? Setting the font size?
Moderators: CEGUI MVP, CEGUI Team
[SOLVED] Making a basic text window? Setting the font size?
1) I want to create a text window that doesn't scroll or anything else. Just text. How do I do this?
At the moment I have just copied the exact contents of "TaharezLook/StaticText" in the looknfeel file into my own "TaharezLook/simpleText" and changed both "FrameEnabled" and "BackgroundEnabled" to false. This does what I want, but I want something clean with the enormous definitions and unnecessary properties that go with StaticText.
2) I want to be able to change both the font size and the font color of my window's font, local to the window itself -- I don't want to change the font for all windows that use it, just for my window. How do I do this?
I thought it would be simple ... but.. I cannot find anywhere on the forums or in the API how to do this.
Edit:
Figured out how to do color (a tag-- "[colour='FFFF0000'] mytext")
Did NOT figure out how to do a font size. Saw a lot of not very good ways to do it, including fonts being made where 1 font size occupies one texture.
Ideally, I would like to be able to create, for instance, a 200 point font and then scale down the texture as needed instead of creating 100 different font sizes.
Edit 2: In fact, is there just a way to scale a window's textures entirely?
Edit 3: Ok, another question that has to do with all of the above somewhat. I want my windows to block out other windows behind it even though it has a transparent background. For instance, in here you can see a lot of text overlap that isn't very pretty:
http://img9.imageshack.us/i/s16j.png/
Edit 4: How do I set the z-order???
Edit 5: Ok, one more. How do I get the complete window texture? I'm thinking a possible solution would be to throw the window text into a 3D object in Irrlicht... but how...
Thanks.
At the moment I have just copied the exact contents of "TaharezLook/StaticText" in the looknfeel file into my own "TaharezLook/simpleText" and changed both "FrameEnabled" and "BackgroundEnabled" to false. This does what I want, but I want something clean with the enormous definitions and unnecessary properties that go with StaticText.
2) I want to be able to change both the font size and the font color of my window's font, local to the window itself -- I don't want to change the font for all windows that use it, just for my window. How do I do this?
I thought it would be simple ... but.. I cannot find anywhere on the forums or in the API how to do this.
Edit:
Figured out how to do color (a tag-- "[colour='FFFF0000'] mytext")
Did NOT figure out how to do a font size. Saw a lot of not very good ways to do it, including fonts being made where 1 font size occupies one texture.
Ideally, I would like to be able to create, for instance, a 200 point font and then scale down the texture as needed instead of creating 100 different font sizes.
Edit 2: In fact, is there just a way to scale a window's textures entirely?
Edit 3: Ok, another question that has to do with all of the above somewhat. I want my windows to block out other windows behind it even though it has a transparent background. For instance, in here you can see a lot of text overlap that isn't very pretty:
http://img9.imageshack.us/i/s16j.png/
Edit 4: How do I set the z-order???
Edit 5: Ok, one more. How do I get the complete window texture? I'm thinking a possible solution would be to throw the window text into a 3D object in Irrlicht... but how...
Thanks.
Last edited by agamemnus on Thu May 13, 2010 20:36, edited 1 time in total.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Making a basic text window? Setting the font size?
1) To create a basic window that just draws text with none of the bloat you create a mapping that uses CEGUI/DefaultWindow as the target and Falagard/Default as the window renderer. Then in the WidgetLook definition just create Enabled and Disabled states which reference an ImagerySection that just contains a single TextComponent that draws the text string from the target Window.
2) The size is a property of the font. Multiple sizes require multiple fonts.
A background is either transparent or it isn't. A transparent background that blocks out what's behind is, by definition, not transparent. So if you don't want transparency, just set a background of some kind (in the WL from 1 above, via an ImageryComponent in the ImagerySection).
Windows only have textures if they are associated with some kind of rendering surface that supports rendering to texture, and then only if the underlying system supports rendering to texture. In most cases we can assume that the window has it's own texture if the AutoRenderingSurface property is set to true. In the default LookNFeels this is enabled by default only for FrameWindow. To get the texture you basically do something like:
Though probably not all in one go like that, since you'll want to be testing return values in a couple of places (or at least from getRenderingSurface()).
CE.
2) The size is a property of the font. Multiple sizes require multiple fonts.
A background is either transparent or it isn't. A transparent background that blocks out what's behind is, by definition, not transparent. So if you don't want transparency, just set a background of some kind (in the WL from 1 above, via an ImageryComponent in the ImagerySection).
Windows only have textures if they are associated with some kind of rendering surface that supports rendering to texture, and then only if the underlying system supports rendering to texture. In most cases we can assume that the window has it's own texture if the AutoRenderingSurface property is set to true. In the default LookNFeels this is enabled by default only for FrameWindow. To get the texture you basically do something like:
Code: Select all
dynamic_cast<CEGUI::IrrlichtTexture&>(dynamic_cast<CEGUI::IrrlichtTextureTarget&>(window->getRenderingSurface()->getRenderTarget()).getTexture()).getIrrlichtTexture();
Though probably not all in one go like that, since you'll want to be testing return values in a couple of places (or at least from getRenderingSurface()).
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Making a basic text window? Setting the font size?
Ok, thanks... but:
What about setting the z-index/z-order? (the actual value??) How do I do this?
OK.
I don't understand this at all.
What about setting the z-index/z-order? (the actual value??) How do I do this?
1) To create a basic window that just draws text with none of the bloat you create a mapping that uses CEGUI/DefaultWindow as the target and Falagard/Default as the window renderer.
OK.
Then in the WidgetLook definition just create Enabled and Disabled states which reference an ImagerySection that just contains a single TextComponent that draws the text string from the target Window.
I don't understand this at all.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Making a basic text window? Setting the font size?
agamemnus wrote:What about setting the z-index/z-order? (the actual value??) How do I do this?
There is no 'z' value / setting. You can arrange windows by moving window 'a' behind of or in front of window 'b', or behind or on top of all other windows. (The ability to move behind/in front of specified windows was added in SVN, so requires either SVN code or a snapshot release).
Then in the WidgetLook definition just create Enabled and Disabled states which reference an ImagerySection that just contains a single TextComponent that draws the text string from the target Window.
I don't understand this at all. [/quote][/quote]
I'll try to post a concrete example later on today or on Wednesday.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Making a basic text window? Setting the font size?
Ok, here's a basic WidgetLook for a simple text label:
And to make use of that you need an appropriate mapping in a scheme such as this (or equivalent C++ code):
Note that as posted this will always draws the text white. Adding a colour setting property is simple enough, and is left as an exercise for the user (hint: look at the Button WidgetLook definitions).
Note also that I did not actually test this, but it should be pretty close to a working example.
CE.
Code: Select all
<WidgetLook name="MyLabel">
<PropertyDefinition name="VertFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<PropertyDefinition name="HorzFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<ImagerySection name="label">
<TextComponent>
<Area>
<Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
</Area>
<VertFormatProperty name="VertFormatting" />
<HorzFormatProperty name="HorzFormatting" />
</TextComponent>
</ImagerySection>
<StateImagery name="Enabled">
<Layer>
<Section section="label" />
</Layer>
</StateImagery>
<StateImagery name="Disabled">
<Layer>
<Section section="label" />
</Layer>
</StateImagery>
</WidgetLook>
And to make use of that you need an appropriate mapping in a scheme such as this (or equivalent C++ code):
Code: Select all
<FalagardMapping WindowType="SimpleLabel"
TargetType="DefaultWindow"
Renderer="Falagard/Default"
LookNFeel="MyLabel" />
Note that as posted this will always draws the text white. Adding a colour setting property is simple enough, and is left as an exercise for the user (hint: look at the Button WidgetLook definitions).
Note also that I did not actually test this, but it should be pretty close to a working example.
CE.
Last edited by CrazyEddie on Thu Apr 29, 2010 18:31, edited 1 time in total.
Reason: Fixed the missing Layer tags in the example.
Reason: Fixed the missing Layer tags in the example.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Making a basic text window? Setting the font size?
Crashes: "d_label != 0".
Edit: Also, I've looked around and I have seen a few different ways (on fairly old threads) to create a new font size... is there one that actually works with the new CEGUI and that I can easily apply?
Furthermore.. I'm not really sure on this one, but people keep telling me to "use Freetype"... I'm thinking... o.O ("What?") How the heck do I "use Freetype" with CEGUI?
Edit: Also, I've looked around and I have seen a few different ways (on fairly old threads) to create a new font size... is there one that actually works with the new CEGUI and that I can easily apply?
Furthermore.. I'm not really sure on this one, but people keep telling me to "use Freetype"... I'm thinking... o.O ("What?") How the heck do I "use Freetype" with CEGUI?
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Making a basic text window? Setting the font size?
I couldn't find an assert with that test. I couldn't actually find many instances of 'd_label' at all
With regards to the font question, you'd need to post some examples as to what you're asking; I'm not about to start trawling though the forums on the off chance I might stumble upon the examples you're referring to
CEGUI already uses Freetype2 for it's font rendering. If you want to use FT directly there's nothing stopping you doing so, though depending on how you do the rendering, it will likely be prohibitively slow for anything but trivial examples.
CE.
With regards to the font question, you'd need to post some examples as to what you're asking; I'm not about to start trawling though the forums on the off chance I might stumble upon the examples you're referring to
CEGUI already uses Freetype2 for it's font rendering. If you want to use FT directly there's nothing stopping you doing so, though depending on how you do the rendering, it will likely be prohibitively slow for anything but trivial examples.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Making a basic text window? Setting the font size?
1. I copied your code verbatim. I believe it's a syntax error but I have NO IDEA where it could be. I "attached" the log and here is a screenshot of the error.
http://img571.imageshack.us/i/mserror.jpg/
2. I'm not asking you to go trolling through the forum; I don't believe any of the forum examples apply anymore with the new version and I wouldn't know how to apply those examples anyway. I was just hoping for a clean, easy way to change fonts. You say that CEGUI uses Freetype2... except Freetype2 allows people to set a font size! This is a very basic item that CEGUI users need to be able to have. I need to be able to set a font size, please!!
http://img571.imageshack.us/i/mserror.jpg/
2. I'm not asking you to go trolling through the forum; I don't believe any of the forum examples apply anymore with the new version and I wouldn't know how to apply those examples anyway. I was just hoping for a clean, easy way to change fonts. You say that CEGUI uses Freetype2... except Freetype2 allows people to set a font size! This is a very basic item that CEGUI users need to be able to have. I need to be able to set a font size, please!!
29/04/2010 13:23:15 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29/04/2010 13:23:15 (Std) + Crazy Eddie's GUI System - Event log +
29/04/2010 13:23:15 (Std) + (http://www.cegui.org.uk/) +
29/04/2010 13:23:15 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29/04/2010 13:23:15 (Std) CEGUI::Logger singleton created. (003D53B0)
29/04/2010 13:23:15 (Std)
29/04/2010 13:23:15 (Std) ********************************************************************************
29/04/2010 13:23:15 (Std) * Important: *
29/04/2010 13:23:15 (Std) * To get support at the CEGUI forums, you must post _at least_ the section *
29/04/2010 13:23:15 (Std) * of this log file indicated below. Failure to do this will result in no *
29/04/2010 13:23:15 (Std) * support being given; please do not waste our time. *
29/04/2010 13:23:15 (Std) ********************************************************************************
29/04/2010 13:23:15 (Std) ********************************************************************************
29/04/2010 13:23:15 (Std) * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
29/04/2010 13:23:15 (Std) ********************************************************************************
29/04/2010 13:23:15 (Std) ---- Version 0.7.100328 (Build: Apr 21 2010 Microsoft Windows MSVC++ 9.0 32 bit) ----
29/04/2010 13:23:15 (Std) ---- Renderer module is: CEGUI::IrrlichtRenderer - Official Irrlicht based 2nd generation renderer module. RenderTarget support is enabled. ----
29/04/2010 13:23:15 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
29/04/2010 13:23:15 (Std) ---- Image Codec module is: IrrlichtImageCodec - Integrated ImageCodec using the Irrlicht engine. ----
29/04/2010 13:23:15 (Std) ---- Scripting module is: None ----
29/04/2010 13:23:15 (Std) ********************************************************************************
29/04/2010 13:23:15 (Std) * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
29/04/2010 13:23:15 (Std) ********************************************************************************
29/04/2010 13:23:15 (Std)
29/04/2010 13:23:15 (Std) ---- Begining CEGUI System initialisation ----
29/04/2010 13:23:15 (Std) CEGUI::ImagesetManager singleton created (0122F790)
29/04/2010 13:23:15 (Std) CEGUI::FontManager singleton created. (01232BB8)
29/04/2010 13:23:15 (Std) CEGUI::WindowFactoryManager singleton created
29/04/2010 13:23:15 (Std) CEGUI::WindowManager singleton created (01231908)
29/04/2010 13:23:15 (Std) CEGUI::SchemeManager singleton created. (01233630)
29/04/2010 13:23:15 (Std) CEGUI::MouseCursor singleton created. (012338B0)
29/04/2010 13:23:15 (Std) CEGUI::GlobalEventSet singleton created. (01230010)
29/04/2010 13:23:15 (Std) CEGUI::WidgetLookManager singleton created. (0122ED90)
29/04/2010 13:23:15 (Std) CEGUI::WindowRendererManager singleton created (0122F988)
29/04/2010 13:23:15 (Std) CEGUI::RenderEffectManager singleton created (0122EE10)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'DefaultWindow' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'DefaultWindow' windows added. (01232E28)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'DragContainer' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'DragContainer' windows added. (01234218)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'ScrolledContainer' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'ScrolledContainer' windows added. (01234388)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'ClippedContainer' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'ClippedContainer' windows added. (01234848)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Checkbox' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Checkbox' windows added. (01234A78)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/PushButton' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/PushButton' windows added. (01234C18)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/RadioButton' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/RadioButton' windows added. (01234E30)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Combobox' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Combobox' windows added. (01234ED8)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/ComboDropList' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/ComboDropList' windows added. (01235038)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Editbox' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Editbox' windows added. (01235260)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/FrameWindow' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/FrameWindow' windows added. (01235308)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/ItemEntry' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/ItemEntry' windows added. (01235758)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Listbox' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Listbox' windows added. (01235970)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/ListHeader' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/ListHeader' windows added. (01235A18)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/ListHeaderSegment' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/ListHeaderSegment' windows added. (01235C30)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Menubar' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Menubar' windows added. (01235F40)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/PopupMenu' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/PopupMenu' windows added. (01236040)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/MenuItem' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/MenuItem' windows added. (012361A0)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/MultiColumnList' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/MultiColumnList' windows added. (01236248)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/MultiLineEditbox' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/MultiLineEditbox' windows added. (01236498)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/ProgressBar' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/ProgressBar' windows added. (012365F8)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/ScrollablePane' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/ScrollablePane' windows added. (01236758)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Scrollbar' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Scrollbar' windows added. (012368B8)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Slider' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Slider' windows added. (01236960)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Spinner' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Spinner' windows added. (01236B78)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/TabButton' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/TabButton' windows added. (01236C20)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/TabControl' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/TabControl' windows added. (01236EF0)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Thumb' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Thumb' windows added. (01237050)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Titlebar' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Titlebar' windows added. (012370F8)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Tooltip' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Tooltip' windows added. (012371A0)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/ItemListbox' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/ItemListbox' windows added. (01237468)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/GroupBox' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/GroupBox' windows added. (012375C8)
29/04/2010 13:23:15 (Std) Created WindowFactory for 'CEGUI/Tree' windows.
29/04/2010 13:23:15 (Std) WindowFactory for 'CEGUI/Tree' windows added. (01237728)
29/04/2010 13:23:15 (Std) Window type alias named 'DefaultGUISheet' added for window type 'DefaultWindow'.
29/04/2010 13:23:15 (Std) CEGUI::System singleton created. (003D5BC0)
29/04/2010 13:23:15 (Std) ---- CEGUI System initialisation completed ----
29/04/2010 13:23:15 (Std)
29/04/2010 13:23:15 (Std) Started creation of Scheme from XML specification:
29/04/2010 13:23:15 (Std) ---- CEGUI GUIScheme name: Basic
29/04/2010 13:23:15 (Std) Started creation of Imageset from XML specification:
29/04/2010 13:23:15 (Std) ---- CEGUI Imageset name: cursorset1
29/04/2010 13:23:15 (Std) ---- Source texture file: cursorset1.png in resource group: (Default)
29/04/2010 13:23:15 (Std) Started creation of Scheme from XML specification:
29/04/2010 13:23:15 (Std) ---- CEGUI GUIScheme name: TaharezLook
29/04/2010 13:23:15 (Std) Started creation of Imageset from XML specification:
29/04/2010 13:23:15 (Std) ---- CEGUI Imageset name: TaharezLook
29/04/2010 13:23:15 (Std) ---- Source texture file: TaharezLook.tga in resource group: (Default)
29/04/2010 13:23:15 (Std) Started creation of Imageset from XML specification:
29/04/2010 13:23:15 (Std) ---- CEGUI Imageset name: icon_createpath
29/04/2010 13:23:15 (Std) ---- Source texture file: icon_createpath.png in resource group: (Default)
29/04/2010 13:23:15 (Std) Started creation of Font from XML specification:
29/04/2010 13:23:15 (Std) ---- CEGUI font name: DejaVuSans-10
29/04/2010 13:23:15 (Std) ---- Font type: FreeType
29/04/2010 13:23:15 (Std) ---- Source file: DejaVuSans.ttf in resource group: (Default)
29/04/2010 13:23:15 (Std) ---- Real point size: 20
29/04/2010 13:23:15 (Std) ===== Falagard 'root' element: look and feel parsing begins =====
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Making a basic text window? Setting the font size?
Oh! d_layer. See I became confused because you posted 'd_label'. These words are spelt and pronounced differently I now see where I messed up - sorry about that, though I did say that I had not tested it. I had forgotten the <Layer> tags. I have edited the example to include these, now.
With regards to setting a font size, you can set the size of a Freetype based font via the property "PointSize" - this is demonstrated in the FontDemo, I suggest you study that. Also, I'll take no lectures from you as to what CEGUI users 'need' to have, thanks
Be aware that this changes the font size for all uses of the font. So to reiterate what I said previously, the size is a property of the font, and to have multiple sizes of a given font requires multiple font instances.
CE.
With regards to setting a font size, you can set the size of a Freetype based font via the property "PointSize" - this is demonstrated in the FontDemo, I suggest you study that. Also, I'll take no lectures from you as to what CEGUI users 'need' to have, thanks
Be aware that this changes the font size for all uses of the font. So to reiterate what I said previously, the size is a property of the font, and to have multiple sizes of a given font requires multiple font instances.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Making a basic text window? Setting the font size?
Hmm, it would be helpful to have a file that lists all the tags and describes their format and use...
You don't need any extra code beyond what you've shown to get colour tags working.
I managed to get colors working with Properties instead, like this: (for reference)
You don't need any extra code beyond what you've shown to get colour tags working.
I managed to get colors working with Properties instead, like this: (for reference)
Code: Select all
<WidgetLook name="simpleText">
<PropertyDefinition name="NormalTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
<PropertyDefinition name="VertFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<PropertyDefinition name="HorzFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<ImagerySection name="label">
<TextComponent>
<Area>
<Dim type="LeftEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="TopEdge"><AbsoluteDim value="0" /></Dim>
<Dim type="Width"><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height"><UnifiedDim scale="1" type="Height" /></Dim>
</Area>
<VertFormatProperty name="VertFormatting" />
<HorzFormatProperty name="HorzFormatting" />
</TextComponent>
</ImagerySection>
<StateImagery name="Enabled">
<Layer>
<Section section="label">
<ColourProperty name="NormalTextColour" />
</Section>
</Layer>
</StateImagery>
<StateImagery name="Disabled">
<Layer>
<Section section="label">
<ColourProperty name="NormalTextColour" />
</Section>
</Layer>
</StateImagery>
Re: Making a basic text window? Setting the font size?
You mean like the documentation that already exists?
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: Making a basic text window? Setting the font size?
EDIT: CE (or anyone), do I need to use CEGUI::FontManager::getSingleton().create to create another instance of an already loaded font, or can I do something else? (does the font get immediately converted into a texture or does CEGUI keep the font data?)
Either I don't see where the text tags are specified, or they are not listed there.
It would be nice to have both those and all the Window, Font and any other properties in one place, too. Until that happens then we're (I'm) just guessing, digging, and begging CE to tell me what the property is.
Jamarr wrote:You mean like the documentation that already exists?
Either I don't see where the text tags are specified, or they are not listed there.
It would be nice to have both those and all the Window, Font and any other properties in one place, too. Until that happens then we're (I'm) just guessing, digging, and begging CE to tell me what the property is.
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Making a basic text window? Setting the font size?
agamemnus wrote:EDIT: CE (or anyone), do I need to use CEGUI::FontManager::getSingleton().create to create another instance of an already loaded font, or can I do something else? (does the font get immediately converted into a texture or does CEGUI keep the font data?)
Yes, you have to use the FontManager. The answer to the second part of the question is 'both'. Certain glyphs are rendered to texture immediately, other glyphs are rendered in pages from the ttf source as needed.
agamemnus wrote:... begging CE to tell me what the property is.
The thing about this is, how do you think I get the information? The fact is that I also have to look it up - whether this be in the main docs, the wikied 'setProperty' page or by digging around in the code or headers, I still end up looking most of it up. The fact that I can do this means that you can too - you'd get the answers much quicker that way
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Making a basic text window? Setting the font size?
Yes, you have to use the FontManager. The answer to the second part of the question is 'both'. Certain glyphs are rendered to texture immediately, other glyphs are rendered in pages from the ttf source as needed.
If CEGUI stores the ttf, what should I be using then? I'm concerned about two things here. Suppose I'm loading a font for various sizes:
* I don't want to load the same font many times and have it stay in memory multiple times.
* Ideally, I don't want to load font data every time, but instead load it once and then call the texture creation function multiple times.
The thing about this is, how do you think I get the information? The fact is that I also have to look it up - whether this be in the main docs, the wikied 'setProperty' page or by digging around in the code or headers, I still end up looking most of it up. The fact that I can do this means that you can too - you'd get the answers much quicker that way
CE.
I'll try!
Who is online
Users browsing this forum: No registered users and 31 guests