Ken VanDine has proposed merging lp:~ken-vandine/kubuntu-packaging/qt into 
lp:~kubuntu-packagers/kubuntu-packaging/qt.

Requested reviews:
  Kubuntu Packagers (kubuntu-packagers)
Related bugs:
  Bug #744812 in Ubuntu Font Family: "FontConfig/Qt stack choke on Ubuntu 
Medium font meta-data (No medium in Inkscape and too bold in Qt apps)"
  https://bugs.launchpad.net/ubuntu-font-family/+bug/744812

For more details, see:
https://code.launchpad.net/~ken-vandine/kubuntu-packaging/qt/+merge/126542

default to Regular font in X11

Default to Regular/Normal instead of Medium in QFontDatabase for X11.

Tweak the buckets so that Medium has preference over Bold when DemiBold
is requested.

-- 
https://code.launchpad.net/~ken-vandine/kubuntu-packaging/qt/+merge/126542
Your team Kubuntu Packagers is requested to review the proposed merge of 
lp:~ken-vandine/kubuntu-packaging/qt into 
lp:~kubuntu-packagers/kubuntu-packaging/qt.
=== modified file 'debian/changelog'
--- debian/changelog	2012-09-24 12:41:03 +0000
+++ debian/changelog	2012-09-26 20:33:22 +0000
@@ -1,9 +1,14 @@
-qt4-x11 (4:4.8.3+dfsg-0ubuntu2) UNRELEASED; urgency=low
+qt4-x11 (4:4.8.3+dfsg-0ubuntu2) quantal-proposed; urgency=low
 
+  [ Felix Geyer ]
   * Drop versioned build-dependcy on g++-4.6 [armel]. g++ 4.7 is used
     on all architectures in Ubuntu.
 
