summaryrefslogtreecommitdiff
path: root/alf/alfcompat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alfcompat.cpp')
-rw-r--r--alf/alfcompat.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/alf/alfcompat.cpp b/alf/alfcompat.cpp
index e6a9851..269b9f4 100644
--- a/alf/alfcompat.cpp
+++ b/alf/alfcompat.cpp
@@ -123,3 +123,14 @@ ALF_CreateCompatFuncTable(void)
return compatfn;
}
+
+long
+ALF_GetAveCharWidth(HDC hdc)
+{
+ // see: HOWTO: Calculate Dialog Units When Not Using the System Font
+
+ SIZE s;
+ GetTextExtentPoint32A(hdc, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &s);
+
+ return (s.cx / 26 + 1) / 2;
+}