octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text properties and FTGL


From: John Swensen
Subject: Text properties and FTGL
Date: Sat, 25 Oct 2008 22:06:01 -0400

So I have been messing around with FTGL today and it looks quite easy to use. I was able to get the xlabel, ylabel, and zlabel working (kindof!) and have a few questions and comments.

Comments
FTGL is very easy to use. I used their simple little singleton class example from the web page for getting fonts back to octave and then did a simple render of the label property in label sections of the opengl_renderer::draw() function in gl-render.cc. I used the FTTextureFont, since it appears that it is the only one that is anti- aliased and allows difference colors.

Problems
1) At first, I was trying the following command to draw a sample plot and xlabel: t=-pi:0.1:pi; plot(t,sin(t),'ro','LineWidth',2); xlabel('asdfASDFQWERqwerZXCVzxcvasdfASDF'); The text was showing up very, very large even for a fontsize of 12 points with a 72 points per inch resolution. When I tried to reduce the fontsize down below a out 5, the text simply disappeared and even at 6 it was huge. Not even the first letter 'a' was visible in its entirety on the screen. I was quite confused.
Then, I tried the following command for plotting:
t = -100:100; plot(t,100*sin(t),'r'); xlabel('asdfASDFqwerQWERzxcvZXCV'); With this command, the text looked much more reasonably sized so I cam to the conclusion that the OpenGL render method is really plotting at the size of the signal values, rather than scaling up to some sort of default size. I think we need to scale up the plots so that 12 points in text with a 72 ppi screen is really 12 points. (BIG CAVEAT: I know next to nothing about OpenGL, so I am not a lot of help when having to do low level OpenGL stuff.)

Also, I searched around on the internet a bit about fonts in OpenGL and it seems that FTGL using Freetype is in fact the "best" option out there. However, it seemed that there is a general consensus that OpenGL doesn't do small font sizes well. Things start to get fuzzy and then disappear (just like I was seeing when I thought just shrinking the fontsize property would fix things). Since I don't know OpenGL I can' t appreciate why this happens, but I think that scaling the plots to match the text size should work, since I don't know of many situations where a font size smaller than 6 pt is necessary anyway.

I guess I don't think a patch would be in order right now since the labels aren't very useful when their size changes relative to the plot at hand.

2) The position property is not working for the xlabel position property. I guess maybe this is expected behavior. I don't know if Matlab allows you to update the label positions after they have been drawn or not.

I'll let you know when I have more figured out.

John Swensen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]