How can I use ‘gmfCellIncX’ in delphi? I need to get the center of the text
I am displaying.
I found the C++ code but I can’t translate it in to Delphi.
GLYPHMETRICSFLOAT gmf[256]; this is in C++ but how to do it in DELPHI???
I tried to do it in delphi as gmf: array[0…255] of GLYPHMETRICSFLOAT; but
I get an error during compilation :
Incompatible types: ‘Array’ and ‘PGlyphMetricsFloat’;
I don’t know Delphi but it looks like this language does not think that an Array (i.e. gmf of type GLYPHMETRICSFLOAT) is the same than a pointer to a variable of the same type. Can you typecast your “gmf” variable to a pointer to GLYPHMETRICSFLOAT ? Or can you create a pointer to such an array using something like the “new” operator of C++ ?
Thank you for your help!
It works but i came up with another problem:
The problem is that when I am using “wglUseFontOutlines” I can’t get the lines centered ( the first one is O.K. right in the middle but ones bellow are moved to the right ) - I read that
“wglUseFontOutlines” isn’t precise and that is way I can’t get it working.
I made the following function:
procedure glPrint(text : PChar);
var y:integer;
begin
howlong:=0;
if (text = ‘’) then
Exit;
for y:=0 to (length(text)) do
begin
howlong:=howlong+agmf[y].gmfCellIncX;
end;
glPushAttrib(GL_LIST_BIT);
glListBase(base);
glTranslatef(-howlong/2,0.7,0.0);
glCallLists(length(text), GL_UNSIGNED_BYTE, text);
glTranslatef(-howlong,-0.7,0.0);
glCallLists(length(text), GL_UNSIGNED_BYTE, text);
glPopAttrib();
end;
Is there anything wrong with it?
Shouldn’t the two lines be exactly one under the other?
Thanx once more for any help
Regards,
Eryk
[This message has been edited by spokojnie (edited 01-29-2002).]