- for ( const char *pc = text; ; pc++ ) {
- if ( *pc == '\n' || *pc == '\0' ) {
- GetTextExtent(curLine, &widthLine, &heightLine);
- if ( width > widthTextMax )
- widthTextMax = widthLine;
- heightTextTotal += heightLine;
-
- if ( *pc == '\n' ) {
+ for ( const wxChar *pc = text; ; pc++ ) {
+ if ( *pc == wxT('\n') || *pc == wxT('\0') ) {
+ if ( !curLine ) {
+ // we can't use GetTextExtent - it will return 0 for both width
+ // and height and an empty line should count in height
+ // calculation
+ if ( !heightLineDefault )
+ heightLineDefault = heightLine;
+ if ( !heightLineDefault )
+ GetTextExtent(_T("W"), NULL, &heightLineDefault);
+
+ heightTextTotal += heightLineDefault;
+ }
+ else {
+ GetTextExtent(curLine, &widthLine, &heightLine);
+ if ( widthLine > widthTextMax )
+ widthTextMax = widthLine;
+ heightTextTotal += heightLine;
+ }
+
+ if ( *pc == wxT('\n') ) {