summaryrefslogtreecommitdiff
path: root/csrc/font.c
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-08-09 11:54:58 +0800
committerIru Cai <mytbk920423@gmail.com>2018-08-09 11:54:58 +0800
commit75057cc0de61fd6f7e80636eda1e8d19f3ab3c29 (patch)
tree022b425da1fa2eca8b161edc2dac4f4754d6738e /csrc/font.c
parenteab0ca23e9530a26d083c7094e14cabe169381ef (diff)
downloadrich4-75057cc0de61fd6f7e80636eda1e8d19f3ab3c29.tar.xz
main() and a font function
Diffstat (limited to 'csrc/font.c')
-rw-r--r--csrc/font.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/csrc/font.c b/csrc/font.c
new file mode 100644
index 0000000..0d94b98
--- /dev/null
+++ b/csrc/font.c
@@ -0,0 +1,28 @@
+#include <windows.h>
+#include <stdint.h>
+
+HFONT gFont; // 0x4762d0
+int gFontHeight; // 0x4762d4
+uint32_t gfa[4]; // 0x4762d8, 0x4762dc, 0x4762e0, 0x4762e4
+const char tfname[] = "\xb2\xd3\xa9\xfa\xc5\xe9"; // 0x4660a0, typeface name
+
+static inline uint32_t swapbytes3(uint32_t x)
+{
+ return (((x & 0xff) << 16) | (x & 0xff00) | ((x & 0xff0000) >> 16));
+}
+
+/* 0x0044f9d8 */
+HFONT create_some_font(int a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t a4)
+{
+ gfa[2] = swapbytes3(a1);
+ gfa[3] = swapbytes3(a2);
+ gfa[0] = a3;
+ gfa[1] = a4;
+ int weight = (a3==2)?400:700;
+ if (gFont != 0) {
+ DeleteObject(gFont);
+ }
+ gFontHeight = a0;
+ gFont = CreateFontA(-a0, 0, 0, 0, weight, 0, 0, 0, 0x88 /* charset */, 0, 0, 0, 0, tfname);
+ return gFont;
+}