-#ifndef __WXMAC__
- // Calculate the position of each character based on the widths of
- // the previous characters
- int* tpos = new int[len];
- int totalWidth = 0;
- size_t i;
- for (i=0; i<str.Length(); i++) {
- int w, h;
- hdc->GetTextExtent(str[i], &w, &h);
- totalWidth += w;
- tpos[i] = totalWidth;
- }
-#else
- // Instead of a running total, remeasure from the begining of the
- // text for each character's position. This is because with AA fonts
- // on OS X widths can be fractions of pixels wide when more than one
- // are drawn together, so the sum of all character widths is not necessarily
- // (and probably not) the same as the whole string width.
- int* tpos = new int[len];
- size_t i;
- for (i=0; i<str.Length(); i++) {
- int w, h;
- hdc->GetTextExtent(str.Left(i+1), &w, &h);
- tpos[i] = w;
- }
-#endif