Add BUNDLE_FONT_RESOURCES and use it in font sample

Allow copying font files to the Fonts subdirectory of the app bundle,
private fonts can only be loaded from there under macOS currently.
This commit is contained in:
Vadim Zeitlin 2017-11-13 15:22:27 +01:00
parent 4f5f4af3b1
commit 5d134711a1
7 changed files with 22 additions and 6 deletions

View File

@ -21,6 +21,7 @@
$(TOP_SRCDIR)src/osx/carbon/wxmac.icns
</set>
<set var="BUNDLE_RESOURCES" overwrite="0"></set>
<set var="BUNDLE_FONT_RESOURCES" overwrite="0"></set>
<define-tag name="wx-mac-app-bundle" rules="exe">
@ -44,6 +45,7 @@
<depends-on-file>$(BUNDLE_PLIST)</depends-on-file>
<depends-on-file>$(BUNDLE_ICON)</depends-on-file>
<depends-on-file>$(BUNDLE_RESOURCES)</depends-on-file>
<depends-on-file>$(BUNDLE_FONT_RESOURCES)</depends-on-file>
<command>
<!-- create the directories: -->
@ -72,6 +74,16 @@
cp -f $(BUNDLE_RESOURCES) $(BUNDLE)/Resources
</command>
</if>
<if cond="BUNDLE_FONT_RESOURCES!=''">
<!--
Special case of font resources, which must be copied into
the Fonts subdirectory used in src/osx/carbon/Info.plist.in file.
-->
<command>
mkdir -p $(BUNDLE)/Resources/Fonts
cp -f $(BUNDLE_FONT_RESOURCES) $(BUNDLE)/Resources/Fonts
</command>
</if>
</modify-target>

View File

@ -149,7 +149,7 @@ font$(EXEEXT): $(FONT_OBJECTS) $(__font___win32rc)
$(CXX) -o $@ $(FONT_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(__font___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@font.app/Contents/PkgInfo: font$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1@font.app/Contents/PkgInfo: font$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns $(srcdir)/wxprivate.ttf
@COND_PLATFORM_MACOSX_1@ mkdir -p font.app/Contents
@COND_PLATFORM_MACOSX_1@ mkdir -p font.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1@ mkdir -p font.app/Contents/Resources
@ -168,10 +168,12 @@ font$(EXEEXT): $(FONT_OBJECTS) $(__font___win32rc)
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns font.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1@ mkdir -p font.app/Contents/Resources/Fonts
@COND_PLATFORM_MACOSX_1@ cp -f $(srcdir)/wxprivate.ttf font.app/Contents/Resources/Fonts
@COND_PLATFORM_MACOSX_1@font_bundle: $(____font_BUNDLE_TGT_REF_DEP)
data:
data:
@mkdir -p .
@for f in wxprivate.ttf; do \
if test ! -f ./$$f -a ! -d ./$$f ; \

View File

@ -1,6 +1,8 @@
<?xml version="1.0" ?>
<makefile>
<set var="BUNDLE_FONT_RESOURCES">$(SRCDIR)/wxprivate.ttf</set>
<include file="../../build/bakefiles/common_samples.bkl"/>
<exe id="font" template="wx_sample" template_append="wx_append">

View File

@ -231,7 +231,7 @@ $(OBJS)\font.exe: $(FONT_OBJECTS) $(OBJS)\font_sample.res
c0w32.obj $(FONT_OBJECTS),$@,, $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG_5)$(__RUNTIME_LIBS_8).lib,, $(OBJS)\font_sample.res
|
data:
data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (wxprivate.ttf) do if not exist $(OBJS)\%f copy .\%f $(OBJS)

View File

@ -220,7 +220,7 @@ clean:
$(OBJS)\font.exe: $(FONT_OBJECTS) $(OBJS)\font_sample_rc.o
$(CXX) -o $@ $(FONT_OBJECTS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lwsock32 -lwininet -loleacc
data:
data:
if not exist $(OBJS) mkdir $(OBJS)
for %%f in (wxprivate.ttf) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)

View File

@ -354,7 +354,7 @@ $(OBJS)\font.exe: $(FONT_OBJECTS) $(OBJS)\font_sample.res
$(FONT_OBJECTS) $(FONT_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib wsock32.lib wininet.lib
<<
data:
data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (wxprivate.ttf) do if not exist $(OBJS)\%f copy .\%f $(OBJS)

View File

@ -194,7 +194,7 @@ data:
data_doc:
@mkdir -p ./doc
@for f in aindex.html down.gif dxxgifs.tex HIER.html icon1.gif icon2.gif index.html logo.gif wx204.htm wx34.htm wxExtHelpController.html wxhelp.map wx.htm; do \
@for f in aindex.html ClassGraph.class ClassGraphPanel.class ClassLayout.class down.gif dxxgifs.tex HIER.html HIERjava.html icon1.gif icon2.gif index.html logo.gif NavigatorButton.class USE_HELP.html wx204.htm wx34.htm wxExtHelpController.html wxhelp.map wx.htm; do \
if test ! -f ./doc/$$f -a ! -d ./doc/$$f ; \
then x=yep ; \
else x=`find $(srcdir)/doc/$$f -newer ./doc/$$f -print` ; \