fonts in programs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • andreas

    fonts in programs

    How can I choose some fonts in programs so that they are always avalable for
    the program at other computers, can I put them in some resources?
    Thanks for any response


  • andrews

    #2
    Re: fonts in programs

    Maybe more specific
    I can choose in the properties for many controls font.
    When the program run on a other computer where has not this font what
    happens?
    Can I put the font into the code in some of another way so that the font
    is always avalable for the program?
    Thanks for any response.

    Comment

    • kimiraikkonen

      #3
      Re: fonts in programs

      On Sep 3, 9:29 pm, andrews <andr...@pandor a.bewrote:
      Maybe more specific
      I can choose in the properties for many controls font.
      When the program run on a other computer where has not this font what
      happens?
      Can I put the font into the code in some of another way so that the font
      is always avalable for the program?
      Thanks for any response.
      Usually, if the specified font cannot be found on target machine, your
      application is supposed to run with a proper font that your system
      supports, however you can check the intended font file's existence
      using System.IO.File. Exists preferably on form's load event:

      '-----Begin-------------
      ' It's unlikely that a Windows client doesn't have Arial
      ' But check it out for the scenario
      If System.IO.File. Exists _
      ("c:\Windows\Fo nts\arial.ttf") =True Then
      MsgBox("Arial is found")

      Else
      'Implement new font instance
      'Eg: Verdana, sized 20
      Dim myfont As New Font("Verdana", 20)

      'Associate new font with control's font
      'Eg: Button's new font is verdana
      Button1.Font = myfont
      End If
      '-------End----------

      Hope this helps,

      Onur Güzel

      Comment

      • Gillard

        #4
        Re: fonts in programs

        checking a hard path is never a good idee "c:\Windows\Fon ts\arial.ttf"

        better find Windows directory first and then check for the file
        some people did not install in c:\windows

        "kimiraikko nen" <kimiraikkonen8 5@gmail.comwrot e in message
        news:98ade710-5d50-47ec-93d8-348888d214e0@b3 8g2000prf.googl egroups.com...
        On Sep 3, 9:29 pm, andrews <andr...@pandor a.bewrote:
        >Maybe more specific
        >I can choose in the properties for many controls font.
        >When the program run on a other computer where has not this font what
        >happens?
        >Can I put the font into the code in some of another way so that the font
        >is always avalable for the program?
        >Thanks for any response.
        >
        Usually, if the specified font cannot be found on target machine, your
        application is supposed to run with a proper font that your system
        supports, however you can check the intended font file's existence
        using System.IO.File. Exists preferably on form's load event:
        >
        '-----Begin-------------
        ' It's unlikely that a Windows client doesn't have Arial
        ' But check it out for the scenario
        If System.IO.File. Exists _
        ("c:\Windows\Fo nts\arial.ttf") =True Then
        MsgBox("Arial is found")
        >
        Else
        'Implement new font instance
        'Eg: Verdana, sized 20
        Dim myfont As New Font("Verdana", 20)
        >
        'Associate new font with control's font
        'Eg: Button's new font is verdana
        Button1.Font = myfont
        End If
        '-------End----------
        >
        Hope this helps,
        >
        Onur Güzel

        Comment

        • James Hahn

          #5
          Re: fonts in programs

          Checking a file is not an effective way to find out what fonts are installed
          in a aystem. Use the InstalledFontCo llection class to enumerate the
          available fonts.

          "kimiraikko nen" <kimiraikkonen8 5@gmail.comwrot e in message
          news:98ade710-5d50-47ec-93d8-348888d214e0@b3 8g2000prf.googl egroups.com...
          On Sep 3, 9:29 pm, andrews <andr...@pandor a.bewrote:
          Maybe more specific
          I can choose in the properties for many controls font.
          When the program run on a other computer where has not this font what
          happens?
          Can I put the font into the code in some of another way so that the font
          is always avalable for the program?
          Thanks for any response.
          Usually, if the specified font cannot be found on target machine, your
          application is supposed to run with a proper font that your system
          supports, however you can check the intended font file's existence
          using System.IO.File. Exists preferably on form's load event:

          '-----Begin-------------
          ' It's unlikely that a Windows client doesn't have Arial
          ' But check it out for the scenario
          If System.IO.File. Exists _
          ("c:\Windows\Fo nts\arial.ttf") =True Then
          MsgBox("Arial is found")

          Else
          'Implement new font instance
          'Eg: Verdana, sized 20
          Dim myfont As New Font("Verdana", 20)

          'Associate new font with control's font
          'Eg: Button's new font is verdana
          Button1.Font = myfont
          End If
          '-------End----------

          Hope this helps,

          Onur Güzel

          Comment

          • kimiraikkonen

            #6
            Re: fonts in programs

            On Sep 4, 1:04 am, "Gillard" <gillard_george s@@@@@@@@@hotma il.com>
            wrote:
            checking a hard path is never a good idee "c:\Windows\Fon ts\arial.ttf"
            >
            better find Windows directory first and then check for the file
            some people did not install in c:\windows
            >
            "kimiraikko nen" <kimiraikkone.. .@gmail.comwrot e in message
            >
            news:98ade710-5d50-47ec-93d8-348888d214e0@b3 8g2000prf.googl egroups.com...
            >
            On Sep 3, 9:29 pm, andrews <andr...@pandor a.bewrote:
            Maybe more specific
            I can choose in the properties for many controls font.
            When the program run on a other computer where has not this font what
            happens?
            Can I put the font into the code in some of another way so that the font
            is always avalable for the program?
            Thanks for any response.
            >
            Usually, if the specified font cannot be found on target machine, your
            application is supposed to run with a proper font that your system
            supports, however you can check the intended font file's existence
            using System.IO.File. Exists preferably on form's load event:
            >
            '-----Begin-------------
            ' It's unlikely that a Windows client doesn't have Arial
            ' But check it out for the scenario
            If System.IO.File. Exists _
            ("c:\Windows\Fo nts\arial.ttf") =True Then
            MsgBox("Arial is found")
            >
            Else
            'Implement new font instance
            'Eg: Verdana, sized 20
            Dim myfont As New Font("Verdana", 20)
            >
            'Associate new font with control's font
            'Eg: Button's new font is verdana
            Button1.Font = myfont
            End If
            '-------End----------
            >
            Hope this helps,
            >
            Onur Güzel
            Sure, but also your idea is based on file checking which is quite
            effective in my idea, though user can install Windows to another
            directory although c:\Windows is quite common, however you can use
            that for determining Windows directory:

            Dim WinDir As String = _
            Environment.Get EnvironmentVari able("windir")
            Dim fontsFolder As String = WinDir & "\Fonts"

            ....which solves default Windows Directory also combining Font folder.

            Thanks,

            Onur Güzel



            Comment

            • Andrew Morton

              #7
              Re: fonts in programs

              andreas wrote:
              How can I choose some fonts in programs so that they are always
              avalable for the program at other computers, can I put them in some
              resources?
              Fonts are usually copyrighted, so: no.

              Other posters have mentioned looking in the fonts folder. You should be able
              to get the location of the fonts folder through this information from
              ShlObj.h from the Windows SDK:

              <snip>
              //-------------------------------------------------------------------------
              //
              // SHGetSpecialFol derLocation
              //
              // Caller should use SHGetMalloc to obtain an allocator that can free the
              pidl
              //
              //
              //-------------------------------------------------------------------------
              //
              // registry entries for special paths are kept in :
              #define REGSTR_PATH_SPE CIAL_FOLDERS REGSTR_PATH_EXP LORER TEXT("\\Shell
              Folders")


              #define CSIDL_DESKTOP 0x0000 // <desktop>
              #define CSIDL_INTERNET 0x0001 // Internet Explorer
              (icon on desktop)
              #define CSIDL_PROGRAMS 0x0002 // Start Menu\Programs
              #define CSIDL_CONTROLS 0x0003 // My Computer\Contro l
              Panel
              #define CSIDL_PRINTERS 0x0004 // My
              Computer\Printe rs
              #define CSIDL_PERSONAL 0x0005 // My Documents
              #define CSIDL_FAVORITES 0x0006 // <user
              name>\Favorites
              #define CSIDL_STARTUP 0x0007 // Start
              Menu\Programs\S tartup
              #define CSIDL_RECENT 0x0008 // <user name>\Recent
              #define CSIDL_SENDTO 0x0009 // <user name>\SendTo
              #define CSIDL_BITBUCKET 0x000a // <desktop>\Recyc le
              Bin
              #define CSIDL_STARTMENU 0x000b // <user name>\Start
              Menu
              #define CSIDL_MYDOCUMEN TS 0x000c // logical "My
              Documents" desktop icon
              #define CSIDL_MYMUSIC 0x000d // "My Music" folder
              #define CSIDL_MYVIDEO 0x000e // "My Videos" folder
              #define CSIDL_DESKTOPDI RECTORY 0x0010 // <user name>\Desktop
              #define CSIDL_DRIVES 0x0011 // My Computer
              #define CSIDL_NETWORK 0x0012 // Network
              Neighborhood (My Network Places)
              #define CSIDL_NETHOOD 0x0013 // <user name>\nethood
              #define CSIDL_FONTS 0x0014 // windows\fonts
              #define CSIDL_TEMPLATES 0x0015
              #define CSIDL_COMMON_ST ARTMENU 0x0016 // All Users\Start
              Menu
              #define CSIDL_COMMON_PR OGRAMS 0X0017 // All Users\Start
              Menu\Programs
              #define CSIDL_COMMON_ST ARTUP 0x0018 // All Users\Startup
              #define CSIDL_COMMON_DE SKTOPDIRECTORY 0x0019 // All Users\Desktop
              #define CSIDL_APPDATA 0x001a // <user
              name>\Applicati on Data
              #define CSIDL_PRINTHOOD 0x001b // <user
              name>\PrintHood
              <snip>

              (There are lots more defined.)

              Andrew


              Comment

              • andrews

                #8
                Re: fonts in programs

                Thanks for the information but I will repeat one of my questions
                Can I put the font into the code in some of another (resources?)way so
                that the font is always avalable for the program?

                Comment

                • James Hahn

                  #9
                  Re: fonts in programs

                  Your question was not answered directly because the answer is returned as an
                  immediate response from a Google search. Your responders will assume you
                  have already done this, and will only comment on things that are not covered
                  in those results.

                  See, for instance:

                  Embedding fonts into your application.


                  How to embed a True Type font

                  There are many others.

                  "andrews" <andrews@pandor a.bewrote in message
                  news:wHSvk.3742 52$Mn3.117536@n ewsfe30.ams2...
                  Thanks for the information but I will repeat one of my questions
                  Can I put the font into the code in some of another (resources?)way so
                  that the font is always avalable for the program?

                  Comment

                  Working...