- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/qstring.h
r168 r170 1108 1108 extern Q_EXPORT QCString qt_os2QString2MB( const QString& s, int len=-1 ); 1109 1109 extern Q_EXPORT QString qt_os2MB2QString( const char* mb, int len=-1 ); 1110 extern Q_EXPORT const char *qt_os2UconvFirstByteTable(); 1110 1111 #endif 1111 1112 -
trunk/src/kernel/qapplication_pm.cpp
r168 r170 1015 1015 // some undocumented system values 1016 1016 1017 SV_WORKAREA_YTOP = 51, 1018 SV_WORKAREA_YBOTTOM = 52, 1019 SV_WORKAREA_XRIGHT = 53, 1017 SV_WORKAREA_YTOP = 51, 1018 SV_WORKAREA_YBOTTOM = 52, 1019 SV_WORKAREA_XRIGHT = 53, 1020 1020 SV_WORKAREA_XLEFT = 54, 1021 1021 }; … … 1252 1252 #if 0 1253 1253 qDebug( "WM_CHAR: [%s]", widget->name() ); 1254 #endif 1254 #endif 1255 1255 QWidget *g = QWidget::keyboardGrabber(); 1256 1256 if ( g ) … … 1276 1276 } 1277 1277 break; 1278 } 1279 1280 case WM_QUERYCONVERTPOS : 1281 { 1282 // Ooops, how to get caret pos ? 1283 /// @todo (r=dmik) we should make usage of the QIMEvent 1284 // to query widgets about IME data (see how/where this event 1285 // is used across the sources) 1286 1287 PRECTL pcp = ( PRECTL )mp1; 1288 CURSORINFO ci; 1289 1290 WinQueryCursorInfo( HWND_DESKTOP, &ci ); 1291 1292 memset( pcp, 0xFF, sizeof( RECTL )); 1293 1294 pcp->xLeft = ci.x; 1295 pcp->yBottom = ci.y; 1296 WinMapWindowPoints( ci.hwnd, hwnd, ( PPOINTL )pcp, 2 ); 1297 1298 RETURN( QCP_CONVERT ); 1278 1299 } 1279 1300 … … 1787 1808 USHORT w = r.width(); 1788 1809 USHORT h = r.height(); 1789 // flip y coordinate 1810 // flip y coordinate 1790 1811 y = QApplication::desktop()->height() - (y + h); 1791 1812 WinSetWindowUShort( hwnd, QWS_XRESTORE, x ); … … 1867 1888 // WM_MINMAXFRAME, because WM_MINMAXFRAME is a pre-process message 1868 1889 // (i.e. no actual changes have been made) We need actual changes 1869 // in order to update the frame strut and send WindowStateChange. 1890 // in order to update the frame strut and send WindowStateChange. 1870 1891 result = TRUE; 1871 1892 rc = QtOldFrameProc( hwnd, msg, mp1, mp2 ); … … 2954 2975 ascii = ch; 2955 2976 if ( ascii > 0x7F ) ascii = 0; 2956 if ( ch ) 2957 text = QString::fromLocal8Bit( (char*)&ch, 1 ); 2977 if ( ch ) { 2978 // Note: Ignore the KC_CHAR flag when generating text for a key to get 2979 // correct (non-null) text even for Alt+Letter combinations (that 2980 // don't have KC_CHAR set) because processing Alt+Letter shortcuts 2981 // for non-ASCII letters in widgets (e.g. QPushButton) depends on that. 2982 if ( (chm.fs & (KC_VIRTUALKEY | KC_CHAR)) == KC_CHAR && (chm.chr & 0xFF00) ) { 2983 // We assime we get a DBCS char if the above condition is met. 2984 // DBCS chars seem to have KC_CHAR set but not KC_VIRTUALKEY; we 2985 // use this to prevent keys like ESC (chm=0x011B) with the non-zero 2986 // high byte to be mistakenly recognized as DBCS. 2987 text = QString::fromLocal8Bit( (char *) &chm.chr, 2 ); 2988 } 2989 else 2990 text = QString::fromLocal8Bit( (char*) &ch, 1 ); 2991 } 2958 2992 } 2959 2993 … … 2974 3008 { 2975 3009 KeyRec *result = 0; 3010 if( scan == 0 ) // DBCS chars or user-injected keys 3011 return result; 3012 2976 3013 for (int i=0; i<nrecs; i++) { 2977 3014 if (key_rec[i].scan == scan) { … … 2997 3034 { 2998 3035 KeyRec *result = 0; 3036 if( code == 0 ) // DBCS chars or user-injected keys 3037 return result; 3038 2999 3039 for (int i=0; i<nrecs; i++) { 3000 3040 if (key_rec[i].code == code) { … … 3020 3060 const QString& text ) 3021 3061 { 3062 if( scan == 0 && code == 0 ) // DBCS chars or user-injected keys 3063 return; 3064 3022 3065 if ( nrecs == maxrecs ) { 3023 3066 #if defined(QT_CHECK_RANGE) 3024 3067 qWarning( "Qt: Internal keyboard buffer overflow" ); 3025 3068 #endif 3026 3069 return; 3027 3070 } 3028 3071 … … 3044 3087 3045 3088 if ( sm_blockUserInput ) // block user interaction during session management 3046 3089 return TRUE; 3047 3090 3048 3091 translateKeyCode( chm, code, ascii, state, text ); 3049 /// @todo (dmik) currently WM_CHARs chars with zero virtual code or zero 3050 // scancode are totally ignored. -- are they? 3051 // if ( !code || !chm.scancode ) return FALSE; 3092 3093 // Note: code and/or chm.scancode may be zero here. We cannot ignore such 3094 // events because, for example, all non-ASCII letters have zero virtual 3095 // codes, and DBCS characters entered via IME have both zero virtual codes 3096 // and zero scancodes. However, if both code and chm.scancode are zero 3097 // (as for DBCS), store_key_rec()/find_key_rec() will do nothing which 3098 // means that: 3099 // 1) QKeyEvents will not have the auto-repeat flag set when a key is 3100 // being auto-repeated by the system; 3101 // 2) there will be no QEvent::KeyRelease event corresponding to the 3102 // QEvent::KeyPress event. 3052 3103 3053 3104 // Invert state logic … … 3072 3123 // "Alt depressed" event, that must preceed it, will be 3073 3124 // eaten by the system) 3074 find_key_rec( Qt::Key_Alt, TRUE ); 3125 find_key_rec( Qt::Key_Alt, TRUE ); 3075 3126 /// @todo (dmik) do the same for other global keys (ALT+TAB, ALT+ESC, CTRL+ESC) 3076 3127 // by handling this situation when we obtain/loose focus) … … 3080 3131 // that find_key_rec() above should also be removed to get identical behavior for 3081 3132 // all stolen keys. This will allow to solve the problem on the Qt application 3082 // level if needed (and even in a platform-independent manner). 3133 // level if needed (and even in a platform-independent manner). 3083 3134 } 3084 3135 return TRUE; … … 3127 3178 } 3128 3179 3129 #if 0 3180 #if 0 3130 3181 qDebug("WM_CHAR: RESULT = %d", (k0 || k1)); 3131 #endif 3182 #endif 3132 3183 return k0 || k1; 3133 3184 } -
trunk/src/kernel/qfontengine_pm.cpp
r168 r170 43 43 #include <qpaintdevice.h> 44 44 #include <qpainter.h> 45 //@@TODO (dmik): need?46 //#include <limits.h>47 //#include <math.h>48 45 49 46 #include <private/qunicodetables_p.h> … … 52 49 #include <qthreadstorage.h> 53 50 54 // @@TODO (dmik):need?51 /// @todo need? 55 52 //#ifndef M_PI 56 53 //#define M_PI 3.14159265358979 … … 59 56 // per-thread unique screen ps to perform font operations 60 57 61 // @@TODO (dmik):optimize: use small mem hps'es 1x1 px instead of screen ps?58 /// @todo (r=dmik) optimize: use small mem hps'es 1x1 px instead of screen ps? 62 59 class QDisplayPS 63 60 { … … 70 67 71 68 72 //@@TODO (dmik): remove?73 //// defined in qtextengine_win.cpp74 //typedef void *SCRIPT_CACHE;75 //typedef HRESULT (WINAPI *fScriptFreeCache)( SCRIPT_CACHE *);76 //extern fScriptFreeCache ScriptFreeCache;77 78 79 //@@TODO (dmik): remove?80 //static unsigned char *getCMap( HDC hdc, bool & );81 //static Q_UINT16 getGlyphIndex( unsigned char *table, unsigned short unicode );82 83 84 //@@TODO (dmik): remove?85 //HDC shared_dc = 0; // common dc for all fonts86 //static HFONT shared_dc_font = 0; // used by Windows 95/9887 //static HFONT stock_sysfont = 0;88 //89 //static inline HFONT systemFont()90 //{91 // if ( stock_sysfont == 0 )92 // stock_sysfont = (HFONT)GetStockObject(SYSTEM_FONT);93 // return stock_sysfont;94 //}95 96 69 // general font engine 97 70 … … 100 73 hps = 0; 101 74 delete pfm; 102 //@@TODO (dmik): remove...103 // QT_WA( {104 // if ( hdc ) { // one DC per font (Win NT)105 // //SelectObject( hdc, systemFont() );106 // if ( !stockFont )107 // DeleteObject( hfont );108 // if ( !paintDevice )109 // ReleaseDC( 0, hdc );110 // hdc = 0;111 // hfont = 0;112 // }113 // } , {114 // if ( hfont ) { // shared DC (Windows 95/98)115 // if ( shared_dc_font == hfont ) { // this is the current font116 // Q_ASSERT( shared_dc != 0 );117 // SelectObject( shared_dc, systemFont() );118 // shared_dc_font = 0;119 // }120 // if ( !stockFont )121 // DeleteObject( hfont );122 // hfont = 0;123 // }124 // } );125 // delete [] cmap;126 //127 // // for Uniscribe128 // if ( ScriptFreeCache )129 // ScriptFreeCache( &script_cache );130 75 } 131 76 132 77 int QFontEngine::lineThickness() const 133 78 { 134 // @@TODO (dmik):values from FONTMETRICS are not always good (line is too79 /// @todo (r=dmik) values from FONTMETRICS are not always good (line is too 135 80 // thick or too close to glyphs). The algorithm below is not always perfect 136 81 // either. Which one to leave? … … 149 94 int QFontEngine::underlinePosition() const 150 95 { 151 // @@TODO (dmik):values from FONTMETRICS are not always good (line is too96 /// @todo (r=dmik) values from FONTMETRICS are not always good (line is too 152 97 // thick or too close to glyphs). The algorithm below is not always perfect 153 98 // either. Which one to leave? … … 228 173 } 229 174 230 //@@TODO (dmik): remove?231 //HDC QFontEngine::dc() const232 //{233 // if ( hdc || (qt_winver & Qt::WV_NT_based) ) // either NT_based or Printer234 // return hdc;235 // Q_ASSERT( shared_dc != 0 && hfont != 0 );236 // if ( shared_dc_font != hfont ) {237 // SelectObject( shared_dc, hfont );238 // shared_dc_font = hfont;239 // }240 // return shared_dc;241 //}242 243 //@@TODO (dmik): remove?244 //void QFontEngine::getCMap()245 //{246 // QT_WA( {247 // ttf = (bool)(tm.w.tmPitchAndFamily & TMPF_TRUETYPE);248 // } , {249 // ttf = (bool)(tm.a.tmPitchAndFamily & TMPF_TRUETYPE);250 // } );251 // HDC hdc = dc();252 // SelectObject( hdc, hfont );253 // bool symb = false;254 // cmap = ttf ? ::getCMap( hdc, symb ) : 0;255 // if ( !cmap ) {256 // ttf = false;257 // symb = false;258 // }259 // symbol = symb;260 // script_cache = 0;261 //}262 263 //@@TODO (dmik): remove264 //void QFontEngine::getGlyphIndexes( const QChar *ch, int numChars, glyph_t *glyphs, bool mirrored ) const265 //{266 // if ( mirrored ) {267 // if ( symbol ) {268 // while( numChars-- ) {269 // *glyphs = getGlyphIndex(cmap, ch->unicode() );270 // if(!*glyphs && ch->unicode() < 0x100)271 // *glyphs = getGlyphIndex(cmap, ch->unicode()+0xf000 );272 // glyphs++;273 // ch++;274 // }275 // } else if ( ttf ) {276 // while( numChars-- ) {277 // *glyphs = getGlyphIndex(cmap, ::mirroredChar(*ch).unicode() );278 // glyphs++;279 // ch++;280 // }281 // } else {282 // while( numChars-- ) {283 // *glyphs = ::mirroredChar(*ch).unicode();284 // glyphs++;285 // ch++;286 // }287 // }288 // } else {289 // if ( symbol ) {290 // while( numChars-- ) {291 // *glyphs = getGlyphIndex(cmap, ch->unicode() );292 // if(!*glyphs && ch->unicode() < 0x100)293 // *glyphs = getGlyphIndex(cmap, ch->unicode()+0xf000 );294 // glyphs++;295 // ch++;296 // }297 // } else if ( ttf ) {298 // while( numChars-- ) {299 // *glyphs = getGlyphIndex(cmap, ch->unicode() );300 // glyphs++;301 // ch++;302 // }303 // } else {304 // while( numChars-- ) {305 // *glyphs = ch->unicode();306 // glyphs++;307 // ch++;308 // }309 // }310 // }311 //}312 313 175 QFontEnginePM::QFontEnginePM( HPS ps, PFATTRS pfa, int pixelSize, int pointSize ) 314 176 { … … 325 187 // cache cost here should be in bytes. it is converted to 326 188 // kbytes by QFontCache::increaseCost() 327 //@@TODO (dmik):is this formula for cost ok?189 /// @todo is this formula for cost ok? 328 190 cache_cost = pfm->lMaxBaselineExt * pfm->lAveCharWidth * 2000; 329 191 … … 332 194 } 333 195 334 //@@TODO (dmik): remove 335 //QFontEngineWin::QFontEngineWin( const char * name, HDC _hdc, HFONT _hfont, bool stockFont, LOGFONT lf ) 336 //{ 337 // paintDevice = FALSE; 338 // //qDebug("regular windows font engine created: font='%s', size=%d", name, lf.lfHeight); 339 // 340 // _name = name; 341 // 342 // hdc = _hdc; 343 // hfont = _hfont; 344 // logfont = lf; 345 // SelectObject( dc(), hfont ); 346 // this->stockFont = stockFont; 347 // 348 // lbearing = SHRT_MIN; 349 // rbearing = SHRT_MIN; 350 // 351 // BOOL res; 352 // QT_WA( { 353 // res = GetTextMetricsW( dc(), &tm.w ); 354 // } , { 355 // res = GetTextMetricsA( dc(), &tm.a ); 356 // } ); 357 //#ifndef QT_NO_DEBUG 358 // if ( !res ) 359 // qSystemWarning( "QFontPrivate: GetTextMetrics failed" ); 360 //#endif 361 // cache_cost = tm.w.tmHeight * tm.w.tmAveCharWidth * 2000; 362 // getCMap(); 363 // 364 // useTextOutA = FALSE; 365 //#ifndef Q_OS_TEMP 366 // // TextOutW doesn't work for symbol fonts on Windows 95! 367 // // since we're using glyph indices we don't care for ttfs about this! 368 // if ( qt_winver == Qt::WV_95 && !ttf && 369 // ( _name == "Marlett" || _name == "Symbol" || _name == "Webdings" || _name == "Wingdings" ) ) 370 // useTextOutA = TRUE; 371 //#endif 372 // memset( widthCache, 0, sizeof(widthCache) ); 373 //} 374 375 //@@TODO (dmik): current implementation of this fn uses the local8bit QChar 196 #define isDBCSGlyph(g) ( (g) & 0xFF00 ) 197 198 #define queryGlyphSize(g) ( isDBCSGlyph( g ) ? 2 : 1 ) 199 200 /// @todo (r=dmik) current implementation of this fn uses the local8bit QChar 376 201 // code as the glyph index, i.e. glyphs are just unicode chars converted to 377 202 // 8 bit chars according to the current (system) code page. This will be 378 // changed when all font-related code will berewritten to support true unicode203 // changed when all font-related code is rewritten to support true unicode 379 204 // (for example, by using innotek ft2lib, since native OS/2 unicode support 380 205 // relative to text output using GPI is pretty buggy). 381 QFontEngine::Error QFontEnginePM::stringToCMap( const QChar *str, int len, glyph_t *glyphs, advance_t *advances, int *nglyphs, bool mirrored ) const 382 { 383 if ( *nglyphs < len ) { 384 *nglyphs = len; 385 return OutOfMemory; 386 } 387 388 //@@TODO (dmik): mirrored is currently ignored. 389 Q_UNUSED(mirrored); 390 391 // convert chars to glyphs 206 QFontEngine::Error QFontEnginePM::stringToCMap( const QChar *str, int len, 207 glyph_t *glyphs, advance_t *advances, 208 int *nglyphs, bool mirrored ) const 209 { 210 /// @todo mirrored is currently ignored. 211 Q_UNUSED( mirrored ); 212 213 const char *uconvFirstByteTable = qt_os2UconvFirstByteTable(); 214 215 // convert multibyte chars to "wide char" glyphs 392 216 QCString s = QConstString( str, len ).string().local8Bit(); 393 for ( int i = 0; i < len; i++ ) { 394 glyphs[i] = (uchar) s[i]; 217 // sanity check (uint value must fit into positive int) 218 Q_ASSERT( (int) s.size() >= 1 ); 219 if ( (int) s.size() < 1 ) { 220 *nglyphs = 0; 221 return OutOfMemory; 222 } 223 // we use QCString::size() instead of length() because the str array may 224 // contain embedded zero chars that must be also processed 225 int slen = (int) s.size() - 1; // exclude terminating zero 226 if ( slen == 0 ) { 227 // null string or no valid conversion, nothing to do 228 *nglyphs = 0; 229 return NoError; 230 } 231 int givenLen = *nglyphs; 232 int realLen = 0; 233 for( int i = 0; i < slen; i++ ) { 234 bool isDBCSLeadByte = uconvFirstByteTable[ (uchar) s[ i ] ] == 2; 235 if ( realLen < givenLen ) { 236 // enough space, store the glyph 237 glyphs[ realLen ] = s[ i ] & 0xFF; 238 if( isDBCSLeadByte ) 239 glyphs[ realLen ] |= ( s[ ++i ] << 8 ) & 0xFF00; 240 } else { 241 // not enough space, keep calulating the length 242 if( isDBCSLeadByte ) 243 ++i; 244 } 245 realLen++; 246 } 247 248 if ( givenLen < realLen ) { 249 *nglyphs = realLen; 250 return OutOfMemory; 395 251 } 396 252 397 253 if ( advances ) { 398 399 400 for( register int i = 0; i < len; i++ ) {401 402 403 404 254 HPS ps = 0; 255 glyph_t glyph; 256 for( register int i = 0; i < realLen; i++ ) { 257 glyph = *(glyphs + i); 258 advances[i] = (glyph < widthCacheSize) ? widthCache[glyph] : 0; 259 // font-width cache failed 260 if ( !advances[i] ) { 405 261 if ( !ps ) ps = this->ps(); 406 262 POINTL ptls [TXTBOX_COUNT]; 407 GpiQueryTextBox( ps, 1, &s[i], TXTBOX_COUNT, ptls); 263 GpiQueryTextBox( ps, queryGlyphSize( glyph ), 264 (PCH) &glyph, TXTBOX_COUNT, ptls ); 408 265 advances[i] = ptls[4].x; 409 410 411 412 413 414 } 415 416 *nglyphs = len;266 // if glyph's within cache range, store it for later 267 if ( glyph < widthCacheSize && advances[i] < 0x100 ) 268 ((QFontEnginePM *)this)->widthCache[glyph] = advances[i]; 269 } 270 } 271 } 272 273 *nglyphs = realLen; 417 274 return NoError; 418 419 //@@TODO (dmik): remove420 // if ( *nglyphs < len ) {421 // *nglyphs = len;422 // return OutOfMemory;423 // }424 //425 // getGlyphIndexes( str, len, glyphs, mirrored );426 //427 // if ( advances ) {428 // HDC hdc = dc();429 // unsigned int glyph;430 // int overhang = (qt_winver & Qt::WV_DOS_based) ? tm.a.tmOverhang : 0;431 // for( register int i = 0; i < len; i++ ) {432 // glyph = *(glyphs + i);433 // advances[i] = (glyph < widthCacheSize) ? widthCache[glyph] : 0;434 // // font-width cache failed435 // if ( !advances[i] ) {436 // SIZE size;437 // GetTextExtentPoint32W( hdc, (wchar_t *)str, 1, &size );438 // advances[i] = size.cx - overhang;439 // // if glyph's within cache range, store it for later440 // if ( glyph < widthCacheSize && (size.cx - overhang) < 0x100 )441 // ((QFontEngineWin *)this)->widthCache[glyph] = size.cx - overhang;442 // }443 // str++;444 // }445 // }446 //447 // *nglyphs = len;448 // return NoError;449 275 } 450 276 … … 456 282 extern const LONG qt_ropCodes_2ROP[]; 457 283 458 void QFontEnginePM::draw( QPainter *p, int x, int y, const QTextEngine *engine, const QScriptItem *si, int textFlags ) 284 void QFontEnginePM::draw( QPainter *p, int x, int y, const QTextEngine 285 *engine, const QScriptItem *si, int textFlags ) 459 286 { 460 287 HPS ps = p->handle(); … … 463 290 advance_t *advances = engine->advances( si ); 464 291 qoffset_t *offsets = engine->offsets( si ); 465 466 /// @todo (dmik)467 // glyphs here are just 8 bit chars (see stringToCMap()),468 // and glyph_t is temporarly defined as unsigned char.469 // it should be changed later.470 PSZ cglyphs = (PSZ) glyphs;471 /*472 QConstString str( (QChar *)glyphs, si->num_glyphs );473 QCString cglyphs = str.string().latin1();474 */475 292 476 293 // GPI version of the opaque rectangle below the text is rather strange, … … 480 297 GpiSetMix( ps, FM_LEAVEALONE ); 481 298 // use drawRect to have the rectangle properly transformed 482 /// @todo ( dmik)299 /// @todo (r=dmik) 483 300 // we don't add 1 to si->ascent + si->descent to exactly match 484 301 // QFontMetrics::boundingRect(). This stuff needs to be reviewed … … 563 380 564 381 if ( p->txop == QPainter::TxTranslate ) { 565 382 p->map( x, y, &x, &y ); 566 383 } else if ( p->txop > QPainter::TxTranslate ) { 567 384 y = -y; 568 385 ySign = -1; 569 386 nativexform = p->setNativeXForm( TRUE /* assumeYNegation */ ); 570 571 387 if( !nativexform ) 388 return; 572 389 } 573 390 … … 598 415 if ( haveOffsets ) { 599 416 for( int i = 0; i < si->num_glyphs; i++ ) { 600 char chr = *glyphs;601 417 ptl.x = x + offsets->x; 602 418 ptl.y = y + ySign * offsets->y; … … 604 420 if ( !nativexform && p->devh ) 605 421 ptl.y = p->devh - (ptl.y + 1); 606 GpiCharStringPosAt( ps, &ptl, NULL, options, 1, &chr, NULL ); 422 GpiCharStringPosAt( ps, &ptl, NULL, options, 423 queryGlyphSize( *glyphs ), (PCH) glyphs, NULL ); 607 424 x += *advances; 608 425 glyphs++; … … 617 434 if ( !nativexform && p->devh ) 618 435 ptl.y = p->devh - (ptl.y + 1); 436 GpiMove( ps, &ptl ); 619 437 // draw glyphs in 512 char chunks: it's a GpiCharString* limitation 620 GpiMove( ps, &ptl ); 621 for ( int i = 0; i < si->num_glyphs; i += 512 ) { 622 GpiCharStringPos( ps, NULL, options | CHS_VECTOR, 623 QMIN( si->num_glyphs - i, 512 ), cglyphs, (PLONG) advances ); 624 cglyphs += 512; 625 advances += 512; 438 advance_t adv[ 512 ]; 439 char str[ 512 ]; 440 int len = 0; 441 // convert "wide char" glyphs to a multi byte string 442 glyph_t *pg = glyphs; 443 advance_t *pa = advances; 444 for( int i = 0; i < si->num_glyphs; i++, pg++, pa++ ) { 445 str[ len ] = *pg & 0xFF; 446 adv[ len++ ] = *pa; 447 448 if( isDBCSGlyph( *pg ) ) { 449 str[ len ] = ( *pg & 0xFF00 ) >> 8; 450 adv[ len++ ] = 0; 451 } 452 453 if( len > 510 ) { 454 GpiCharStringPos( ps, NULL, options | CHS_VECTOR, len, str, (PLONG) adv ); 455 len = 0; 456 } 626 457 } 458 459 if( len > 0 ) 460 GpiCharStringPos( ps, NULL, options | CHS_VECTOR, len, str, (PLONG) adv ); 461 627 462 x += w; 628 463 } 629 464 } else { 630 offsets += si->num_glyphs; 631 advances += si->num_glyphs; 632 glyphs += si->num_glyphs; 633 for( int i = 0; i < si->num_glyphs; i++ ) { 634 glyphs--; 635 offsets--; 636 advances--; 637 char chr = *glyphs; 638 ptl.x = x + offsets->x; 639 ptl.y = y + ySign * offsets->y; 465 offsets += si->num_glyphs; 466 advances += si->num_glyphs; 467 glyphs += si->num_glyphs; 468 for( int i = 0; i < si->num_glyphs; i++ ) { 469 glyphs--; 470 offsets--; 471 advances--; 472 ptl.x = x + offsets->x; 473 ptl.y = y + ySign * offsets->y; 640 474 // flip y coordinate 641 475 if ( !nativexform && p->devh ) 642 476 ptl.y = p->devh - (ptl.y + 1); 643 GpiCharStringPosAt( ps, &ptl, NULL, options, 1, &chr, NULL ); 644 x += *advances; 645 } 477 GpiCharStringPosAt( ps, &ptl, NULL, options, 478 queryGlyphSize( *glyphs ), (PCH) glyphs, NULL ); 479 x += *advances; 480 } 646 481 } 647 482 … … 710 545 w += *(--end); 711 546 712 //@@TODO (dmik):look at usage of this fn, is the return correct?547 /// @todo (r=dmik) look at usage of this fn, is the return correct? 713 548 return glyph_metrics_t( 714 549 0, -pfm->lMaxAscender, w, pfm->lMaxAscender + pfm->lMaxDescender, w, 0 … … 718 553 glyph_metrics_t QFontEnginePM::boundingBox( glyph_t glyph ) 719 554 { 720 //@@TODO (dmik): glyphs here are just 8 bit chars (see stringToCMap()),721 // it should be changed later.722 555 POINTL ptls [TXTBOX_COUNT]; 723 GpiQueryTextBox( ps(), 1, (char *)&glyph, TXTBOX_COUNT, ptls ); 556 GpiQueryTextBox( ps(), queryGlyphSize( glyph ), 557 (PCH) &glyph, TXTBOX_COUNT, ptls ); 724 558 int minx = 0, miny = 0, maxx = 0, maxy = 0; 725 559 for ( int i = 0; i < 4; i++ ) { … … 732 566 minx, -maxy, maxx - minx + 1, maxy - miny + 1, ptls[4].x, -ptls[4].y 733 567 ); 734 735 //@@TODO (dmik): remove736 //#ifndef Q_OS_TEMP737 // GLYPHMETRICS gm;738 //739 // if( !ttf ) {740 // SIZE s;741 // WCHAR ch = glyph;742 // BOOL res = GetTextExtentPoint32W( dc(), &ch, 1, &s );743 // Q_UNUSED( res );744 // int overhang = (qt_winver & Qt::WV_DOS_based) ? tm.a.tmOverhang : 0;745 // return glyph_metrics_t( 0, -tm.a.tmAscent, s.cx, tm.a.tmHeight, s.cx-overhang, 0 );746 // } else {747 // DWORD res = 0;748 // MAT2 mat;749 // mat.eM11.value = mat.eM22.value = 1;750 // mat.eM11.fract = mat.eM22.fract = 0;751 // mat.eM21.value = mat.eM12.value = 0;752 // mat.eM21.fract = mat.eM12.fract = 0;753 // QT_WA( {754 // res = GetGlyphOutlineW( dc(), glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat );755 // } , {756 // res = GetGlyphOutlineA( dc(), glyph, GGO_METRICS|GGO_GLYPH_INDEX, &gm, 0, 0, &mat );757 // } );758 // if ( res != GDI_ERROR )759 // return glyph_metrics_t( gm.gmptGlyphOrigin.x, -gm.gmptGlyphOrigin.y,760 // gm.gmBlackBoxX, gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY );761 // }762 //#endif763 // return glyph_metrics_t();764 568 } 765 569 … … 784 588 } 785 589 786 //@@TODO (dmik): remove?787 //enum { max_font_count = 256 };788 //static const ushort char_table[] = {789 // 40,790 // 67,791 // 70,792 // 75,793 // 86,794 // 88,795 // 89,796 // 91,797 // 102,798 // 114,799 // 124,800 // 127,801 // 205,802 // 645,803 // 884,804 // 922,805 // 1070,806 // 12386,807 // 0808 //};809 //810 //static const int char_table_entries = sizeof(char_table)/sizeof(ushort);811 812 813 590 int QFontEnginePM::minLeftBearing() const 814 591 { 815 //@@TODO (dmik):later592 /// @todo (r=dmik) later 816 593 return 0; 817 594 // if ( lbearing == SHRT_MIN ) … … 823 600 int QFontEnginePM::minRightBearing() const 824 601 { 825 //@@TODO (dmik):later602 /// @todo (r=dmik) later 826 603 return 0; 827 604 //#ifdef Q_OS_TEMP … … 905 682 } 906 683 907 //@@TODO (dmik): remove908 //const char *QFontEngineWin::name() const909 //{910 // return 0;911 //}912 913 684 bool QFontEnginePM::canRender( const QChar *string, int len ) 914 685 { 915 //@@TODO (dmik):later686 /// @todo (r=dmik) later 916 687 return TRUE; 917 688 … … 962 733 963 734 964 /// @todo ( dmik) need this all?735 /// @todo (r=dmik) all this may be necessary when ft2lib is used 965 736 #if 0 966 737 #define MAKE_TAG(ch1, ch2, ch3, ch4) (\ -
trunk/src/kernel/qtextengine_p.h
r168 r170 180 180 #elif defined( Q_WS_PM ) 181 181 182 // @@TODO (dmik):the definitions below is almost unchecked (no true unicode182 /// @todo (r=dmik) the definitions below is almost unchecked (no true unicode 183 183 // support yet) 184 184 185 //@@TODO (dmik): curretnly glyphs are just 8 bit chars (see 186 // QFontEnginePM::stringToCMap()), so glyph_t is temporarily defined as 187 // unsigned char. it should be changed later. 188 typedef unsigned char glyph_t; 189 //typedef unsigned short glyph_t; 185 // Use wide char to contain DBCS char in one glyph 186 typedef unsigned short glyph_t; 190 187 191 188 struct qoffset_t { … … 196 193 typedef int advance_t; 197 194 198 // @@TODO (dmik):it's a dummy version...195 /// @todo (r=dmik) it's a dummy version... 199 196 struct QScriptAnalysis { 200 197 unsigned short script :10; -
trunk/src/tools/qstring.cpp
r168 r170 7019 7019 } 7020 7020 7021 // WATCH OUT: mblen must NOT include the NUL (in contrast with qt_winMB2QString) 7021 // WATCH OUT: mblen must NOT include the NUL (in contrast with qt_winMB2QString) 7022 7022 QString qt_os2MB2QString( const char* mb, int mblen ) 7023 7023 { … … 7070 7070 } 7071 7071 7072 const char *qt_os2UconvFirstByteTable() 7073 { 7074 static char achFirst[ 256 ] = { -1, }; 7075 7076 if( achFirst[ 0 ] == -1 ) 7077 UniQueryUconvObject( qt_os2DefUconvObj(), NULL, 0, achFirst, NULL, NULL ); 7078 7079 return achFirst; 7080 } 7081 7072 7082 #endif // Q_OS_OS2
Note:
See TracChangeset
for help on using the changeset viewer.