- -- Felix Geyer <[email protected]>  Mon, 24 Sep 2012 14:39:23 +0200
+  [ Ken VanDine ]
+  * debian/patches/fix_medium_font.diff
+    - Patch from Michał Sawicz to fix Ubuntu Medium font in Qt (LP: #744812)
+
+ -- Ken VanDine <[email protected]>  Wed, 26 Sep 2012 16:25:16 -0400
 
 qt4-x11 (4:4.8.3+dfsg-0ubuntu1) quantal; urgency=low
 

=== added file 'debian/patches/fix_medium_font.diff'
--- debian/patches/fix_medium_font.diff	1970-01-01 00:00:00 +0000
+++ debian/patches/fix_medium_font.diff	2012-09-26 20:33:22 +0000
@@ -0,0 +1,105 @@
+From: Ken VanDine <[email protected]>
+Description: Default to regular font in X11
+ Default to Regular/Normal instead of Medium in QFontDatabase for X11.
+ .
+ Tweak the buckets so that Medium has preference over Bold when DemiBold
+ is requested.
+Bug-Ubuntu: https://launchpad.net/bugs/744812
+Bug: https://bugreports.qt-project.org/browse/QTBUG-27301
+Forwarded: https://codereview.qt-project.org/#change,35591
+Author: Michał Sawicz<[email protected]>
+
+--- a/src/gui/text/qfontdatabase_x11.cpp
++++ b/src/gui/text/qfontdatabase_x11.cpp
+@@ -729,10 +729,17 @@
+ static int getFCWeight(int fc_weight)
+ {
+     int qtweight = QFont::Black;
+-    if (fc_weight <= (FC_WEIGHT_LIGHT + FC_WEIGHT_MEDIUM) / 2)
++    if (fc_weight <= (FC_WEIGHT_LIGHT + FC_WEIGHT_REGULAR) / 2)
+         qtweight = QFont::Light;
+-    else if (fc_weight <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2)
++    else if (fc_weight <= (FC_WEIGHT_REGULAR + FC_WEIGHT_MEDIUM) / 2)
+         qtweight = QFont::Normal;
++#if 0
++    // FIXME: Uncomment this when it's safe to expand the Enum to include ::Medium
++    // Will map Medium to DemiBold via fallthrough for the moment,
++    // but avoids API/ABI break
++    else if (fc_weight <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2)
++        qtweight = QFont::Medium;
++#endif
+     else if (fc_weight <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD) / 2)
+         qtweight = QFont::DemiBold;
+     else if (fc_weight <= (FC_WEIGHT_BOLD + FC_WEIGHT_BLACK) / 2)
+@@ -772,9 +779,13 @@
+        fontDef.styleHint
+     */
+ 
++    // Default to Regular and thus to the common case.  Previous
++    // versions of Qt requested Medium as default.  This is fine until
++    // a Medium weight is actually provided by a font, and so gets
++    // promoted to bold fallthrough.
+     int weight;
+     if (FcPatternGetInteger(pattern, FC_WEIGHT, 0, &weight) != FcResultMatch)
+-        weight = FC_WEIGHT_MEDIUM;
++        weight = FC_WEIGHT_REGULAR;
+     fontDef.weight = getFCWeight(weight);
+ 
+     int slant;
+@@ -1066,16 +1077,19 @@
+         //         capitalize(value);
+         familyName = QString::fromUtf8((const char *)value);
+         slant_value = FC_SLANT_ROMAN;
+-        weight_value = FC_WEIGHT_MEDIUM;
++        weight_value = FC_WEIGHT_REGULAR;
+         spacing_value = FC_PROPORTIONAL;
+ 	file_value = 0;
+ 	index_value = 0;
+ 	scalable = FcTrue;
+ 
++	// Fallthroughs in case a match was not found.  In previous
++	// versions of Qt, Medium was requested from FontConfig,
++	// leading to a promotion from Medium to Bold.
+         if (FcPatternGetInteger (fonts->fonts[i], FC_SLANT, 0, &slant_value) != FcResultMatch)
+ 	    slant_value = FC_SLANT_ROMAN;
+         if (FcPatternGetInteger (fonts->fonts[i], FC_WEIGHT, 0, &weight_value) != FcResultMatch)
+-	    weight_value = FC_WEIGHT_MEDIUM;
++	    weight_value = FC_WEIGHT_REGULAR;
+         if (FcPatternGetInteger (fonts->fonts[i], FC_SPACING, 0, &spacing_value) != FcResultMatch)
+ 	    spacing_value = FC_PROPORTIONAL;
+         if (FcPatternGetString (fonts->fonts[i], FC_FILE, 0, &file_value) != FcResultMatch)
+@@ -1487,14 +1501,32 @@
+     }
+ 
+     int weight_value = FC_WEIGHT_BLACK;
++    // Default and request Regular font weight if none specified
++    // Previous versions of Qt default to requesting Medium, even
++    // though this weight does not typically exist.
+     if (request.weight == 0)
+-        weight_value = FC_WEIGHT_MEDIUM;
++        weight_value = FC_WEIGHT_REGULAR;
+     else if (request.weight < (QFont::Light + QFont::Normal) / 2)
+         weight_value = FC_WEIGHT_LIGHT;
+-    else if (request.weight < (QFont::Normal + QFont::DemiBold) / 2)
++#if 0
++    // FIXME: Avoid ABI Break; active this full codepath when
++    // QFont::Medium enum is available in the future
++    else if (request.weight < (QFont::Normal + QFont::Medium) / 2)
++        weight_value = FC_WEIGHT_REGULAR;
++    else if (request.weight < (QFont::Medium + QFont::DemiBold) / 2)
+         weight_value = FC_WEIGHT_MEDIUM;
+     else if (request.weight < (QFont::DemiBold + QFont::Bold) / 2)
+         weight_value = FC_WEIGHT_DEMIBOLD;
++#else
++    // For the moment This may still not full-circle correctly; via
++    // Medium->DemiBold->Bold promotion.  However It's hard to do much
++    // about this without an ABI/API tweak to include the fuller set
++    // of standard TTF/CSS/FontConfig weights.
++    else if (request.weight < (QFont::Normal + QFont::DemiBold) / 2)
++        weight_value = FC_WEIGHT_REGULAR;
++    else if (request.weight < (QFont::DemiBold + QFont::Bold) / 2)
++        weight_value = (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2;
++#endif
+     else if (request.weight < (QFont::Bold + QFont::Black) / 2)
+         weight_value = FC_WEIGHT_BOLD;
+     FcPatternDel(pattern, FC_WEIGHT);

=== modified file 'debian/patches/series'
--- debian/patches/series	2012-09-19 14:12:33 +0000
+++ debian/patches/series	2012-09-26 20:33:22 +0000
@@ -45,6 +45,9 @@
 CVE-2011-3922.patch
 no_libicu_message.diff
 QTBUG-25324_assistant_segfault_on_start_with_gcc_4.7.patch
+ 
+# ubuntu patches
+fix_medium_font.diff
 
 # kubuntu patches
 kubuntu_10_ibus_input_method.diff

-- 
kubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/kubuntu-devel

Reply via email to