Merge branch 'private-fonts'

Add support for using application-private fonts.

Closes #13568.

Closes https://github.com/wxWidgets/wxWidgets/pull/591
This commit is contained in:
Vadim Zeitlin
2017-11-24 22:56:29 +01:00
34 changed files with 742 additions and 49 deletions

View File

@@ -664,6 +664,39 @@ public:
const wxNativeFontInfo *GetNativeFontInfo() const;
/**
Specify the name of a file containing a TrueType font to be
made available to the current application.
This method can be used to allow this application to use the font from
the given file even if it is not globally installed on the system.
Under OS X this method actually doesn't do anything other than check
for the existence of the file in the "Fonts" subdirectory of the
application bundle "Resources" directory. You are responsible for
actually making the font file available in this directory and setting
@c ATSApplicationFontsPath to @c Fonts value in your @c Info.plist
file. See also wxStandardPaths::GetResourcesDir().
Under MSW this method must be called before any wxGraphicsContext
objects have been created, otherwise the private font won't be usable
from them.
Under Unix this method requires Pango 1.38 or later and will return @a
false and log an error message explaining the problem if this
requirement is not satisfied either at compile- or run-time.
Currently this method is implemented for all major platforms (subject
to having Pango 1.38 or later when running configure under Unix) and
@c wxUSE_PRIVATE_FONTS is always set to 0 under the other platforms,
making this function unavailable at compile-time.
@return @true if the font was added and can now be used.
@since 3.1.1
*/
static bool AddPrivateFont(const wxString& filename);
/**
Gets the point size.

View File

@@ -73,6 +73,17 @@ public:
*/
static bool IsValidFacename(const wxString& facename);
/**
Invalidate cache used by some of the methods of this class internally.
This method should be called if the list of the fonts available on the
system changes, for whatever reason. In particular, it is called
automatically by wxFont::AddPrivateFont().
@since 3.1.1
*/
static void InvalidateCache();
/**
Called by EnumerateFacenames() for each match.