Class TGLBitmapFont_Abstract

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TGLBitmapFont_Abstract = class(TObject)

Description

Hierarchy

Overview

Fields

Protected fRowHeight: Integer;

Methods

Public procedure PrintAndMove(const s: string); virtual; abstract;
Public procedure PrintAndMoveFmt(const s: string; const args: array of const);
Public procedure Print(const s: string);
Public procedure PrintFmt(const s: string; const args: array of const);
Public function TextWidth(const s: string): integer; virtual; abstract;
Public function TextHeight(const s: string): integer; virtual; abstract;
Public function Descend: integer; virtual;
Public procedure BreakLines(const unbroken: string; broken: TStrings; maxLineWidth: integer); overload;
Public procedure BreakLines(unbroken, broken: TStrings; maxLineWidth: integer); overload;
Public procedure BreakLines(broken: TStrings; maxLineWidth: integer; firstToBreak: integer); overload;
Public function MaxTextWidth(slist: TStringList): integer;
Public procedure PrintStrings(strs: TStrings; BonusVerticalSpace: TGLint); overload;
Public procedure PrintStrings(const strs: array of string; BonusVerticalSpace: TGLint); overload;
Public procedure PrintStrings(strs: TStrings; BonusVerticalSpace: TGLint; RasterX0, RasterY0: integer); overload;
Public procedure PrintStrings(const strs: array of string; BonusVerticalSpace: TGLint; RasterX0, RasterY0: integer); overload;
Public function PrintBrokenString(const s: string; MaxLineWidth, RasterX0, RasterY0: Integer; RasterPositionsFirst: boolean; BonusVerticalSpace: Integer): Integer;
Public procedure PrintStringsBorderedRect(const strs: array of string; BonusVerticalSpace: TGLint; const InsideCol, BorderCol, TextCol: TVector4f; Stipple: PPolygonStipple; BoxPixelMargin: integer; const XPixelsRes, YPixelsRes: TGLfloat); overload;
Public procedure PrintStringsBorderedRect(strs: TStringList; BonusVerticalSpace: TGLint; const InsideCol, BorderCol, TextCol: TVector4f; Stipple: PPolygonStipple; BoxPixelMargin: integer; const XPixelsRes, YPixelsRes: TGLfloat); overload;
Public procedure Projection2DPrintStrings(X, Y: Integer; S: TStrings); overload;
Public procedure Projection2DPrintStrings(X, Y: Integer; S: string); overload;

Properties

Public property RowHeight: integer read fRowHeight;

Description

Fields

Protected fRowHeight: Integer;
 

Methods

Public procedure PrintAndMove(const s: string); virtual; abstract;

PrintAndMove wypisuje string s przesuwajac raster pos po wypisaniu kazdej literki. W rezultacie, po zakonczeniu mozesz np. wywolac PrintAndMove jeszcze raz i bedziesz pisal od miejsca na ekranie w ktorym skonczyles, inaczej mowiac PrintAndMove('whatever') is exactly equivalent to PrintAndMove('what'); PrintAndMove('ever'); (except for some extremely small additional performance cost in the latter case).

Public procedure PrintAndMoveFmt(const s: string; const args: array of const);
 
Public procedure Print(const s: string);

Print saves current raster position, calls PrintAndMove and then restores raster position. So Print effectively prints the string without affecting current raster pos. And if you care about performance, you should note that if you simply don't care about position of raster after Printing a string than you should use PrintAndMove instead of Print.

Public procedure PrintFmt(const s: string; const args: array of const);
 
Public function TextWidth(const s: string): integer; virtual; abstract;
 
Public function TextHeight(const s: string): integer; virtual; abstract;
 
Public function Descend: integer; virtual;

Descend : jak gleboko moze spasc charakter ponizej wysokosci 0 ? Domyslnie brane jest TextHeight('y')-TextHeight('a'), mozesz pokryc ta metode w swojej klasie aby dostarczyc jakiejs dokladniejszej / inaczej liczonej informacji.

Public procedure BreakLines(const unbroken: string; broken: TStrings; maxLineWidth: integer); overload;

procedury BreakLines lamia string (w ktorym moga byc juz zlamane miejsca nl, zostana one poprawnie zauwazone) lub TStrings w taki sposob aby zadna linia nie miala TextWidth wiekszego niz maxLineWidth. Zawartosc unbroken nie jest w zaden sposob modyfikowana. Dotychczasowa zawartosc broken zostaje zachowana, nowe stringi zostana dopisane na koniec broken. firstToBreak mowi od ktorej linii zaczac lamanie.

Stara sie polamac PRAWIE za wszelka cene. To znaczy np. stara sie lamac na bialych znakach, ale jezeli w stringu jest za dlugi wyraz bez bialych znakow to tez go zlamie. Jedyna sytuacja w ktorej wynikowy MaxLineWidth() dla tak polamanej listy nie bedzie spelniac ograniczenia to gdy jeden ze znakow uzytych w tekscie jest SAM wiekszy od narzuconego maxLineWidth. Wtedy po prostu nie da sie zlamac stringa zadowalajaco - ponizsze procedury zezwola wtedy na to aby ten jeden znak byl sam w linii i naruszal ograniczenie maxLineWidth.

