DGL
https://delphigl.com/forum/

How to rotate font with wglUseFontBitmaps ?
https://delphigl.com/forum/viewtopic.php?f=19&t=4051
Seite 1 von 1

Autor:  joseph74 [ Di Apr 19, 2005 10:42 ]
Betreff des Beitrags:  How to rotate font with wglUseFontBitmaps ?

hi,
i have problem with fonts !
How to rotate font with wglUseFontBitmaps ?

Code:
  1. font := CreateFont(-24,                        
  2.                       0,                                  
  3.                       0,                                  // < ------ escapement no work !!!!!
  4.                       0,                                  // <--------orientation no work !!!!!
  5.                       FW_BOLD,                  
  6.                       0,                                  
  7.                       0,                                  
  8.                       0,                                
  9.                       ANSI_CHARSET,                      
  10.                       OUT_TT_PRECIS,                      
  11.                       CLIP_DEFAULT_PRECIS,                
  12.                       ANTIALIASED_QUALITY,                
  13.                       FF_DONTCARE or DEFAULT_PITCH,      
  14.                       'Courier New');              
  15.   SelectObject(h_dc,font);                              
  16.   wglUseFontBitmaps(h_dc,32,96,base);                    
  17.  

help me !!!!!

thanks

Moderiert von Lossy eX: Pascal Tags added

Autor:  Lossy eX [ Di Apr 19, 2005 11:27 ]
Betreff des Beitrags: 

I don't know if it possible. I've never tryed out. But BitmapFonts are not very flexible. It's better you use Texturefonts. There where normally polygons with some parts of an textur they contained a complete list of chars. Then it's possible to rotate the text dynamically.

I've made an class that contains this functionality. But at this moment i dosn't uploaded the generation tool. But i can do it.

glText.pas with Font classes (TglTextureText is intresting for you)
glBitmap.pas where needed.

You also need our OpenGL Header.

Dateianhänge:
Dateikommentar: Tahoma sample font until i uploaded the generator.
tahoma.zip [4.6 KiB]
358-mal heruntergeladen

Autor:  joseph74 [ Mi Apr 20, 2005 09:31 ]
Betreff des Beitrags: 

thanks for your answer !
i am beginer.
I can find some example?

thanks.

Autor:  Lossy eX [ Mi Apr 20, 2005 11:12 ]
Betreff des Beitrags: 

Creating Font
Code:
  1.   Font := TglTextureText.Create(); // Create Fontclass
  2.   Font.Texture := TglBitmap2D.Create();  // Create and Assign Fonttexture
  3.   Font.Texture.LoadFromFile('Tahoma.bmp');  // Load Fonttexture
  4.   Font.Texture.SetFilter(GL_NEAREST, GL_NEAREST);  // No Texturefiltering
  5.   Font.Texture.BuildMipMaps := False; // No MipMaps
  6.   Font.Texture.TextureFormat := tf32Bit; // 32 Bits color Delpth. Also could be tf16. But tfCompressed could have bad quality with some fonts
  7.   Font.Texture.GenTexture;  // Create OpenGL Texture
  8.   Font.UseAlphaFunc := True;  // using Alphafunc when drawing Font
  9.   Font.UseBlendFunc := True;  // using Blendfunc when drawing Font
  10.   Font.ReadCharWidthsFromIni('Tahoma.ini', 'Char Widths');  // Read char widths from ini
  11.   Font.BuildFont;  // Generate Displaylists with chars


Destroying Font
Code:
  1.   Font.Texture.Free;
  2. Font.Free;


Texture can be shared so you must create and free it separately.

Drawing with Font
Code:
  1.  
  2.   glColor;
  3.   glPushMatrix;
  4.     glTranslate;
  5.     Font.PrintText('Text');
  6.   glPopMatrix;
  7.  

Autor:  joseph74 [ Di Apr 26, 2005 08:35 ]
Betreff des Beitrags: 

Thank !!

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/