text2d package updated

Because of bugs and inconsistencies I decided to update the text2d package. It now has a bit nicer fonts, but I still need to play around with the stretch factor. And you can now use different font sizes. And the code has become much cleaner. Of course I sticked to the coding style found there :wink:

Please tell me if it breaks anything by accident.

Marvin

EDIT: Ah, before I forget: It is now able to display letters of different widths correctly, which also results in nicer texts, because an ā€œiā€ doesnā€™t always necessarily need as much place as an ā€œXā€ as it was before.

i canā€™t say iā€™m happy with you changing stuff all over the cvs tree ā€¦ but i guess in this case it was for good ā€¦ my stuff is very unorganized :wink:

Ah, Youā€™re Florian Hofmann. Grmpf, I could have known that. Sorry, if I knew it, I would certainly have asked before I made this change. Since most original authors are gone and have never been seen anymore and have left some bugs, the project in dead in some parts. I try to revive these parts.

Are there any lines that annoy you?

Marvin

Changing the code in some belongs is necessary because we donā€™t have a committee like e.g. sun has, that discusses for a long time to result in a stable and elaborative API just to be implemented. Some authors code something and after a time theyā€™re not actively developing anymore. If there are bugs in the coding they wrote, someone has to fix it. Since the original author has gone someone else has to take the code and fix it. Well in your case it was a misunderstanding by myself :wink:
From time to time (or constantly) an API has to be updated (e.g. for Java 1.5 compliance) which results in a more or less slightly changing API. But I think itā€™s just normal.

If really many people have developed on a project over the time that havenā€™t taken part in a committee, one has to clean up the project, when it has become too untidy. This untidyness shell not offend anyone, itā€™s just normal.

Well, thatā€™s what I want to do.

Marvin

Hello Marvin,
First off, I want to say that I donā€™t use Xith, so I have no idea of the impact of your changes. Reading the forums, I gather youā€™re changing quite a bit.

Of course, the effort is very laudable, but I think you underestimate the impact of changing the API like you do. It stops developers from upgrading to the newer version with confidence, and it will eventually discourage them from using the Xith library at all. Once a library has reached a certain maturity, some ugly parts will just have to be left in, if only to remain backwards compatible.

If you look at the example you yourself gave (the Java API as specified by Sun), youā€™ll notice that very few of the legacy methods and classes actually completely disappear. Sun will mark them ā€œdeprecatedā€ and discourage their use, but they are still there! Some methods have been deprecated since Java 1.0, and yet Sun does not remove them. This must mean Sun appreciates the importance of backward compatibility, doesnā€™t it ?

the API changes are quite small, but the code changes are bigger.

Youā€™re absolutely right, but I guess you got me a bit wrong. I wrote ā€œplease tell me, if it brakes something for youā€, because I thought, not so many people actually use the text2d library at the moment or they donā€™t use it very extensively, such that these changes donā€™t matter at all. But if they do, I will add the changed methods as deprecated. I think this should be ok.

@Qudus : ā€œbreakā€, not ā€œbrakeā€ :wink:
And good workā€¦ But, heh I get a NullPointerException, see the stack trace :


java.lang.NullPointerException
	at org.xith3d.ui.hud.HUD.resize(HUD.java:181)
	at org.xith3d.ui.hud.HUD.<init>(HUD.java:594)
	at org.xith3d.ui.hud.HUD.createAndInitialize(HUD.java:813)
	at org.xith3d.ui.hud.HUD.createAndInitialize(HUD.java:844)
	at org.xith3d.ui.hud.QuickHUD.<init>(QuickHUD.java:21)
	at org.stratagem.AnimatedModelViewer.initHUD(AnimatedModelViewer.java:332)
	at org.stratagem.AnimatedModelViewer.<init>(AnimatedModelViewer.java:295)
	at org.stratagem.AnimatedModelViewer.main(AnimatedModelViewer.java:269)

Whatā€™s happening, huh ?

[quote="<MagicSpark.org [ BlueSky ]>,post:7,topic:27947"]
@Qudus : ā€œbreakā€, not ā€œbrakeā€ :wink:
[/quote]
Iā€™ll have to remember, finally :slight_smile:

[quote="<MagicSpark.org [ BlueSky ]>,post:7,topic:27947"]
And good workā€¦ But, heh I get a NullPointerException, see the stack trace :


java.lang.NullPointerException
	at org.xith3d.ui.hud.HUD.resize(HUD.java:181)
	at org.xith3d.ui.hud.HUD.<init>(HUD.java:594)
	at org.xith3d.ui.hud.HUD.createAndInitialize(HUD.java:813)
	at org.xith3d.ui.hud.HUD.createAndInitialize(HUD.java:844)
	at org.xith3d.ui.hud.QuickHUD.<init>(QuickHUD.java:21)
	at org.stratagem.AnimatedModelViewer.initHUD(AnimatedModelViewer.java:332)
	at org.stratagem.AnimatedModelViewer.<init>(AnimatedModelViewer.java:295)
	at org.stratagem.AnimatedModelViewer.main(AnimatedModelViewer.java:269)

Whatā€™s happening, huh ?
[/quote]
Can you paste your code? Iā€™m not getting this error.


QuickHUD hud = new QuickHUD();

Heheh ;D

[quote="<MagicSpark.org [ BlueSky ]>,post:9,topic:27947"]


QuickHUD hud = new QuickHUD();

Heheh ;D
[/quote]
Ok, Iā€™ll check it.

Strange. Iā€™m still not getting this error. Please try to find you, which part of your code produces this error.

Are you using Canvas3DWrapper?

Yes :


env.addCanvas(new Canvas3DWrapper(Resolution.RES_800X600,
				ColorDepth.B24, DisplayMode.FULLSCREEN, frame));

But I donā€™t use createStandalone() cause it doesnā€™t permit me to specify the owner of the canvas.

[quote="<MagicSpark.org [ BlueSky ]>,post:12,topic:27947"]
But I donā€™t use createStandalone() cause it doesnā€™t permit me to specify the owner of the canvas.
[/quote]
Thatā€™s not necessary, because there is Canvas3DPanel, which is much easier to use in this case. But using the contructor this way should be fine, too.

Please Qudus, re-add the constants for text alignment in the Text2D class and mark them as deprecated.

Thatā€™s a good exercise for you to keep backward compatibility.

[quote="<MagicSpark.org [ BlueSky ]>,post:14,topic:27947"]
Please Qudus, re-add the constants for text alignment in the Text2D class and mark them as deprecated.

Thatā€™s a good exercise for you to keep backward compatibility.
[/quote]
ok :slight_smile:

[quote="<MagicSpark.org [ BlueSky ]>,post:14,topic:27947"]
Please Qudus, re-add the constants for text alignment in the Text2D class and mark them as deprecated.

Thatā€™s a good exercise for you to keep backward compatibility.
[/quote]
Done. Should be absolutely backwards compatible now. :slight_smile:

Done. Should be absolutely backwards compatible now. :slight_smile:
[/quote]
Good.