Results 1 to 9 of 9

Thread: CreateFont or Font_create

  1. #1
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,428
    Rep Power
    161

    CreateFont or Font_create

    I wanted to use one of these but help is blank, can you help with the syntax.
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,162
    Rep Power
    738

    Re: CreateFont or Font_create

    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.

    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.
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,886
    Rep Power
    10

    Re: CreateFont or Font_create

    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
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  4. #4
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,162
    Rep Power
    738

    Re: CreateFont or Font_create

    Hi Eros,

    little suggestion.
    In TBGL, the font is defined using equates in single parameter.

    If you would define:
    [code=thinbasic]
    %FONT_BOLD = 1
    %FONT_ITALICS = 2
    %FONT_UNDERLINE = 4
    [/code]
    ... 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
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,886
    Rep Power
    10

    Re: CreateFont or Font_create

    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
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,162
    Rep Power
    738

    Re: CreateFont or Font_create

    That would be great
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #7
    Senior Member catventure's Avatar
    Join Date
    Oct 2005
    Location
    UK
    Posts
    644
    Rep Power
    85

    Re: CreateFont or Font_create

    Hi Michael,

    You can also do stuff like:

    [code=thinbasic]
    DIM hFont1 AS DWORD RESOURCE = FONT_CREATE( "Arial", 11 )

    CONTROL SEND hdlg, ctrl, %WM_SETFONT, hFont1, 0
    [/code]

    catventure.
    http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)

  8. #8
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,428
    Rep Power
    161

    Re: CreateFont or Font_create

    Catventure that was sort of my plan but I dont remember seeing the resource keyword.

    And of course

    [code=thinbasic]Object_Delete(hFont1)[/code]

    at the end of my dialog.
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  9. #9
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    58
    Posts
    8,886
    Rep Power
    10

    Re: CreateFont or Font_create

    [code=thinbasic]DIM ... AS DWORD RESOURCE[/code]

    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/prod...on_1_0_9_3.htm
    but I think I've forgot to document somewhere
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. createfont and font_create
    By sandyrepope in forum UI (User Interface)
    Replies: 2
    Last Post: 28-01-2008, 16:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •