
Hello, Can anyone give me an example for fonts rendering? I tried to use FTGL library, but it is too complicated on Windows(compile). Is it possible to do it in a simple way? I need more than the given example in red book(Font.hs), something like outline font. By the way, I am new in OpenGL and Haskell, so the real exmaple should be the best. Thanks!

Hi,
The stb-truetype library (http://hackage.haskell.org/package/stb-truetype)
can rasterize TrueType fonts,
which then can be rendered with your preferred rendering method. It is
probably less mature than FTGL,
but should be easy to compile on windows (simply "cabal install
stb-truetype" should work, since
the source of the underlying C library is included in the cabal package, and
GHC includes a GCC
disribution).
Balazs
2011/2/27 er9999
Hello, Can anyone give me an example for fonts rendering? I tried to use FTGL library, but it is too complicated on Windows(compile). Is it possible to do it in a simple way? I need more than the given example in red book(Font.hs), something like outline font. By the way, I am new in OpenGL and Haskell, so the real exmaple should be the best. Thanks!
_______________________________________________ HOpenGL mailing list HOpenGL@haskell.org http://www.haskell.org/mailman/listinfo/hopengl

On Sun, Feb 27, 2011 at 10:49 AM, Balazs Komuves
The stb-truetype library (http://hackage.haskell.org/package/stb-truetype) can rasterize TrueType fonts, which then can be rendered with your preferred rendering method. It is probably less mature than FTGL, but should be easy to compile on windows (simply "cabal install stb-truetype" should work, since the source of the underlying C library is included in the cabal package, and GHC includes a GCC disribution).
You can also use cairo [1] and pango [2] from Gtk2Hs [3] for the same purpose. Although not as simple to install as stb-truetype, it is simple enough to install =). Using both will give you very high quality i18n text (I don't know about stb-freetype). [1] http://hackage.haskell.org/package/cairo [2] http://hackage.haskell.org/package/pango [3] http://www.haskell.org/gtk2hs/ Cheers! -- Felipe.

Hello,
Do you know where I can find some example code for this library? I mean how I can render the loaded font? If possible, could you give me an example how to render outline font or texture font? I cannot even find any examples in Haskell. Thanks!
-- Yu
At 2011-02-27,"Balazs Komuves"

Am 27.02.2011 07:48, schrieb er9999:
Hello, Can anyone give me an example for fonts rendering? I tried to use FTGL library, but it is too complicated on Windows(compile). Is it possible to do it in a simple way? I need more than the given example in red book(Font.hs), something like outline font. By the way, I am new in OpenGL and Haskell, so the real exmaple should be the best. Thanks! Hi
It is maybe a little bit late to answer this mail, but at the end of february my library (http://hackage.haskell.org/package/SVGFonts) was in not such a good state to advertise it. But now it has reached version 1.0 and a lot of errors have been corrected! It has most of the capabilities of freetype2, ftgl and pango in only 44KB of code. This is about 100 times smaller than freetype2. It also has a very easy and powerful interface without forcing you into using the IO monad. It is a native Haskell library without the need to install any C-library, so it should work on every operating system. It is also quite fast. The example that comes with the library generates 62 character textures in about a second. I am looking forward to adjust this library to anybodys needs (for example another scengraph). I also want to encourage people to write native libraries instead of bindings. It can be done!

On Mon, Jul 25, 2011 at 10:34 AM, Tillmann Vogt
It is maybe a little bit late to answer this mail, but at the end of february my library (http://hackage.haskell.org/package/SVGFonts) was in not such a good state to advertise it. But now it has reached version 1.0 and a lot of errors have been corrected! It has most of the capabilities of freetype2, ftgl and pango in only 44KB of code. This is about 100 times smaller than freetype2. It also has a very easy and powerful interface without forcing you into using the IO monad. It is a native Haskell library without the need to install any C-library, so it should work on every operating system.
Very interesting! =)
It is also quite fast. The example that comes with the library generates 62 character textures in about a second.
So, is 62 chars/s fast? And where is most of the time spent? Cheers, -- Felipe.

Am 25.07.2011 16:28, schrieb Felipe Almeida Lessa:
On Mon, Jul 25, 2011 at 10:34 AM, Tillmann Vogt
wrote: It is maybe a little bit late to answer this mail, but at the end of february my library (http://hackage.haskell.org/package/SVGFonts) was in not such a good state to advertise it. But now it has reached version 1.0 and a lot of errors have been corrected! It has most of the capabilities of freetype2, ftgl and pango in only 44KB of code. This is about 100 times smaller than freetype2. It also has a very easy and powerful interface without forcing you into using the IO monad. It is a native Haskell library without the need to install any C-library, so it should work on every operating system. Very interesting! =)
It is also quite fast. The example that comes with the library generates 62 character textures in about a second. So, is 62 chars/s fast? And where is most of the time spent?
Cheers,
It is probably not fast. A graphics card can raster high resoultions 100 times a second. But font libraries can't use this rasterization mechanism (I guess) because of autohinting (making fonts look good on low resoultions). For me it is fast enough. The last time I profiled the xml parsing was the biggest problem. But I haven't profiled for quite a while because of Ticket #282 of cabal. I don't want to manually compile every library with profiling.
participants (4)
-
Balazs Komuves
-
er9999
-
Felipe Almeida Lessa
-
Tillmann Vogt