Add a way to disable syntethesized bold and italic support
Using the environment variables QT_NO_SYNTHESIZED_BOLD and QT_NO_SYNTHESIZED_ITALIC it is now possible to disable the support for synthesized bold and italic, which is used when the font doesn't support those variants. Change-Id: Ic1a6984858e1260f252662689705553073859df4 Task-number: QTBUG-83124 Pick-to: 5.15 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>bb10
parent
7b5d5faae1
commit
f1beb28c46
|
|
@ -258,10 +258,10 @@ void QCoreTextFontEngine::init()
|
|||
if (slant > 500 && !(traits & kCTFontItalicTrait))
|
||||
fontDef.style = QFont::StyleOblique;
|
||||
|
||||
if (fontDef.weight >= QFont::Bold && !(traits & kCTFontBoldTrait))
|
||||
if (fontDef.weight >= QFont::Bold && !(traits & kCTFontBoldTrait) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD"))
|
||||
synthesisFlags |= SynthesizedBold;
|
||||
// XXX: we probably don't need to synthesis italic for oblique font
|
||||
if (fontDef.style != QFont::StyleNormal && !(traits & kCTFontItalicTrait))
|
||||
if (fontDef.style != QFont::StyleNormal && !(traits & kCTFontItalicTrait) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_ITALIC"))
|
||||
synthesisFlags |= SynthesizedItalic;
|
||||
|
||||
avgCharWidth = 0;
|
||||
|
|
|
|||
|
|
@ -742,13 +742,13 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
|
|||
FT_Face face = lockFace();
|
||||
|
||||
if (FT_IS_SCALABLE(face)) {
|
||||
bool fake_oblique = (fontDef.style != QFont::StyleNormal) && !(face->style_flags & FT_STYLE_FLAG_ITALIC);
|
||||
bool fake_oblique = (fontDef.style != QFont::StyleNormal) && !(face->style_flags & FT_STYLE_FLAG_ITALIC) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_ITALIC");
|
||||
if (fake_oblique)
|
||||
obliquen = true;
|
||||
FT_Set_Transform(face, &matrix, nullptr);
|
||||
freetype->matrix = matrix;
|
||||
// fake bold
|
||||
if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face)) {
|
||||
if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face) && !qEnvironmentVariableIsSet("QT_NO_SYNTHESIZED_BOLD")) {
|
||||
if (const TT_OS2 *os2 = reinterpret_cast<const TT_OS2 *>(FT_Get_Sfnt_Table(face, ft_sfnt_os2))) {
|
||||
if (os2->usWeightClass < 700)
|
||||
embolden = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue