mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 08:53:06 +08:00
Add support for private fonts to wxQt
Use QFontDatabase::addApplicationFont() to implement AddPrivateFont(). Closes #26403. Closes #26419.
This commit is contained in:
@@ -470,7 +470,7 @@ wx_option(wxUSE_DRAGIMAGE "use wxDragImage")
|
||||
wx_option(wxUSE_UIACTIONSIMULATOR "use wxUIActionSimulator (experimental)")
|
||||
wx_option(wxUSE_DC_TRANSFORM_MATRIX "use wxDC::SetTransformMatrix and related")
|
||||
wx_option(wxUSE_WEBVIEW_WEBKIT "use wxWebView WebKit backend")
|
||||
if(WIN32 OR APPLE)
|
||||
if(WIN32 OR APPLE OR WXQT)
|
||||
set(wxUSE_PRIVATE_FONTS_DEFAULT ON)
|
||||
else()
|
||||
set(wxUSE_PRIVATE_FONTS_DEFAULT OFF)
|
||||
|
||||
@@ -39708,7 +39708,7 @@ $as_echo "yes" >&6; }
|
||||
|
||||
fi
|
||||
fi
|
||||
elif test "$wxUSE_MAC" = 1 -o "$wxUSE_MSW" = 1; then
|
||||
elif test "$wxUSE_QT" = 1 -o "$wxUSE_MAC" = 1 -o "$wxUSE_MSW" = 1; then
|
||||
$as_echo "#define wxUSE_PRIVATE_FONTS 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
+1
-1
@@ -6800,7 +6800,7 @@ if test "$wxUSE_PRIVATE_FONTS" = "yes"; then
|
||||
],
|
||||
[AC_MSG_WARN([run-time font loading won't be supported by wxFont])])
|
||||
fi
|
||||
elif test "$wxUSE_MAC" = 1 -o "$wxUSE_MSW" = 1; then
|
||||
elif test "$wxUSE_QT" = 1 -o "$wxUSE_MAC" = 1 -o "$wxUSE_MSW" = 1; then
|
||||
dnl In these ports we don't need anything special.
|
||||
AC_DEFINE(wxUSE_PRIVATE_FONTS)
|
||||
fi
|
||||
|
||||
@@ -2300,7 +2300,7 @@
|
||||
#endif /* wxUSE_PREFERENCES_EDITOR */
|
||||
|
||||
#if wxUSE_PRIVATE_FONTS
|
||||
# if !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXOSX__)
|
||||
# if !defined(__WXMSW__) && !defined(__WXGTK__) && !defined(__WXQT__) && !defined(__WXOSX__)
|
||||
# undef wxUSE_PRIVATE_FONTS
|
||||
# define wxUSE_PRIVATE_FONTS 0
|
||||
# endif
|
||||
|
||||
@@ -623,3 +623,30 @@ wxString wxNativeFontInfo::ToUserString() const
|
||||
{
|
||||
return ToString();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Support for adding private fonts
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_PRIVATE_FONTS
|
||||
|
||||
#include "wx/fontenum.h"
|
||||
|
||||
#include <QtGui/QFontDatabase>
|
||||
|
||||
bool wxFontBase::AddPrivateFont(const wxString& strFilename)
|
||||
{
|
||||
const int iFontID =
|
||||
QFontDatabase::addApplicationFont( wxQtConvertString(strFilename) );
|
||||
if ( iFontID == -1 )
|
||||
return false;
|
||||
|
||||
// Ensure that the face names defined by private fonts are recognized by
|
||||
// our SetFaceName() which uses wxFontEnumerator to check if the name is in
|
||||
// the list of available faces.
|
||||
wxFontEnumerator::InvalidateCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // wxUSE_PRIVATE_FONTS
|
||||
|
||||
Reference in New Issue
Block a user