Commit 7d047fd54b1d454a701df0f1400a5e8fa7141b22

sammy 2008-05-09T13:42:25

* Add a few pictures to the documentation to illustrate what the font objects look like. * Generate EPS files at build time if the LaTeX output is activated.

diff --git a/configure.ac b/configure.ac
index 35eb22a..7ebb818 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,8 +69,10 @@ AM_CONDITIONAL(HAVE_DOXYGEN, test "x$DOXYGEN" != "xno")
 AC_PATH_PROG(LATEX, pdflatex, no)
 AC_PATH_PROG(KPSEWHICH, kpsewhich, no)
 AC_PATH_PROG(DVIPS, dvips, no)
+AC_PATH_PROG(CONVERT, convert, no)
 AC_PATH_PROG(EPSTOPDF, epstopdf, no)
-if test "x${DVIPS}" = "xno" -o "${KPSEWHICH}" = "no" -o "${EPSTOPDF}" = "no"; then
+if test "${DVIPS}" = "no" -o "${KPSEWHICH}" = "no" -o "${EPSTOPDF}" = "no" \
+     -o "${CONVERT}" = "no"; then
   LATEX="no"
 fi
 if test "x${LATEX}" != "xno"; then
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 33459a8..c95cbd8 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -8,15 +8,23 @@ pdfdoc_DATA = latex/ftgl.pdf
 endif
 endif
 
-IMAGES = \
-    images/ftgl.png \
+PNGS = \
+    images/logo.png \
     images/metrics.png \
+    images/rasterfont.png \
+    images/vectorfont.png \
+    images/texturefont.png \
     $(NULL)
 
+stamp-eps: $(PNGS)
+if HAVE_LATEX
+	for i in $^; do convert $$i $$(echo $$i | sed 's/png$$/eps/'); done
+endif
+	touch $@
+
 html/doxygen.css: stamp-doxygen
-stamp-doxygen: doxygen.cfg
+stamp-doxygen: doxygen.cfg stamp-eps
 	$(DOXYGEN) $^
-	cp $(IMAGES) html/
 	touch $@
 
 latex/ftgl.pdf: stamp-latex
@@ -31,7 +39,8 @@ stamp-latex: stamp-doxygen
 clean: clean-local
 clean-local:
 	$(RM) -rf html latex
