From 1c509ed6329c8fcc5674e39ecc9e3b05d0d00c63 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 7 May 2011 17:47:24 +0000 Subject: [PATCH] win32: try calculating debugger font height --- src/drivers/win/debugger.cpp | 13 ++++++++++++- src/drivers/win/debugger.h | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/drivers/win/debugger.cpp b/src/drivers/win/debugger.cpp index 31f68391..5e95bf67 100644 --- a/src/drivers/win/debugger.cpp +++ b/src/drivers/win/debugger.cpp @@ -1240,7 +1240,7 @@ BOOL CALLBACK DebuggerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara int height = rectDisassembly.bottom-rectDisassembly.top; tmp = mouse_y - 12; if(tmp > height) setString = false; - tmp /= 12; + tmp /= debugSystem->fixedFontHeight; } if(setString) @@ -1592,6 +1592,17 @@ DebugSystem::DebugSystem() ANSI_CHARSET,OUT_DEVICE_PRECIS,CLIP_MASK, /*charset, precision, clipping*/ DEFAULT_QUALITY, DEFAULT_PITCH, /*quality, and pitch*/ "Courier"); /*font name*/ + + HDC hdc = GetDC(GetDesktopWindow()); + HGDIOBJ old = SelectObject(hdc,hFixedFont); + TEXTMETRIC tm; + GetTextMetrics(hdc,&tm); + fixedFontHeight = tm.tmHeight; + fixedFontWidth = tm.tmAveCharWidth; + printf("fixed font height: %d\n",fixedFontHeight); + printf("fixed font width: %d\n",fixedFontWidth); + SelectObject(hdc,old); + DeleteDC(hdc); } DebugSystem::~DebugSystem() diff --git a/src/drivers/win/debugger.h b/src/drivers/win/debugger.h index 4d588297..12e061bf 100644 --- a/src/drivers/win/debugger.h +++ b/src/drivers/win/debugger.h @@ -43,8 +43,8 @@ public: ~DebugSystem(); HFONT hFixedFont; - static const int fixedFontWidth = 8; - static const int fixedFontHeight = 13; + int fixedFontWidth; + int fixedFontHeight; } *debugSystem;