From 7c6eda569a9f3ae8814fd01267f655155e06ed8e Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Thu, 6 Sep 2018 11:49:39 +0800 Subject: drawStringY --- csrc/font.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'csrc/font.c') diff --git a/csrc/font.c b/csrc/font.c index e576f56..e623884 100644 --- a/csrc/font.c +++ b/csrc/font.c @@ -26,3 +26,21 @@ HFONT create_some_font(int a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t a gFont = CreateFontA(-a0, 0, 0, 0, weight, 0, 0, 0, 0x88 /* charset */, 0, 0, 0, 0, tfname); return gFont; } + +void drawStringY(HDC hdc, int nXStart, int nYStart, LPCSTR str) +{ + int h = gFontHeight + gfa[1]; + if (((uint8_t)gfa[0] & 6) != 0) + h++; + + while (*str) { + if ((str[0] & 0x80) != 0) { + TextOutA(hdc, nXStart, nYStart, str, 2); + str += 2; + } else { + TextOutA(hdc, nXStart, nYStart, str, 1); + str += 1; + } + nYStart += h; + } +} -- cgit v1.2.3