Does anyone have .fnt files for Angband?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    Does anyone have .fnt files for Angband?

    Hi all,

    After several weeks of work (see https://salsa.debian.org/games-team/angband), we've hit a major snag with packaging Angband for Debian (and therefore Ubuntu et al.). It's to do with the fonts. I'm woefully ignorant about fonts, but apparently .fon files are "compiled" from .fnt files. (I put that in quotes because it makes no sense to me, I thought fonts were just bitmaps loaded into memory.)

    Anyway, Debian is butt-clenchingly picky about anything to do with copyrights and licenses, and doesn't like "precompiled" fonts. So there are two ways forward if we want Angband available to Debian-based Linuxes:

    1. Find the .fnt files from which Angband's .fon files were built. I can't find any trace of them in the git logs, so they have not been referred to since before 3.0.7s3

    2. Strip them out of the Debian package and make do with the thousands of fonts available through other packages (by putting symlinks in lib/fonts to wherever those packages install them).

    The first requires someone with knowledge way older than mine - perhaps they are on an ancient ftp archive somewhere? They must have been 'compiled' in the first place, I understand, so maybe they're out there somewhere.

    The second requires someone who understands fonts much better than I do. I don't even know which of Angband's fonts are scalable (all of them?) and which types of font might be usable in lieu of our own.

    Can anyone help with either of these possibilities?
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    #2
    P.S. Some of you may be wondering why this issue has not come up during the previous ~27 years Angband has been available in Debian. Until 2009 they didn't really care because Angband was classified as "non-free" (in the world of Debian this is a grave and sordid insult, like 'non-human'). From 2009 onwards we have had a number of different 'sponsors' (the person who actually uploads the package to the Debian servers), all of whom overlooked this issue, either by oversight or by choice. We are now considered part of the Debian Games Team, which has lots of advantages - but it also means we're right at the extreme end of copyright zealotry.
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

    Comment

    • Nick
      Vanilla maintainer
      • Apr 2007
      • 9647

      #3
      Many years ago I used some font editing software (called softy, IIRC) to create some fonts for use with FAangband. I don't think I ever compiled anything, though.

      A quick look through the variant repository tells me the .fon files were first included in 3.0.8; before that they were available as an additional download, like the tiles.
      One for the Dark Lord on his dark throne
      In the Land of Mordor where the Shadows lie.

      Comment

      • backwardsEric
        Knight
        • Aug 2019
        • 531

        #4
        Originally posted by Magnate
        The second requires someone who understands fonts much better than I do. I don't even know which of Angband's fonts are scalable (all of them?) and which types of font might be usable in lieu of our own.
        All of the fonts in lib/fonts are not scalable. The SDL and SDL2 front ends (all the other front ends, except the Windows one, don't use lib/fonts) will accept any fixed-width font that SDL_ttf can handle. They do expect that the non-scalable fonts have a .fon (case-insensitive) extension. One other issue is that the fonts in lib/fonts have at least some entries corresponding to code page 437 (namely an index of 7 corresponding to a centered dot) and lib/customize/font-sdl2.prf has an entry that relies on that. If you use a Unicode font that has the centered dot, you'd want to comment out the
        Code:
        feat:open floor:*:1:7
        line in font-sdl2.prf or change it to be
        Code:
        feat:open floor:*:1:0xb7
        . There are similar entries in lib/customize/font-sdl.prf but those are commented out currently; uncommenting out the one for a Unicode font would be nice if a Unicode font with the centered dot is used.

        On Debian Buster, the LiberationMono-Bold and LiberationMono-Regular fonts in /usr/share/fonts/truetype/liberation and /usr/share/fonts/truetype/liberation2 seemed usable with the SDL and SDL2 front ends in Angband after the previously mentioned change to lib/customize/font-sdl2.prf. The font browser in the SDL front end (click on the font name in the menu bar and select "Other..." in the menu that appears) will only list the fixed-width fonts that SDL_ttf can open so you could use that to browse through /usr/share/fonts and find other possible candidates.
        Last edited by backwardsEric; October 11, 2023, 22:02. Reason: Use [CODE] and [/CODE] to supress the faces

        Comment

        • Magnate
          Angband Devteam member
          • May 2007
          • 5110

          #5
          Thank you, that's probably almost enough for me to go on, if I can pepper you with questions as I go. IIUC:

          - only the SDL and Windows front ends use lib/fonts
          - for the SDL2 one I can use the font browser to see which already-installed fonts can be used

          ... I can then decide a font package to make angband depend on, sort out the symlinks, and we're good to go.

          Can I just double check that removing the .fon files in lib/fonts and replacing them with symlinks will not break the gcu or x11 ports? (I mean, I can test this for myself down the line, but just checking that you think so)

          Thanks again.
          "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

          Comment

          • backwardsEric
            Knight
            • Aug 2019
            • 531

            #6
            Originally posted by Magnate
            Thank you, that's probably almost enough for me to go on, if I can pepper you with questions as I go. IIUC:

            - only the SDL and Windows front ends use lib/fonts
            - for the SDL2 one I can use the font browser to see which already-installed fonts can be used
            It's the SDL front end that has the font browser. It has not been implemented yet for the SDL2 front end. The SDL, SDL2, and Windows front end use the contents of lib/fonts.

            Originally posted by Magnate
            Can I just double check that removing the .fon files in lib/fonts and replacing them with symlinks will not break the gcu or x11 ports? (I mean, I can test this for myself down the line, but just checking that you think so)
            main.c and init.c use ANGBAND_DIR_FONTS, but that is only to set the contents of the path. The only code that browses the entries within that directory is in main-win.c, main-sdl.c, and main-sdl2.c. So the gcu and x11 will be fine if the contents of lib/fonts (or even the lib/fonts directory entry itself) go away.

            Comment

            • Pete Mack
              Prophet
              • Apr 2007
              • 6883

              #7
              Magnate--
              I see your .sig. I suspect Tomo might like playing some of the 4 2 challenge classes. And maybe Blackguard, which starts out as a challenge class nut turns into an absolute monster.

              Comment

              • Nick
                Vanilla maintainer
                • Apr 2007
                • 9647

                #8
                Originally posted by Pete Mack
                Magnate--
                I see your .sig. I suspect Tomo might like playing some of the 4 2 challenge classes. And maybe Blackguard, which starts out as a challenge class nut turns into an absolute monster.
                Pete, you need to stop posting from your phone
                One for the Dark Lord on his dark throne
                In the Land of Mordor where the Shadows lie.

                Comment

                • Magnate
                  Angband Devteam member
                  • May 2007
                  • 5110

                  #9
                  Weirdly I can't see my own sig, but it is clearly time to update it after eight years away...
                  "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                  Comment

                  • Magnate
                    Angband Devteam member
                    • May 2007
                    • 5110

                    #10
                    Ah, that's unfortunate - I can no longer run the SDL front end in Debian, as the dependencies are all gone (Debian has deprecated SDL in favour of SDL2). Is there any chance you could run it for me, if you can still run the SDL front end? All I need to know is a set of fonts that Angband can use and which package(s) they're in ...
                    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                    Comment

                    • backwardsEric
                      Knight
                      • Aug 2019
                      • 531

                      #11
                      Originally posted by Magnate
                      Is there any chance you could run it for me, if you can still run the SDL front end? All I need to know is a set of fonts that Angband can use and which package(s) they're in ...
                      This is what's installed on my Debian system and is loadable in the SDL front end (there's fixed width fonts in /usr/share/fonts/X11 that are also loadable; I have not included them here; also the fonts below can have bold, italic, or oblique variants that are not listed since those will probably be less readable):
                      • /usr/share/fonts/opentype/urw-base35/NimbusMonoPS-Regular.otf from fonts-urw-base35
                      • /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf from fonts-dejavu-core
                      • /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf from fonts-liberation
                      • /usr/share/fonts/truetype/liberation2/LiberationMono-Regular.ttf from fonts-liberation2
                      • /usr/share/fonts/truetype/noto/NotoMono-Regular.ttf from fonts-noto-mono
                      • /usr/share/fonts/truetype/noto/NotoSansMono-Regular.ttf from fonts-noto-mono
                      • /usr/share/fonts/type1/urw-base35/NimbusMonoPS-Regular.t1 from fonts-urw-base35


                      From a quick look in town with the point size set to 15, I'd prefer playing with the NotoMono-Regular. My second choices would be DejaVuSansMono or LiberationMono-Regular.

                      Comment

                      • Magnate
                        Angband Devteam member
                        • May 2007
                        • 5110

                        #12
                        Excellent, thank you, I'll look into those. Out of interest, why have you not included the fonts in /usr/share/fonts/X11 - are they inferior?
                        "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                        Comment

                        • backwardsEric
                          Knight
                          • Aug 2019
                          • 531

                          #13
                          Originally posted by Magnate
                          Excellent, thank you, I'll look into those. Out of interest, why have you not included the fonts in /usr/share/fonts/X11 - are they inferior?
                          Most of the fonts (not sure about the ones in the Type1 directory) in /usr/share/fonts/X11 are bitmapped fonts (gzip compressed .pcf files) so, for setting up symbolic links in Angband's lib/fonts directory, the link would have to be renamed (since the SDL and SDL2 front ends expect bitmapped fonts to have a .fon extension; alternatively would have to make the scalable vs bitmapped font detection in those front ends more robust). Would have to verify that the renaming didn't interfere with SDL_ttf's ability to load the font. The fonts in the X11 directory appear to cover narrower ranges of glyphs (i.e. various flavors of ISO 8859), though that likely does not matter for the parts of Unicode currently used by Angband. Also, I don't know how fast the X11 to Wayland transition is going so I thought it best to avoid extra dependencies on X11 stuff.

                          Comment

                          • Magnate
                            Angband Devteam member
                            • May 2007
                            • 5110

                            #14
                            So the good news is that this looks like it will work well. There seems to be no problem with symbolic links, either of the ttf fonts or the pcf.gz fonts renamed as .fon - both work fine once the game is running (including resizing the ttf fonts). There is just one problem to solve: on starting the SDL2 front-end for the first time after installation, Angband seems hard-coded to expect one or two fonts - for me it was 8x13b for the title bar:

                            angband: main-sdl2.c:5129: load_status_bar: Assertion `window->status_bar.font != NULL' failed.

                            and 10x20 for the subwindows:

                            angband: main-sdl2.c:5587: load_subwindow: Assertion `subwindow->font != NULL' failed.

                            (Those errors went away when I replaced those font files.) Is there a way to control which fonts the SDL2 port looks for on starting up? The one issue I had was that it couldn't start up with a ttf font for the main window:

                            angband: font cache rendering failed for ' ' (ASCII 0) in font 'NotoMono-Regular.ttf': Text has zero width

                            But it worked ok with a renamed pcf.gz font.

                            I will do some more purging and clean install testing, but any tips appreciated. The idea is to strip the .fon files out of the source tarball (like the sounds and other non-free stuff), and put in the symlinks on installation, and make the change to font-sdl2.prf so the centred dot shows up. Ideally the startup issues would be solved by symlinking known-working fonts, but I can also patch the source if something is hard-coded.

                            (Oh and I now know how to backport it to Debian 11 - watch this space!)
                            "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                            Comment

                            • Magnate
                              Angband Devteam member
                              • May 2007
                              • 5110

                              #15
                              Progress! I can use symlinks to the 8x13 and 10x20 fonts in /usr/share/fonts/X11/misc and the SDL2 port starts up first time!
                              "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