fnt moved to the TextFont so can b called later:
Code: procedure MakeRasterFont(var TextSystem : TTextSystem); begin TextSystem.Font.ID := glGenLists (128); // generate 128 display lists TextSystem.Font.fnt := CreateFont(TextSystem.Font.Height, TextSystem.Font.Width,0,0, FW_NORMAL, 0, 0, 0, OEM_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY , FF_DONTCARE + DEFAULT_PITCH, Pchar(TextSystem.Font.Name)); SelectObject(h_DC, TextSystem.Font.fnt); wglUseFontBitmaps(h_DC, 0, 127, TextSystem.Font.ID); end;
Modifyed bit that sets up the charactors in the TextSystem:
Code: MakeRasterFont(TextSystem); SelectObject(h_DC, TextSystem.Font.fnt); L := 0; for x := 0 to TextSystem.Charactor_No-1 do begin if not GetCharWidth32(h_DC,Ord(S[x+1]),Ord(S[x+1]),TextSystem.Charactors[x].Width) then messagebox(0,'Error: Couldn`t get Width','Text Error',0); TextSystem.Charactors[x].Charactor := S[x+1]; TextSystem.Charactors[x].Alpha := 1; TextSystem.Charactors[x].Colour := SetVector(1,1,1); TextSystem.Charactors[x].Draw := true; L := L + TextSystem.Charactors[x].Width; TextSystem.Charactors[x].Position.X := 50 + L;//X*TextSystem.Font.Width; TextSystem.Charactors[x].Position.Y := 50; end;
Going by This the untyped varible is a integer.
Attachment shows x and M overlap with other charactors.
EDIT: nm stupid error on my part
Code: L := L + TextSystem.Charactors[x].Width; TextSystem.Charactors[x].Position.X := 50 + L;//X*TextSystem.Font.Width;
should have been
Code: TextSystem.Charactors[x].Position.X := 50 + L;//X*TextSystem.Font.Width; L := L + TextSystem.Charactors[x].Width;
Thx for ur help SOS.
Dateianhänge: |
Dateikommentar: Text not right, X and M overlapp.

notrighttext.JPG [ 1.36 KiB | 3262-mal betrachtet ]
|
|