-	$(RM) stamp-doxygen stamp-latex
+	$(RM) -f images/*.eps
+	$(RM) -f stamp-doxygen stamp-latex stamp-eps
 
 if HAVE_DOXYGEN
 install-data-local: html/doxygen.css
@@ -45,7 +54,7 @@ EXTRA_DIST = \
     doxygen.cfg.in \
     ftgl.dox \
     FTGL_1_3.gif \
-    $(IMAGES) \
+    $(PNGS) \
     images/metrics.svg \
     $(NULL)
 
diff --git a/docs/ftgl.dox b/docs/ftgl.dox
index 3b045e3..b3f3dac 100644
--- a/docs/ftgl.dox
+++ b/docs/ftgl.dox
@@ -1,22 +1,23 @@
 /** \mainpage FTGL User Guide
 
- \image html ftgl.png
+ \image html logo.png
+ \image latex logo.eps "" width=0.3\textwidth
 
  \section intro Introduction
 
  OpenGL doesn't provide direct font support, so the application must use any
  of OpenGL's other features for font rendering, such as drawing bitmaps or
  pixmaps, creating texture maps containing an entire character set, drawing
- character outlines, or creating 3D geometry for each character.
+ character outlines, or creating a 3D geometry for each character.
 
- http://www.opengl.org/resources/faq/technical/fonts.htm
+ More information can be found on the OpenGL website:
+ - http://www.opengl.org/resources/faq/technical/fonts.htm
+ - http://www.opengl.org/resources/features/fontsurvey/
 
- http://www.opengl.org/resources/features/fontsurvey/
+ Most of these systems require a pre-processing stage to take the native fonts
+ and convert them into a proprietry format.
 
- One thing all of these systems have in common is they require a pre-processing
- stage to take the native fonts and convert them into a proprietry format.
-
- FTGL was born out of the need to treat fonts in OpenGL applications just like
+ %FTGL was born out of the need to treat fonts in OpenGL applications just like
  any other application. For example when using Adobe Photoshop or Microsoft
  Word you don't need an intermediate pre-processing step to use high quality
  scalable fonts.
@@ -24,28 +25,41 @@
 
  \section type Choosing a font type
 
- FTGL supports 6 font output types among 3 groups: raster fonts, vector fonts
- and texture fonts, which are a mixture of both. Each font type has its
+ %FTGL supports 6 font output types among 3 groups: raster fonts, vector
+ fonts, and texture fonts which are a mixture of both. Each font type has its
  advantages and disadvantages.
 
- The two raster types are:
+ \subsection raster Raster fonts
+
+ Raster fonts are made of pixels painted directly on the viewport's
+ framebuffer. They cannot be directly rotated or scaled.
+
+ - Bitmap fonts use 1-bit (2-colour) rasterised glyphs.
+ - Pixmap fonts use 8-bit (256 levels) rasterised glyphs.
+
+ \image html rasterfont.png
+ \image latex rasterfont.eps "" width=0.7\textwidth
 
- - Bitmapped
- - Antialiased pixmapped
+ \subsection vector Vector fonts
 
- The vector types are:
+ Vector fonts are 3D objects that are rendered at the current matrix location.
+ All position, scale, texture and material effects apply to vector fonts.
 
- - Outline
- - Polygonal
- - Extruded polygon
+ - Polygon fonts use planar triangle meshes and can be texture-mapped.
+ - Outline fonts use OpenGL lines.
+ - Extruded fonts are extruded polygon fonts, with the front, back and side
+   meshes renderable separately to apply different effects and materials.
 
- The last, hybrid type is:
+ \image html vectorfont.png
+ \image latex vectorfont.eps "" width=0.7\textwidth
 
- - Texture mapped
+ \subsection texture Texture fonts
 
- This is probably the most versatile type. It is fast, antialised and can be
- transformed just like any openGL primitive.
+ Texture fonts are probably the most versatile type. They are fast,
+ antialiased, and can be transformed just like any OpenGL primitive.
 
+ \image html texturefont.png
+ \image latex texturefont.eps "" width=0.7\textwidth
 
  \section creating Creating a font
 
@@ -81,6 +95,7 @@ font.Advance("0123456789");
  \subsection metrics Font metrics
 
  \image html metrics.png
+ \image latex metrics.eps "" width=0.5\textwidth
 
  If you ask a font to render at 0.0, 0.0 the bottom left most pixel or polygon
  may not be aligned to 0.0, 0.0. With FTFont::Ascender(), FTFont::Descender()
@@ -99,8 +114,8 @@ font.Advance("0123456789");
  character codes if it finds one. Otherwise, it tries to find support for
  Latin-1, then ASCII."
 
- It then gives up. In this case FTGL will set the charmap to the first it finds
- in the fonts charmap list. You can expilcitly set the char encoding with
+ It then gives up. In this case %FTGL will set the charmap to the first it
+ finds in the fonts charmap list. You can expilcitly set the char encoding with
  FTFont::CharMap().
 
  Valid encodings as of FreeType 2.0.4 are:
@@ -133,9 +148,9 @@ font.CharMap(ft_encoding_apple_roman);
 
  \subsection faq1 When I try to compile FTGL it complains about a missing file from the include: #include <ft2build.h>
 
- FTGL relies on FreeType 2 for opening and decoding font files. This include
+ %FTGL relies on FreeType 2 for opening and decoding font files. This include
  is the main include for FreeType. You will need to download Freetype 2 and
- install it. Then make sure that the FTGL project that you are using points to
+ install it. Then make sure that the %FTGL project that you are using points to
  your FreeType installation.
 
  \subsection faq2 Is it possible to map a font to a "unit" size? My application relies on the fonts being a certain "physical" height (in OpenGL coordinate space) rather than a point size in display space. Any thoughts/suggestions?
@@ -176,7 +191,7 @@ gluPerspective(90, window_height / 2 , small_number, large_number);
  probelm, I can fix this.
 
  Early on I did a lot of head scratching over the OpenGL unit to font size
- thing because when I was first integrating FTGL into my engine the fonts
+ thing because when I was first integrating %FTGL into my engine the fonts
  weren't the size I was expecting. I was tempted to build in some scaling but I
  decided doing nothing was the best approach because you can't please everyone.
  Plus it's 'correct' as it is.
diff --git a/docs/images/ftgl.png b/docs/images/ftgl.png
deleted file mode 100644
index a9fc1e8..0000000
Binary files a/docs/images/ftgl.png and /dev/null differ
diff --git a/docs/images/logo.png b/docs/images/logo.png
new file mode 100644
index 0000000..a9fc1e8
Binary files /dev/null and b/docs/images/logo.png differ
diff --git a/docs/images/rasterfont.png b/docs/images/rasterfont.png
new file mode 100644
index 0000000..424f3a3
Binary files /dev/null and b/docs/images/rasterfont.png differ
diff --git a/docs/images/texturefont.png b/docs/images/texturefont.png
new file mode 100644
index 0000000..e326e30
Binary files /dev/null and b/docs/images/texturefont.png differ
diff --git a/docs/images/vectorfont.png b/docs/images/vectorfont.png
new file mode 100644
index 0000000..164c806
Binary files /dev/null and b/docs/images/vectorfont.png differ