fixed Semibold font in Qt 5.4.0 fontconfig, fixed youtu.be with #

This commit is contained in:
John Preston 2015-02-14 15:41:32 +03:00
parent 0a5e1a69e3
commit 394170bd4c
2 changed files with 19 additions and 1 deletions

View File

@ -3340,7 +3340,7 @@ void HistoryContact::updateFrom(const MTPMessageMedia &media) {
namespace {
QRegularExpression reYouTube1(qsl("^(https?://)?(www\\.|m\\.)?youtube\\.com/watch\\?([^#]+&)?v=([a-z0-9_-]+)(&[^\\s]*)?$"), QRegularExpression::CaseInsensitiveOption);
QRegularExpression reYouTube2(qsl("^(https?://)?(www\\.)?youtu\\.be/([a-z0-9_-]+)([/\\?][^\\s]*)?$"), QRegularExpression::CaseInsensitiveOption);
QRegularExpression reYouTube2(qsl("^(https?://)?(www\\.)?youtu\\.be/([a-z0-9_-]+)([/\\?#][^\\s]*)?$"), QRegularExpression::CaseInsensitiveOption);
QRegularExpression reInstagram(qsl("^(https?://)?(www\\.)?instagram\\.com/p/([a-z0-9_-]+)([/\\?][^\\s]*)?$"), QRegularExpression::CaseInsensitiveOption);
QRegularExpression reVimeo(qsl("^(https?://)?(www\\.)?vimeo\\.com/([0-9]+)([/\\?][^\\s]*)?$"), QRegularExpression::CaseInsensitiveOption);

View File

@ -341,6 +341,15 @@ static void populateFromPattern(FcPattern *pattern)
return;
familyName = QString::fromUtf8((const char *)value);
if (familyName == QLatin1String("Open Sans")) {
FcChar8 *styl = 0;
if (FcPatternGetString(pattern, FC_STYLE, 0, &styl) == FcResultMatch) {
QString style = QString::fromUtf8(reinterpret_cast<const char *>(styl));
if (style == QLatin1String("Semibold")) {
familyName.append(QChar(QChar::Space)).append(style);
}
}
}
slant_value = FC_SLANT_ROMAN;
weight_value = FC_WEIGHT_REGULAR;
@ -778,6 +787,15 @@ QStringList QFontconfigDatabase::addApplicationFont(const QByteArray &fontData,
FcChar8 *fam = 0;
if (FcPatternGetString(pattern, FC_FAMILY, 0, &fam) == FcResultMatch) {
QString family = QString::fromUtf8(reinterpret_cast<const char *>(fam));
if (family == QLatin1String("Open Sans")) {
FcChar8 *styl = 0;
if (FcPatternGetString(pattern, FC_STYLE, 0, &styl) == FcResultMatch) {
QString style = QString::fromUtf8(reinterpret_cast<const char *>(styl));
if (style == QLatin1String("Semibold")) {
family.append(QChar(QChar::Space)).append(style);
}
}
}
families << family;
}
populateFromPattern(pattern);