Fonts on MacOSX

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
scruffya
Just popping in
Just popping in
Posts: 1
Joined: Thu Mar 17, 2005 20:13

Fonts on MacOSX

Postby scruffya » Fri Mar 18, 2005 12:29

I just upgraded CEGUI and OGRE to the newest versions,
I am running the GUI example in the OGRE Samples Directory,
my text is not displaying correctly in the CEGUI Widgets.
It has a yellow backgroud.

Guest

Re: Fonts on MacOSX

Postby Guest » Fri Mar 18, 2005 13:09

Are you sure your app is linked with the right library? After compiling CEGUI, you have to check that your ogre project accesses the new files before compiling it again.

It could also be a font problem (if you use a static font with no alpha in your image file for example). Did you modified something related with that?

--
Chris

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Fonts on MacOSX

Postby CrazyEddie » Fri Mar 18, 2005 22:10

This is an endian issue. I'm not sure where this got broken since nothing in CEGUI was changed. Obviously I want to fix this, but it's rather difficult since I don't have access to a Mac, and as such I can't reproduce the issue to debug it :?

CE.

User avatar
fats
Just popping in
Just popping in
Posts: 1
Joined: Wed May 11, 2005 17:17

Re: Fonts on MacOSX

Postby fats » Wed May 11, 2005 17:20

* Bump *

This yellow background is bugging me too. It makes the fonts almost unreadable. If somebody can point me in the right direction, I will attempt to fix the problem.

User avatar
_mental_
CEGUI Team (Retired)
Posts: 157
Joined: Wed Jan 12, 2005 12:06
Contact:

Re: Fonts on MacOSX

Postby _mental_ » Thu May 12, 2005 02:00

Unforunately I am in the same situation as CE was with regards to OSX. I'll see if I can get temas to take a look if he has time, otherwise if anyone with OSX wants to take a stab at fixing this I'd greatly appreciate it.

User avatar
zakalawe
Just popping in
Just popping in
Posts: 7
Joined: Mon May 09, 2005 07:17
Location: Edinburgh, Scotland
Contact:

Re: Fonts on MacOSX

Postby zakalawe » Thu May 12, 2005 09:34

On the quite likely assumption that I'm going to hit this issue in the near future (trying to get our 'ember' client which is Ogre + CEGUI running), could someone provide a few hints on where this problem lies, so I don't have to learn the entire codebase.

Eg, is it specific to the OGRE renderer? Does it happen on Linux-PPC? Any other hints as to where to start debugging?

User avatar
asu
Just popping in
Just popping in
Posts: 1
Joined: Wed Jun 01, 2005 08:22
Location: Lausanne, Switzerland

Re: Fonts on MacOSX

Postby asu » Wed Jun 01, 2005 08:27

In case someone is interested, this is quite an easy fix. As Crazy Eddie suggested, it's an endian issue. All i did was to implement byte swapping in the OgreCEGUITexture.cpp file inside the loadFromMemory member function.

It looks like this now:

//--asu start
//byte swapping utils

void _ByteSwap(unsigned char * b, int n)
{
register int i = 0;
register int j = n-1;
while (i<j)
{
std::swap(b[i], b[j]);
i++, j--;
}
}

#define ByteSwap(x) _ByteSwap((unsigned char *) &x,sizeof(x))
//--asu end

void OgreCEGUITexture::loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight)
{
using namespace Ogre;

// get rid of old texture
freeOgreTexture();

// wrap input buffer with an Ogre DataChunk
uint32 bytesize = ((buffWidth * sizeof(uint32)) * buffHeight);

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
//do byte swapping -- asu start
uint32 *swappedBuffer = new uint32[bytesize/4];
memcpy(swappedBuffer, buffPtr, bytesize);

for (int i=0;i<bytesize/4;i++)
ByteSwap(swappedBuffer[i]);

DataStreamPtr odc(new MemoryDataStream((void*)(swappedBuffer), bytesize, false));
// -- asu end
#else
DataStreamPtr odc(new MemoryDataStream(const_cast<void*>(buffPtr), bytesize, false));
#endif

// try to create a Ogre::Texture from the input data
d_ogre_texture = TextureManager::getSingleton().loadRawData(getUniqueName(), "General", odc, buffWidth, buffHeight, PF_A8R8G8B8, TEX_TYPE_2D, 0, 1.0f);

// if we got a pointer cache some details
if (!d_ogre_texture.isNull())
{
d_width = d_ogre_texture->getWidth();
d_height = d_ogre_texture->getHeight();
}
// no texture from memory so throw.
else
{
throw RendererException((utf8*)"Failed to create Texture object from memory: Ogre returned a NULL Ogre::Texture pointer.");
}

}

Sorry for the formating. I'm not really used to this...

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Fonts on MacOSX

Postby CrazyEddie » Wed Jun 01, 2005 08:46

Cool :)

Somebody should get this change into CVS.

Do you know if the issue affects the plain OpenGL renderer as well as the Ogre one?

Thanks for that.

CE.

User avatar
_mental_
CEGUI Team (Retired)
Posts: 157
Joined: Wed Jan 12, 2005 12:06
Contact:

Re: Fonts on MacOSX

Postby _mental_ » Thu Jun 02, 2005 02:39

I've committed this to the OGRE renderer with a small modification. Thanks!


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 15 guests