Public procedure BreakLines(unbroken, broken: TStrings; maxLineWidth: integer); overload;
 
Public procedure BreakLines(broken: TStrings; maxLineWidth: integer; firstToBreak: integer); overload;
 
Public function MaxTextWidth(slist: TStringList): integer;

MaxTextWidth - najwieksze TextWidth(slist[i]) gdzie i przebiega 0..slist.count-1

Public procedure PrintStrings(strs: TStrings; BonusVerticalSpace: TGLint); overload;

Print strings from 0 to strs.count-1 using this font. glRasterPosi(RasterX0, RasterY0) is the position of the last string, each previous string will be RowHeight + BonusVerticalSpace higher, and so on (BonusVerticalSpace CAN be <0, only (RowHeight + BonusVerticalSpace) must be > 0).

Wersje 2-arg uznaja RasterX0 = RasterY0 = 0.

glRasterPos value will be ignored and then modified by this method.

Public procedure PrintStrings(const strs: array of string; BonusVerticalSpace: TGLint); overload;
 
Public procedure PrintStrings(strs: TStrings; BonusVerticalSpace: TGLint; RasterX0, RasterY0: integer); overload;
 
Public procedure PrintStrings(const strs: array of string; BonusVerticalSpace: TGLint; RasterX0, RasterY0: integer); overload;
 
Public function PrintBrokenString(const s: string; MaxLineWidth, RasterX0, RasterY0: Integer; RasterPositionsFirst: boolean; BonusVerticalSpace: Integer): Integer;

Lamie string s (uzywajac BreakLines, wiec oryginalne #13 i #10 w stringu sa uwzglednione i string jest dzielony tak zeby zadna jego linia nie miala wiecej niz MaxLineWidth).

Potem wypisuje string. Jezeli RasterPositionsFirst to RasterX0, RasterY0 okresla pozycje pierwszego stringu na liscie, wpp. okresla pozycje ostatniego. Kolejne linie sa wypisywane kazda o RowHeight + BonusVerticalSpace nizej niz poprzednia (tak jak w PrintStrings, wymagane jest tylko zeby (RowHeight + BonusVerticalSpace) > 0).

Funkcja zwraca liczbe linii jakie uzyskano po zlamaniu stringu s. W ten sposob mozesz np. obliczyc pozycje jaka miala na ekranie pierwsza / ostatnia ze zlamanych linii (to ktora z tych wartosci bylaby dla ciebie nieznana zalezy od tego ktora z tych wartosci podales, czyli od RasterPositionsFirst).

Public procedure PrintStringsBorderedRect(const strs: array of string; BonusVerticalSpace: TGLint; const InsideCol, BorderCol, TextCol: TVector4f; Stipple: PPolygonStipple; BoxPixelMargin: integer; const XPixelsRes, YPixelsRes: TGLfloat); overload;

rysuje strs kolorem StringCol i otacza je prostokatem ktory w srodku ma kolor InsideCol i stipple Stipple (lub nie ma stipple jesli Stipple = nil) a krawedz ma kolorem BorderCol. BoxPixelMargin to min odleglosc miedzy tekstem a krawedzia prostokata w pixelach. Robi to wszystko poprawnie zaczynajac od pozycji glRasterPos(0, 0), wzgledem aktualnej matrix (aktualne matrix to musi byc naturalnie MODELVIEW) i przy zalozeniu ze 1 jednostka OpenGL'a xowa to XPixelsRes piksli, a ykowa to YPixelsRes piksli. BonusVerticalSpace - jak w PrintStrings. RasterPos and curent color will be ignored and then modified by this proc, no other state is affected. Current matrix value is used and not modified. Requires one attrib stack and one matrix stack place.

Public procedure PrintStringsBorderedRect(strs: TStringList; BonusVerticalSpace: TGLint; const InsideCol, BorderCol, TextCol: TVector4f; Stipple: PPolygonStipple; BoxPixelMargin: integer; const XPixelsRes, YPixelsRes: TGLfloat); overload;
 
Public procedure Projection2DPrintStrings(X, Y: Integer; S: TStrings); overload;

Temporarily switch to 2d projection and print given string. This is a comfortable routine in demo programs that generally have 3d projection, and need to switch to 2d projection only to set raster position to print some text.

This uses glProjectionPushPop2D, in 2d is sets modelview matrix to identity and raster pos to X, Y, and then prints text like PrintStrings(S).

Public procedure Projection2DPrintStrings(X, Y: Integer; S: string); overload;
 

Properties

Public property RowHeight: integer read fRowHeight;

co do RowHeight : to nie musi byc DOKLADNIE TextHeight('Wy') - bedzie bardzo dobrze jesli wlasnie w RowHeight bedzie dodany jakis maly odstep miedzy liniami, np. +2 dla bitmap fontow.


Generated by PasDoc 0.10.0 on 2008-02-25 00:00:38