equal
deleted
inserted
replaced
1127 * \returns true if a family was extracted. |
1127 * \returns true if a family was extracted. |
1128 */ |
1128 */ |
1129 static bool setFontFamilyFromValues(const QVector<Value> &values, QFont *font, int start = 0) |
1129 static bool setFontFamilyFromValues(const QVector<Value> &values, QFont *font, int start = 0) |
1130 { |
1130 { |
1131 QString family; |
1131 QString family; |
|
1132 bool shouldAddSpace = false; |
1132 for (int i = start; i < values.count(); ++i) { |
1133 for (int i = start; i < values.count(); ++i) { |
1133 const Value &v = values.at(i); |
1134 const Value &v = values.at(i); |
1134 if (v.type == Value::TermOperatorComma) { |
1135 if (v.type == Value::TermOperatorComma) { |
1135 family += QLatin1Char(','); |
1136 family += QLatin1Char(','); |
|
1137 shouldAddSpace = false; |
1136 continue; |
1138 continue; |
1137 } |
1139 } |
1138 const QString str = v.variant.toString(); |
1140 const QString str = v.variant.toString(); |
1139 if (str.isEmpty()) |
1141 if (str.isEmpty()) |
1140 break; |
1142 break; |
|
1143 if (shouldAddSpace) |
|
1144 family += QLatin1Char(' '); |
1141 family += str; |
1145 family += str; |
1142 family += QLatin1Char(' '); |
1146 shouldAddSpace = true; |
1143 } |
1147 } |
1144 family = family.simplified(); |
|
1145 if (family.isEmpty()) |
1148 if (family.isEmpty()) |
1146 return false; |
1149 return false; |
1147 font->setFamily(family); |
1150 font->setFamily(family); |
1148 return true; |
1151 return true; |
1149 } |
1152 } |