X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4913272f9cdead94a6d1470e51d6fb14946b50e0..5b2c144640ca728577fc5787bb6e0c70f5a9b028:/src/mac/carbon/font.cpp diff --git a/src/mac/carbon/font.cpp b/src/mac/carbon/font.cpp index e2c9d4f9a0..75ea3f918a 100644 --- a/src/mac/carbon/font.cpp +++ b/src/mac/carbon/font.cpp @@ -21,7 +21,7 @@ #endif #include "wx/fontutil.h" -#include "wx/fontutil.h" +#include "wx/graphics.h" #include "wx/mac/private.h" @@ -528,6 +528,20 @@ int wxFont::GetPointSize() const return M_FONTDATA->m_pointSize; } +wxSize wxFont::GetPixelSize() const +{ +#if wxUSE_GRAPHICS_CONTEXT + // TODO: consider caching the value + wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef) NULL); + dc->SetFont(*(wxFont *)this); + wxDouble width, height = 0; + dc->GetTextExtent( wxT("g"), &width, &height, NULL, NULL); + return wxSize(width, height); +#else + wxFontBase::GetPixelSize(); +#endif +} + int wxFont::GetFamily() const { wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );