-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 2c0001f..eafc12e 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -385,98 +385,96 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
385 | // this code causes repeated access to all the font files | 385 | // this code causes repeated access to all the font files |
386 | // which does slow down startup | 386 | // which does slow down startup |
387 | QFontDatabase fontDB; | 387 | QFontDatabase fontDB; |
388 | QStringList familyNames; | 388 | QStringList familyNames; |
389 | familyNames = fontDB.families( FALSE ); | 389 | familyNames = fontDB.families( FALSE ); |
390 | QString s; | 390 | QString s; |
391 | int fontIndex = 0; | 391 | int fontIndex = 0; |
392 | int familyNum = 0; | 392 | int familyNum = 0; |
393 | fontList = new QPopupMenu( this ); | 393 | fontList = new QPopupMenu( this ); |
394 | 394 | ||
395 | for(uint j = 0; j < (uint)familyNames.count(); j++) | 395 | for(uint j = 0; j < (uint)familyNames.count(); j++) |
396 | { | 396 | { |
397 | s = familyNames[j]; | 397 | s = familyNames[j]; |
398 | if ( s.contains('-') ) | 398 | if ( s.contains('-') ) |
399 | { | 399 | { |
400 | int i = s.find('-'); | 400 | int i = s.find('-'); |
401 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; | 401 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; |
402 | } | 402 | } |
403 | s[0] = s[0].upper(); | 403 | s[0] = s[0].upper(); |
404 | 404 | ||
405 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); | 405 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); |
406 | 406 | ||
407 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), | 407 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), |
408 | sizes.count()); | 408 | sizes.count()); |
409 | 409 | ||
410 | if (sizes.count() > 0) | 410 | if (sizes.count() > 0) |
411 | { | 411 | { |
412 | QPopupMenu *sizeMenu; | 412 | QPopupMenu *sizeMenu; |
413 | QFont f; | 413 | QFont f; |
414 | int last_width = -1; | 414 | int last_width = -1; |
415 | sizeMenu = NULL; | 415 | sizeMenu = NULL; |
416 | 416 | ||
417 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) | 417 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) |
418 | { | 418 | { |
419 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); | 419 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); |
420 | // need to divide by 10 on the Z, but not otherwise | 420 | // need to divide by 10 on the Z, but not otherwise |
421 | int size; | 421 | int size; |
422 | 422 | ||
423 | if (i >= (uint)sizes.count()) | 423 | if (i >= (uint)sizes.count()) |
424 | { | 424 | { |
425 | // try for expandable fonts | 425 | // try for expandable fonts |
426 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); | 426 | size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1); |
427 | } | 427 | } |
428 | else | 428 | else |
429 | { | 429 | { |
430 | printf("sizes[%d] = %d\n", i, sizes[i]); | 430 | printf("sizes[%d] = %d\n", i, sizes[i]); |
431 | size = sizes[i]; | 431 | size = sizes[i]; |
432 | } | 432 | } |
433 | // a hack, sizes on Z seem to be points*10 | ||
434 | size /= 10; | ||
435 | 433 | ||
436 | f = QFont(familyNames[j], size); | 434 | f = QFont(familyNames[j], size); |
437 | f.setFixedPitch(true); | 435 | f.setFixedPitch(true); |
438 | QFontMetrics fm(f); | 436 | QFontMetrics fm(f); |
439 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! | 437 | // don't trust f.fixedPitch() or f.exactMatch(), they lie!! |
440 | if (fm.width("l") == fm.width("m") | 438 | if (fm.width("l") == fm.width("m") |
441 | && (i < (uint)sizes.count() | 439 | && (i < (uint)sizes.count() |
442 | || fm.width("m") > last_width)) | 440 | || fm.width("m") > last_width)) |
443 | { | 441 | { |
444 | if (i < (uint)sizes.count()) | 442 | if (i < (uint)sizes.count()) |
445 | { | 443 | { |
446 | last_width = fm.width("m"); | 444 | last_width = fm.width("m"); |
447 | } | 445 | } |
448 | if (sizeMenu == NULL) | 446 | if (sizeMenu == NULL) |
449 | { | 447 | { |
450 | sizeMenu = new QPopupMenu(); | 448 | sizeMenu = new QPopupMenu(); |
451 | } | 449 | } |
452 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); | 450 | int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex); |
453 | sizeMenu->setItemParameter(id, fontIndex); | 451 | sizeMenu->setItemParameter(id, fontIndex); |
454 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); | 452 | sizeMenu->connectItem(id, this, SLOT(setFont(int))); |
455 | QString name = s + " " + QString::number(size); | 453 | QString name = s + " " + QString::number(size); |
456 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); | 454 | fonts.append(new VTFont(name, f, familyNames[j], familyNum, size)); |
457 | if (familyNames[j] == cfgFontName && size == cfgFontSize) | 455 | if (familyNames[j] == cfgFontName && size == cfgFontSize) |
458 | { | 456 | { |
459 | cfont = fontIndex; | 457 | cfont = fontIndex; |
460 | } | 458 | } |
461 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); | 459 | printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size); |
462 | fontIndex++; | 460 | fontIndex++; |
463 | } | 461 | } |
464 | } | 462 | } |
465 | if (sizeMenu) | 463 | if (sizeMenu) |
466 | { | 464 | { |
467 | fontList->insertItem(s, sizeMenu, familyNum + 1000); | 465 | fontList->insertItem(s, sizeMenu, familyNum + 1000); |
468 | 466 | ||
469 | familyNum++; | 467 | familyNum++; |
470 | } | 468 | } |
471 | } | 469 | } |
472 | 470 | ||
473 | } | 471 | } |
474 | 472 | ||
475 | if (cfont < 0 || cfont >= (int)fonts.count()) | 473 | if (cfont < 0 || cfont >= (int)fonts.count()) |
476 | { | 474 | { |
477 | cfont = 0; | 475 | cfont = 0; |
478 | } | 476 | } |
479 | 477 | ||
480 | // create terminal emulation framework //////////////////////////////////// | 478 | // create terminal emulation framework //////////////////////////////////// |
481 | nsessions = 0; | 479 | nsessions = 0; |
482 | 480 | ||