[GRASS-dev] nviz font settings no longer working, at least on Mac TclTk 8.5 aqua

Glynn Clements glynn at gclements.plus.com
Wed Dec 24 23:12:21 EST 2008


Michael Barton wrote:

> Anyone have any idea why nviz is no longer displaying a font specified  
> in this way?
> 
>      set labelfont "*-$Nv_(labelFontType)-$weight-$slant-normal-$style-$Nv_(labelFontSize)-*-*-*-*-*-*-*"
> 
>      Nplace_label $Nv_(label_text) $labelfont $Nv_(labelFontSize) $clr $sx $sy
> 
> 
> I'm trying to clean up interface anomalies in TclTk aqua and found  
> that you can no longer specify fonts in nviz panels. I don't know if  
> this is just an aqua thing or if it is happening in x11 varieties of  
> nviz too. Could someone take a look at the label panel and let me know.

AFAICT, Togl has never supported setting the font on OSX. The relevant
code is togl.c:3142:

#  elif defined(TOGL_AGL_CLASSIC) || defined(TOGL_AGL)
    aglUseFont(togl->aglCtx, 1, 0, 14,  /* for now, only app font, regular
                                         * 14-point */
            10, 118, fontbase + first);
#  endif

If you want to use some other font with aglUseFont, you would need to
use the relevant OSX API to get the handle, which probably isn't going
to accept XLFDs (also, the API in question is labelled "obsolete" in
the Apple documentation).

So far as Togl and OpenGL are concerned, a font is just a contiguous
sequence of display lists. Once the lists have been defined, you can
use glListBase() and glCallLists() to execute a sequence of display
lists whose indices are stored in an array (this can be an array of
bytes, i.e. a char*, or a wider type).

A consequence of this is that the code in the display library for
obtaining FreeType (or FontConfig) glyphs could be re-used within nviz
(or nviz2) to avoid issues with th platform-specific font
implementations.

Actually, it could support stroke fonts as well; the display lists
aren't limited to bitmaps (although you have to consider scaling,
lighting, etc if you use 3D geometry).

It's probably a bit late to do that for 6.4.0, though.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list