Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Bug in DrawText and Font issue
Bug in DrawText and Font issue [message #13214] Sat, 22 December 2007 11:20 Go to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member

I have found 2 problems when selecting and displaying fonts:

The ***minor*** issue is that, what a particular font is, seems to be not generally acknowledged. So Ultimate++ tells me (GetFaceCount) that there are 117 fonts on my machine. MS Word finds 71 and AMP Font Viewer sees 93.

It would be nice to know exactly what criteria Ultimate++ uses to define a distinct font.

The ***major*** issue is that DrawText sometimes uses the wrong face to display text in a certain font. Namely on my machine a text in "ZapfDingbats" or in "Zymbol" is displayed in "Windings".

Please check the following listing and have a look at the attached screenshot.

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class MyWin : public TopWindow
{
	virtual void Paint(Draw& w)
	{
		w.DrawRect(GetSize(), White());
		
		Font f0(87, 12);										// @Arial Unicode MS
		
		Font f1(48, 24);										// Windings
		w.DrawText(10, 10, f1.GetFaceName(), f0, LtBlue);
		w.DrawText(10, 30, "Programming is fun!", f1, LtBlue);

		Font f2(82, 24);										// ZapfDingbats	
		w.DrawText(10, 70, f2.GetFaceName(), f0);
		w.DrawText(10, 90, "Programming is fun!", f2);

		Font f3(83, 24);										// Zymbol
		w.DrawText(10, 130, f3.GetFaceName(), f0);
		w.DrawText(10, 150, "Programming is fun!", f3);
	}
};

GUI_APP_MAIN
{
	MyWin win;
	
	win.SetRect(0, 0, 450, 200);
	win.Run();
}

Werner

index.php?t=getfile&id=891&private=0
  • Attachment: UppVsAMP.jpg
    (Size: 42.64KB, Downloaded 799 times)

[Updated on: Sat, 22 December 2007 18:45]

Report message to a moderator

Re: Bug in DrawText and Font issue [message #13216 is a reply to message #13214] Sat, 22 December 2007 17:13 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, where can I get ZapfDingbats?

Mirek
Re: Bug in DrawText and Font issue [message #13217 is a reply to message #13216] Sat, 22 December 2007 18:42 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
luzr wrote on Sat, 22 December 2007 17:13

Well, where can I get ZapfDingbats?

Mirek


I don't know where these fonts came from. Please stand by while I'am checking that.

Meanwhile you might want to have a look at the attached infos.

Werner

index.php?t=getfile&id=892&private=0
index.php?t=getfile&id=893&private=0
index.php?t=getfile&id=894&private=0
  • Attachment: WINGDING.jpg
    (Size: 24.10KB, Downloaded 784 times)
  • Attachment: ZD______.jpg
    (Size: 20.63KB, Downloaded 791 times)
  • Attachment: ZY______.jpg
    (Size: 18.21KB, Downloaded 801 times)
Re: Bug in DrawText and Font issue [message #13218 is a reply to message #13216] Sat, 22 December 2007 22:02 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
luzr wrote on Sat, 22 December 2007 17:13

Well, where can I get ZapfDingbats?

Mirek


I'm terribly sorry. Although I'm very sure that I got these fonts together with a (legally!) free application I can't tell with which one. And I can't send you these fonts as they are copyrighted.

So I'll try my best to debug the program myself hoping to trap the problem.

Any hint where to look and what to look for would be appreciated.

Anyway - thanks for being willing to help me.

Werner
Re: Bug in DrawText and Font issue [message #13225 is a reply to message #13218] Sun, 23 December 2007 18:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Werner wrote on Sat, 22 December 2007 16:02

luzr wrote on Sat, 22 December 2007 17:13

Well, where can I get ZapfDingbats?

Mirek


I'm terribly sorry. Although I'm very sure that I got these fonts together with a (legally!) free application I can't tell with which one. And I can't send you these fonts as they are copyrighted.

So I'll try my best to debug the program myself hoping to trap the problem.

Any hint where to look and what to look for would be appreciated.

Anyway - thanks for being willing to help me.

Werner



Draw/DrawTextWin32. My guess this is some encoding problem; there are some weird things about symbol fonts.

That said, I am not 100% happy with current code either; it really does strange things.

BTW, here is some useful code (I have made to test this issue):

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	ArrayCtrl a;
	a.AddColumn("Font");
	a.AddColumn("View");
	for(int i = 0; i < Font::GetFaceCount(); i++)
		a.Add(Font::GetFaceName(i), AttrText("Just a test!").SetFont(Font(i, 20)));
	a.SetLineCy(24);
	TopWindow app;
	app.Add(a.SizePos());
	app.Run();
}


Mirek
Re: Bug in DrawText and Font issue [message #13229 is a reply to message #13225] Sun, 23 December 2007 22:11 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
luzr wrote on Sun, 23 December 2007 18:55

there are some weird things about symbol fonts.

That said, I am not 100% happy with current code either; it really does strange things.



Thank you very much for your code. I hadn't the time to do some debugging today.

Anyway, just to get a first impression, here are my symbol fonts (and until now I didn't realize that they are all "symbol"):

index.php?t=getfile&id=896&private=0

But don't care for now. I'll stick to it.

Werner
  • Attachment: Symbols2.jpg
    (Size: 200.42KB, Downloaded 725 times)
Re: Bug in DrawText and Font issue [message #13231 is a reply to message #13225] Sun, 23 December 2007 22:21 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
By the way: is

a_font.GetFaceInfo();

broken or am I doing something silly?

While

dword flags = Font::GetFaceInfo(a_number);

works fine,

dword flags = a_font.GetFaceInfo();

produces failed assertions.

Werner
Re: Bug in DrawText and Font issue [message #13245 is a reply to message #13231] Tue, 25 December 2007 19:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, it is equivalent to Font::GetFaceInfo(font.GetFace())...

Mirek
Re: Bug in DrawText and Font issue [message #13257 is a reply to message #13245] Wed, 26 December 2007 11:58 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
luzr wrote on Tue, 25 December 2007 19:36

Well, it is equivalent to Font::GetFaceInfo(font.GetFace())...

Mirek


Works fine! My former assumption it might be broken seems to have been a tiredness-related syntactical source code mess. Sorry!

Eventually I'm going now to track down this "different-fonts-with-identical-faces" problem.

Werner
Re: Bug in DrawText and Font issue [message #13265 is a reply to message #13257] Wed, 26 December 2007 21:31 Go to previous messageGo to next message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
Werner wrote on Wed, 26 December 2007 11:58

Eventually I'm going now to track down this "different-fonts-with-identical-faces" problem.


Well, seems as if I were a little bit to optimistic. Obviously I'm lacking the necessary knowledge and/or experience ... Sad

Anyway:

Trying to debug yields the following temporary result:

When the calling chain reaches ExtTextOutW, the arguments are still ok. The face is still 48 (WinDings), 82 (Zapfdingbats), and 83 (Zymbol) respectively. The text is still the same (Programming is fun! Confused ). But then - if I get that right - ExtTextOutW calls a library function in GDI32.dll. And here is where my skills are exhausted.

Any ideas what else I could do?

Werner
Re: Bug in DrawText and Font issue [message #13318 is a reply to message #13265] Tue, 01 January 2008 10:58 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Start meddling with ExtTextOutW parameters Wink

Mirek
Previous Topic: Antialiasing for lines
Next Topic: Image into a polimorphic array
Goto Forum:
  


Current Time: Fri Mar 29 12:38:13 CET 2024

Total time taken to generate the page: 0.01245 seconds