LyX: add a patch to Qt4 variant for broken QRawFont

This commit is contained in:
Sergey Fedorov
2024-08-30 20:26:12 +08:00
committed by Renee Otten
parent 4b30aef08b
commit a383ceb016
2 changed files with 26 additions and 0 deletions
+7
View File
@@ -93,6 +93,12 @@ variant qt4 conflicts qt5 description {Use Qt4} {
--with-version-suffix=-${branch} \
--with-qt-dir=${prefix}/libexec/qt4 \
--disable-qt5
# QRawFont is supposed to work, but does not:
# GuiFontMetrics.cpp:127:9: error: 'QRawFont' was not declared in this scope; did you mean 'QFont'?
# Anyway, it seems to have issues in Qt4:
# https://stackoverflow.com/questions/12597595/qrawfontfromfont-not-working-correctly
patchfiles-append patch-GuiFontMetrics.cpp.diff
}
variant qt5 conflicts qt4 description {Use Qt5} {
@@ -117,6 +123,7 @@ variant qt5 conflicts qt4 description {Use Qt5} {
# error: '-fobjc-exceptions' is required to enable Objective-C exception syntax
if {[string match *gcc* ${configure.compiler}]} {
# This must be set in pre-configure:
pre-configure {
configure.objcflags-append \
-fobjc-exceptions
@@ -0,0 +1,19 @@
--- src/frontends/qt4/GuiFontMetrics.cpp
+++ src/frontends/qt4/GuiFontMetrics.cpp 2024-08-30 20:05:29.000000000 +0800
@@ -122,6 +122,8 @@
breakat_cache_(cache_metrics_breakat_size),
qtextlayout_cache_(cache_metrics_qtextlayout_size)
{
+// For w/e reason QRawFont is not recognized, despite its header being included.
+#ifndef __APPLE__
// Determine italic slope
double const defaultSlope = tan(qDegreesToRadians(19.0));
QRawFont raw = QRawFont::fromFont(font);
@@ -137,6 +139,7 @@
slope_ = -tan(qDegreesToRadians(angle));
LYXERR(Debug::FONT, "Italic slope: " << slope_);
}
+#endif
}