Announcement

Collapse
No announcement yet.

Using Font from a Resource

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Font from a Resource

    I asked this question a bit differently before...

    But, I have a font that I would like to include in my application, can it be embedded into the .EXE from a resource file?
    Ie, if it can can it be used?

    Anybody have a sample?
    It's my time clock, I have a cool digital font and would like to implement it..


    Scott


    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    The font would need to be installed for the Windows GDI sub-system to use it. I'm fairly sure that this means a reboot after installing it too!

    If that is too much drama (redistribution licence, installing the font programmatically, etc), then why not just create the digits as bitmaps, and BltBit() them onto the clock display rather than using DrawText/TextOut? That way you can work directly from your resource file at all times.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      BltBit? I'm lost on that one but here's what I am doing...

      I have %IMG_RED0, %IMG_RED1 etc for the digits, place them on a dialog and then switch them with the appropriate digit based on the time..
      I'm not 100% certain how I'm going to do that one just yet but we'll see...

      Just used DDT to Control add Image




      ------------------
      Scott
      mailto:[email protected][email protected]</A>
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Typo... I should have said BitBlt().

        I assumed that you were drawing the whole image from scratch, but using an IMAGE/IMAGEX control qith bitmaps will work fine, and will be a lot easier than using a font.

        BTW, I just tested installing fonts (manually) in Win2K and I did not have to reboot to be able to use them, but IIRC Win9x did need rebooting?



        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Lance --

          If I'm not mistaken, the AddFontResource API allows you to add a font to the current selection, without actually installing it. It does not require a reboot on any version of Windows, and it can use a FON file, which is simply a renamed DLL file that contains a font resource and nothing else. (Who knows, it may even accept a DLL file directly.) It's a nice clean way to allow your app to use a nonstandard font, and then you can use RemoveFontResource when your app closes. If you want to hide the FON file you can distribute it as a BIN or something else, and have your program rename the file before calling AddFontResource.

          -- Eric

          ------------------
          Perfect Sync: Perfect Sync Development Tools
          Email: mailto:[email protected][email protected]</A>



          [This message has been edited by Eric Pearson (edited September 30, 2000).]
          "Not my circus, not my monkeys."

          Comment


          • #6
            Eric, is that limited to a fixed scale font or can a TTF be used?
            That idea sounds good but a lot of work...

            Otherwise, the Imagex thing is where I'm going, pretty easy to toggle around bitmaps, that's the cool part...


            Scott

            ------------------
            Scott
            mailto:[email protected][email protected]</A>
            Scott Turchin
            MCSE, MCP+I
            http://www.tngbbs.com
            ----------------------
            True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

            Comment


            • #7
              Scott,

              In the samples directory that came with PBDLL20 there is an example of a digital clock.
              Does this knowledge help a bit?

              Regards,


              ------------------
              mailto:[email protected][email protected]</A>
              www.basicguru.com/zijlema/

              Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
              http://zijlema.basicguru.eu
              *** Opinions expressed here are not necessarily untrue ***

              Comment

              Working...
              X