- procedure TFramework.Write(s: String);
- var
- x, y: float;
- w, h: float;
- i: integer;
- c: byte;
- fnt: PTexFont;
- begin
- if (ActiveFont<Fonts) and (Font[ActiveFont]<>NIL) then
- fnt := Font[ActiveFont]
- else
- exit;
- x := 0;
- y := 0;
- fnt.Tex.Display;
- glBegin(GL_QUADS);
- for i:=1 to Length(s) do begin
- c := Ord(s[i]);
- w := fnt.CharPos[c].x2 - fnt.CharPos[c].x1;
- h := fnt.CharPos[c].y2 - fnt.CharPos[c].y1;
- if c=fnt.CR then begin
- x := 0;
- y := y - h;
- end
- else begin
- glTexCoord2f(fnt.CharPos[c].x1, fnt.CharPos[c].y2);
- glVertex2f(x*fnt.XScale, y*fnt.YScale);
- glTexCoord2f(fnt.CharPos[c].x2, fnt.CharPos[c].y2);
- glVertex2f((x+w)*fnt.XScale, y*fnt.YScale);
- glTexCoord2f(fnt.CharPos[c].x2, fnt.CharPos[c].y1);
- glVertex2f((x+w)*fnt.XScale, (y+h)*fnt.YScale);
- glTexCoord2f(fnt.CharPos[c].x1, fnt.CharPos[c].y1);
- glVertex2f(x*fnt.XScale, (y+h)*fnt.YScale);
- x := x + w;
- end;
- end;
- glEnd;
- end;