X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/63b9e659ef655526cd9ed69113280e864f7e2210..e3f9e20cb15c62bd347a8e52d2d36529adbdb3d6:/src/common/dcbase.cpp?ds=inline diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 75b4c6ac79..7f1b5170ec 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -365,6 +365,36 @@ void wxDCBase::DoDrawSpline( wxList *points ) #endif // wxUSE_SPLINES +// ---------------------------------------------------------------------------- +// Partial Text Extents +// ---------------------------------------------------------------------------- + + +// Each element of the array will be the width of the string up to and +// including the coresoponding character in text. This is the generic +// implementation, the port-specific classes should do this with native APIs +// if available. + +bool wxDCBase::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const +{ + int totalWidth = 0; + size_t i; + + widths.Empty(); + widths.Add(0, text.Length()); + + // Calculate the position of each character based on the widths of + // the previous characters + for (i=0; i