ref: e4fcf6a5e19ece9977a4a4f6fad683d09b70f9dc
parent: ae8aeae2ac8ebc300ed2e7a81309d94c5405b086
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Sep 4 11:43:52 EDT 2019
Fixed spacing for fonts that aren't Courier New Previous, I used a godawful hack to emulate Windows' API, but it seems this only ever worked for Courier New: with something like Liberation Mono, it would squash the font. Now I'm just giving up on it, and using actual font sizes rather than "cell" sizes. I'm not sure if this is accurate the original EXE.
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -609,7 +609,7 @@
size_t size;
const unsigned char *data = FindResource("FONT", "FONT", &size);
- font = LoadFontFromData(data, size, 5 * magnification, 10 * magnification);
+ font = LoadFontFromData(data, size, 8 * magnification, 9 * magnification);
}
void PutText(int x, int y, const char *text, unsigned long color)
--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -1074,35 +1074,11 @@
return NULL;
}
- unsigned int best_pixel_width = 0;
- unsigned int best_pixel_height = 0;
-
- for (unsigned int i = 0;; ++i)
- {
- FT_Set_Pixel_Sizes(font_object->face, i, i);
-
- const unsigned int current_cell_width = font_object->face->size->metrics.max_advance / 64;
- const unsigned int current_cell_height = font_object->face->size->metrics.height / 64;
-
- if (current_cell_width > cell_width && current_cell_height > cell_height)
- {
- break;
- }
- else
- {
- if (current_cell_width <= cell_width)
- best_pixel_width = i;
-
- if (current_cell_height <= cell_height)
- best_pixel_height = i;
- }
- }
-
#ifdef JAPANESE
- best_pixel_width = 0; // Cheap hack to make the font square
+ cell_width = 0; // Cheap hack to make the font square
#endif
- FT_Set_Pixel_Sizes(font_object->face, best_pixel_width, best_pixel_height);
+ FT_Set_Pixel_Sizes(font_object->face, cell_width, cell_height);
font_object->glyph_list_head = NULL;
--
⑨