View Full Version : CreateFont or Font_create
Michael Clease
31-01-2010, 03:30
I wanted to use one of these but help is blank, can you help with the syntax.
Petr Schreiber
31-01-2010, 08:59
Hi Michael,
for Font_Create I think it is:
Font_Create( fontName, fontSize )
For CreateFont I would presume it will be the same as Win32 CreateFont (http://msdn.microsoft.com/en-us/library/dd183499%28VS.85%29.aspx).
I agree some more documentation would be good in this case.
Petr
P.S. For TBGL, you can use TBGL_FontHandle(fontName, fontSize, style). But better to use it only with TBGL applications.
ErosOlmi
31-01-2010, 11:09
I will make some order in the mess of font functions. They were developed some years ago.
CreateFont will be deprecated because it is just a one to one passing params of API CreateFont and is quite complicated
I've documented FONT_Create. Syntax is: Font_Create(FontName, FontSize)
You can use it right now.
I've created and documented FONT_Create_Ex. Syntax will be: Font_Create(FontName, FontSize, fBold, fItalic, fUnderline)
This will be out in next beta update.
Eros
Petr Schreiber
31-01-2010, 11:20
Hi Eros,
little suggestion.
In TBGL, the font is defined using equates in single parameter.
If you would define:
%FONT_BOLD = 1
%FONT_ITALICS = 2
%FONT_UNDERLINE = 4
... you can then simply test using BIT( lStyle, 0|1|2 ) for the flags presence.
I think this would help keeping the TB commands consistent in syntax. Of course - just a suggestion.
The use would then look like:
Font_Create("Arial", 14, %FONT_BOLD | %FONT_ITALICS)
The point is the code becomes more readable and evident, comparing to:
Font_Create("Arial", 14, %TRUE, %FALSE, %TRUE)
Petr
ErosOlmi
31-01-2010, 11:26
Ok, I will change like in your suggestion.
Maybe I can avoid FONT_Create_Ex and expand FONT_Create with an additional param like in TBGL
Petr Schreiber
31-01-2010, 11:29
That would be great :)
catventure
31-01-2010, 12:33
Hi Michael,
You can also do stuff like:
DIM hFont1 AS DWORD RESOURCE = FONT_CREATE( "Arial", 11 )
CONTROL SEND hdlg, ctrl, %WM_SETFONT, hFont1, 0
catventure.
Michael Clease
31-01-2010, 18:22
Catventure that was sort of my plan but I dont remember seeing the resource keyword.
And of course
Object_Delete(hFont1)
at the end of my dialog.
ErosOlmi
31-01-2010, 18:36
DIM ... AS DWORD RESOURCE
instructs thinBasic that you have defined a resource object variable.
If so, thinBasic will release it for you at the end of the variable scope.
It was mentioned in change list at http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_0_9_3.htm
but I think I've forgot to document somewhere :oops: