SDL2 front end: "Text has zero width" error with ttf set as DEFAULT_FONT
Collapse
X
-
-
That did it! Those were among the lines I looked over and over and of course had no idea what actually to do with them. ; ) Thanks! (And for all the other recent SDL2 fixes. : ))Leave a comment:
-
In load_subwindow(), there are these lines:
The second of those lines assumes that DEFAULT_FONT is a raster font. Changing that line toCode:try_names[n_tries] = DEFAULT_FONT; try_sizes[n_tries] = 0;
may help. I'll submit that change as a pull request since all the other places where fonts are used tolerate both raster and vector fonts.Code:try_sizes[n_tries] = (suffix_i(DEFAULT_FONT, ".fon")) ? 0 : DEFAULT_VECTOR_FONT_SIZE;
😀 1Leave a comment:
-
Ah well, as a workaround I've converted Perfect DOS VGA 437.ttf to size 16 and 32 .fon raster fonts using https://www.vertopal.com/en/convert/font , and those work fine as DEFAULT_FONT. ^ _^Leave a comment:
-
SDL2 front end: "Text has zero width" error with ttf set as DEFAULT_FONT
I'm trying to set this font https://www.dafont.com/perfect-dos-vga-437.font as the game's default font. I have it in lib\fonts\Perfect DOS VGA 437.ttf. However, when I run an angband.exe compiled with the following in main-sdl2.c:
#define DEFAULT_FONT "Perfect DOS VGA 437.ttf"
and no \lib\user\sdl2init.txt, I get a Fatal Error window:
"font cache rendering failed for ' ' (ASCII 0) in font 'Perfect DOS VGA 437.ttf': Text has zero width"
If I instead compile main-sdl2.c with the regular
#define DEFAULT_FONT "10x20x.fon"
then the game runs okay and I can SWITCH to Perfect DOS VGA 437.ttf in the SDL2 front end's game menu with no error. And the game runs with no error if there's an sdl2init.txt with
subwindow-font:0:16:Perfect DOS VGA 437.ttf
But that fatal error will occur if I try to use Perfect DOS VGA 437.ttf as DEFAULT_FONT, and I'm too ignorant to understand why. I'd really like to be able to run with that font as the default. : )
Tags: None

Leave a comment: