-    {
-        // Calculate text extent.
-        WXFontStructPtr pFontStruct =
-            m_font.GetFontStruct(m_userScaleY*m_logicalScaleY, m_display);
-        int direction, descent;
-        XCharStruct overall_return;
-#if 0
-        if (use16)
-            (void)XTextExtents16((XFontStruct*) pFontStruct,
-                                 (XChar2b *)(const char*) text,
-                                 slen, &direction,
-            &ascent, &descent, &overall_return);
-        else
-#endif // 0
-            (void)XTextExtents((XFontStruct*) pFontStruct,
-                               wxConstCast(text.c_str(), char),
-                               slen, &direction,
-                               &ascent, &descent, &overall_return);
-
-        cx = overall_return.width;
-        cy = ascent + descent;
-    }
+        wxGetTextExtent (m_display, m_font, m_userScaleY * m_logicalScaleY,
+                         text, &cx, &cy, &ascent, NULL);