diff -Nur qt4-x11-4.5.0-orig/src/gui/text/qfontdatabase_x11.cpp qt4-x11-4.5.0/src/gui/text/qfontdatabase_x11.cpp --- qt4-x11-4.5.0-orig/src/gui/text/qfontdatabase_x11.cpp 2009-04-25 20:22:01.000000000 +0900 +++ qt4-x11-4.5.0/src/gui/text/qfontdatabase_x11.cpp 2009-04-25 20:27:54.000000000 +0900 @@ -795,6 +795,7 @@ if (scalable) { fontDef.stretch = request.stretch; fontDef.style = request.style; + fontDef.weight = request.weight; } else { int width; if (FcPatternGetInteger(pattern, FC_WIDTH, 0, &width) == FcResultMatch) @@ -1370,6 +1371,43 @@ // keep the same pitch equiv_enc->pitch = enc->pitch; } + + for (int k = 0; k < foundry->count; ++k) { + QtFontStyle *style = foundry->styles[k]; + if (style->key.weight > QFont::Normal) continue; + + QtFontSize *size = style->pixelSize(SMOOTH_SCALABLE); + if (! size) continue; // should not happen + QtFontEncoding *enc = size->encodingID(-1, 0, 0, 0, 0, true); + if (! enc) continue; // should not happen either + + QtFontStyle::Key key = style->key; + + // does this style have an demibold equivalent? + key.weight = QFont::DemiBold; + QtFontStyle *equiv = foundry->style(key); + if (equiv) continue; + + // does this style have an black equivalent? + key.weight = QFont::Black; + equiv = foundry->style(key); + if (equiv) continue; + + // does this style have an bold equivalent? + key.weight = QFont::Bold; + equiv = foundry->style(key); + if (equiv) continue; + + // let's fake one... + equiv = foundry->style(key, true); + equiv->smoothScalable = true; + + QtFontSize *equiv_size = equiv->pixelSize(SMOOTH_SCALABLE, true); + QtFontEncoding *equiv_enc = equiv_size->encodingID(-1, 0, 0, 0, 0, true); + + // keep the same pitch + equiv_enc->pitch = enc->pitch; + } } } #endif