TsFontStore should load otf files too

Viewing 20 posts - 1 through 20 (of 41 total)
  • Author
    Posts
  • #58118
    Support
    Keymaster

      There is a problem exists – I have no idea how to receive a font name from the OTF file.

      You can see the acGetFontName function which used for extracting of a font name.

      This name used in the design-time editor for showing of list of loaded fonts.

      This name used by developer later when defined Font.Name property.

      But, I don't know a way for receiving of font name from OTF files, unfortunately.

      #58122
      HeDiBo
      Participant
        'Support' wrote:

        There is a problem exists – I have no idea how to receive a font name from the OTF file.

        You can see the acGetFontName function which used for extracting of a font name.

        This name used in the design-time editor for showing of list of loaded fonts.

        This name used by developer later when defined Font.Name property.

        But, I don't know a way for receiving of font name from OTF files, unfortunately.

        I've made up a sample project, that will show a font name for a TTF file and for an OTF file. You don't have to know anything about the internal structure of the font file: [attachment=8808:GetPrivateFontInfo.zip].

        I must admit it cost me quite some time to find these hidden font functions.

        #58123
        Support
        Keymaster

          Thank you!

          Many OTF fonts can't be processed by this way, seems. But I will research it, maybe I will find something too.

          Some fonts which can't be processed are attached here for tests.

          Returned status – FileNotFound.

          #58124
          HeDiBo
          Participant
            'Support' wrote:

            Thank you!

            Many OTF fonts can't be processed by this way, seems. But I will research it, maybe I will find something too.

            Some fonts which can't be processed are attached here for tests.

            Returned status – FileNotFound.

            I could open and retrieve all font names from your sample.

            Don't know what happened at your side.

            I added my exe file for you to test.

            PS. Please delete it again, it takes up almost all my remaining space

            #58125
            HeDiBo
            Participant

              Here is a picture of three runs of my program with your fonts:

              [attachment=8811:3FontSamples.jpg]

              #58126
              Support
              Keymaster

                Maybe it's depended from OS, I will check it more on different systems.

                In my system (Win7 x64), these fonts were not loaded in your application with 'FileNotFound' status.

                #58128
                HeDiBo
                Participant
                  'Support' wrote:

                  Maybe it's depended from OS, I will check it more on different systems.

                  In my system (Win7 x64), these fonts were not loaded in your application with 'FileNotFound' status.

                  When one of the GPFont calls fails, I give a message with a status. What status did you get?

                  #58129
                  HeDiBo
                  Participant

                    The call PrivateFonts.AddFontFile needs a widestring for the filename.

                    Maybe that's the cause for trouble on some development environments.

                    I changed it, so you can have another try: [attachment=8812:GetPrivateFontInfo.zip]

                    #58131
                    HeDiBo
                    Participant

                      I also found out it is impossible to use the standard font directory (C:WindowsFonts). It cannot find any file there.

                      Maybe that's what bothered you.

                      But that's not an issue, because you cannot add fonts from the system fonts anyway (in Add Fonts you cannot choose C:WIndowsFonts)

                      PS. The original post spoke of TsFontStore. That should have been TsCharImageList. I've corrected the message accordingly.

                      #58132
                      HeDiBo
                      Participant

                        I found out that, in order to access system fonts as ordinary files, you have to go through an UNC name.

                        So select the fonts directory by going to the network button and selecting the drive C share, etc. Ending up with \computer-namec$WindowsFonts

                        #58133
                        HeDiBo
                        Participant

                          I modified the original program, to enable listing all family names in a given directory.

                          [attachment=8813:GetPrivateFontInfo.zip]

                          Also I made a new project that lists all standard system font families, using the same technique.

                          [attachment=8816:GetSystemFontInfo.zip]

                          #58135
                          Support
                          Keymaster

                            Thank you for programs. What is your Windows version?

                            I have installed these fonts in the OS, but FileNotFound (10) status occurs still…

                            I have found info in the net, that some Otf file has problems with Windows 7

                            #58136
                            HeDiBo
                            Participant
                              'Support' wrote:

                              Thank you for programs. What is your Windows version?

                              I have installed these fonts in the OS, but FileNotFound (10) status occurs still…

                              You are probably trying to load them from the system font directory (C:WindowFonts). I addressed that problem in an earlier post. Have a look there.

                              I'm working with Windows 10 64bit.

                              I'm now working on a version that will give the real font name, next to the family name.

                              #58137
                              Support
                              Keymaster

                                First tries of loading were from “e:DesignFontsRegularBad” folder.

                                Later I have copied some fonts to “c:WindowsFonts” – same problem.

                                Some fonts were installed after that – same problem…

                                Windows 10 (on virtual machine) works well with all fonts.

                                PS. Even more, these fonts are installed, but doesn't work under Windows 7

                                #58138
                                HeDiBo
                                Participant
                                  'Support' wrote:

                                  First tries of loading were from “e:DesignFontsRegularBad” folder.

                                  Later I have copied some fonts to “c:WindowsFonts” – same problem.

                                  Some fonts were installed after that – same problem…

                                  Windows 10 (on virtual machine) works well with all fonts.

                                  If you set the directory to e:DesignFontsRegularBad and click the “List Family Names” button, do you see the font families? If not, what do you see?

                                  #58139
                                  Support
                                  Keymaster
                                    'HeDiBo' wrote:

                                    If you set the directory to e:DesignFontsRegularBad and click the “List Family Names” button, do you see the font families? If not, what do you see?

                                    I see error message with status = 10 (FileNotFound).

                                    And, these fonts are installed, but doesn't work under Windows 7 at all.

                                    #58140
                                    HeDiBo
                                    Participant
                                      'Support' wrote:

                                      I see error message with status = 10 (FileNotFound).

                                      And, these fonts are installed, but doesn't work under Windows 7 at all.

                                      I don't understand the File Not Found error.

                                      Can you provide a screenshot of the main window and of the error message?

                                      #58141
                                      Support
                                      Keymaster

                                        Screenshot is attached

                                        This status occurs after “Status := PrivateFonts.AddFontFile(widename);”

                                        #58142
                                        HeDiBo
                                        Participant
                                          'Support' wrote:

                                          Screenshot is attached

                                          This status occurs after “Status := PrivateFonts.AddFontFile(widename);”

                                          The directory used for the font is the windows font directory (the filename says so). That doesn't work.

                                          Try clicking the “List Family Names” button at the right top of the window.

                                          #58143
                                          Support
                                          Keymaster

                                            I have clicked this “List Family Names” button before a screenshoting.

                                            Please, ignore “Font file” field, this field was used before “List Family Names”clicking.

                                            Same problem in all directories.

                                            As I wrote above, these fonts are not working in Win 7 at all (Excel, Word do not work with these fonts).

                                          Viewing 20 posts - 1 through 20 (of 41 total)
                                          • You must be logged in to reply to this topic.