> Dom and I were looking at this code earlier, and we were a bit > confused. The fp_TextRun class has a static member containing char > widths; we couldn't quite figure out what it was caching char widths > for. And it looked like most code paths were not specifying char > widths for gr_Graphics::drawChars(). > > Can you explain what the static s_pCharAdvance member does? I > couldn't find any other args passed to ::drawChars besides this array.
The text run is not caching character widths; the s_pCharAdvance is a buffer which is filled with character advances by ::_draw(); the advances are not necessarily same as the character widths, in the case of the combining characters the advance depends on the base character and can be greater or lesser. When I was writing this code, I was debating whether to make the buffer non-static and refresh it inside ::refreshDrawBuffer(), improving spead but adding (sizeof(sint) * run length) memory requirenment, or whether make it static and recalculate it inside ::_draw(). I decided for the latter, and it does not seem to have serious impact on the performance. Tomas
