PyOpengl text rendering with autocad font

Mike C. Fletcher mcfletch at rogers.com
Thu Dec 15 19:59:27 CET 2005


Marco wrote:

>I must use text in Opengl, Python
>This text is for architecture design then I need to use AutoCad fonts
>(extension .shx).
>I have two troubles:
>
>I don't find a guide, a good program, something for use any kind of
>fonts in PyOpengl. The nehe tutorial has some bugs in translation to
>Python.
>I need to scale rotate the text.
>  
>
For general font rendering you can choose two major approaches, either 
use a built-in platform-Dependant system (such as seen in the NeHe 
tutorial) or code your own to render the individual characters using 
either one of the cross-platform GUI libraries (2D text) or TTFQuery 
(3D/polygonal text (i.e. you can rotate in all 3 dimensions)).  There is 
a NeHe tutorial translation for the font-rendering demo in 
OpenGLContext's tests directory.  To render text in general, see the 
OpenGLContext/scenegraph/text/* modules.  However, none of those knows 
how to handle .shx files, they load TTF fonts instead.

>I don't know anything about handling fonts, I must use this .shx but I
>don't know. In which way can I take this file and put them in my
>programs?
>  
>
If you can find a format specification you may be able to write an 
importer (IIRC SHX fonts are just series of lines, so would be very easy 
to render once you have the format read).  You might find it easier to 
redefine the process as "tell autocad to use truetype, then render 
truetype" if whoever is asking for .shx will allow it.

>If somebody wants to help me :-)
>Thanks.
>  
>
HTH,
Mike

-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com




More information about the Python-list mailing list