Fix bug #1994 and apply patch #1998 - Change Mac OS X to use DejaVu Sans like in Windows/Linux, which fixes problems with text alignment. refs #1994, closes #1998

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11230 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2010-07-18 22:22:22 +00:00 committed by Git SVN Gateway
parent aa0fcecc52
commit 2dcb53d326
5 changed files with 67 additions and 15 deletions

View File

@ -34,6 +34,8 @@
#include "lib/ivis_common/bitimage.h" #include "lib/ivis_common/bitimage.h"
#ifdef WZ_OS_MAC #ifdef WZ_OS_MAC
# include <CoreFoundation/CoreFoundation.h>
# include <CoreFoundation/CFURL.h>
# include <QuesoGLC/glc.h> # include <QuesoGLC/glc.h>
#else #else
# include <GL/glc.h> # include <GL/glc.h>
@ -131,6 +133,22 @@ static void iV_initializeGLC(void)
glcRenderStyle(GLC_TEXTURE); glcRenderStyle(GLC_TEXTURE);
glcStringType(GLC_UTF8_QSO); // Set GLC's string type to UTF-8 FIXME should be UCS4 to avoid conversions glcStringType(GLC_UTF8_QSO); // Set GLC's string type to UTF-8 FIXME should be UCS4 to avoid conversions
#ifdef WZ_OS_MAC
{
char resourcePath[PATH_MAX];
CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
if (CFURLGetFileSystemRepresentation(resourceURL, true, (UInt8 *) resourcePath, PATH_MAX))
{
sstrcat(resourcePath, "/Fonts");
glcAppendCatalog(resourcePath);
}
else
{
debug(LOG_ERROR, "Could not change to resources directory.");
}
}
#endif
_glcFont_Regular = glcGenFontID(); _glcFont_Regular = glcGenFontID();
_glcFont_Bold = glcGenFontID(); _glcFont_Bold = glcGenFontID();

View File

@ -26,6 +26,8 @@
<true/> <true/>
<key>CFBundleAllowMixedLocalizations</key> <key>CFBundleAllowMixedLocalizations</key>
<true/> <true/>
<key>ATSApplicationFontsPath</key>
<string>Fonts/</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>SVN_REV</string> <string>SVN_REV</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>

View File

@ -35,6 +35,7 @@
buildConfigurationList = 43FA570F10FF8EBB0074E914 /* Build configuration list for PBXAggregateTarget "Setup Prebuilt Components" */; buildConfigurationList = 43FA570F10FF8EBB0074E914 /* Build configuration list for PBXAggregateTarget "Setup Prebuilt Components" */;
buildPhases = ( buildPhases = (
43FA570B10FF8E9B0074E914 /* SDL */, 43FA570B10FF8E9B0074E914 /* SDL */,
43D4865411EE98F300997E08 /* Fonts */,
4345290E1130F84E002AD731 /* msgfmt */, 4345290E1130F84E002AD731 /* msgfmt */,
); );
dependencies = ( dependencies = (
@ -501,6 +502,8 @@
43C3B9BE118BEB63000BBE59 /* residue_44p51.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C3B9BC118BEB63000BBE59 /* residue_44p51.h */; }; 43C3B9BE118BEB63000BBE59 /* residue_44p51.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C3B9BC118BEB63000BBE59 /* residue_44p51.h */; };
43C3B9BF118BEB63000BBE59 /* setup_44p51.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C3B9BD118BEB63000BBE59 /* setup_44p51.h */; }; 43C3B9BF118BEB63000BBE59 /* setup_44p51.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C3B9BD118BEB63000BBE59 /* setup_44p51.h */; };
43C3B9E0118BEC40000BBE59 /* res_books_51.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C3B9B4118BEA9D000BBE59 /* res_books_51.h */; }; 43C3B9E0118BEC40000BBE59 /* res_books_51.h in Headers */ = {isa = PBXBuildFile; fileRef = 43C3B9B4118BEA9D000BBE59 /* res_books_51.h */; };
43D4861711EE6F6F00997E08 /* DejaVuSans-Bold.ttf in Copy Fonts */ = {isa = PBXBuildFile; fileRef = 43D4861511EE6F6F00997E08 /* DejaVuSans-Bold.ttf */; };
43D4861811EE6F6F00997E08 /* DejaVuSans.ttf in Copy Fonts */ = {isa = PBXBuildFile; fileRef = 43D4861611EE6F6F00997E08 /* DejaVuSans.ttf */; };
43E1890411440D8C000870EB /* eval-plural.h in Headers */ = {isa = PBXBuildFile; fileRef = 022B2F850BD55B4F002E64E3 /* eval-plural.h */; }; 43E1890411440D8C000870EB /* eval-plural.h in Headers */ = {isa = PBXBuildFile; fileRef = 022B2F850BD55B4F002E64E3 /* eval-plural.h */; };
43E1890511440D8D000870EB /* gettextP.h in Headers */ = {isa = PBXBuildFile; fileRef = 022B2F860BD55B4F002E64E3 /* gettextP.h */; }; 43E1890511440D8D000870EB /* gettextP.h in Headers */ = {isa = PBXBuildFile; fileRef = 022B2F860BD55B4F002E64E3 /* gettextP.h */; };
43E1890611440D8F000870EB /* gmo.h in Headers */ = {isa = PBXBuildFile; fileRef = 022B2F870BD55B50002E64E3 /* gmo.h */; }; 43E1890611440D8F000870EB /* gmo.h in Headers */ = {isa = PBXBuildFile; fileRef = 022B2F870BD55B50002E64E3 /* gmo.h */; };
@ -812,6 +815,18 @@
name = "Copy frameworks"; name = "Copy frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
43D4861211EE6EEC00997E08 /* Copy Fonts */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = Fonts;
dstSubfolderSpec = 7;
files = (
43D4861711EE6F6F00997E08 /* DejaVuSans-Bold.ttf in Copy Fonts */,
43D4861811EE6F6F00997E08 /* DejaVuSans.ttf in Copy Fonts */,
);
name = "Copy Fonts";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@ -1608,6 +1623,8 @@
43C3B9C0118BEBE0000BBE59 /* barkmel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = barkmel.c; path = external/libvorbis/lib/barkmel.c; sourceTree = "<group>"; }; 43C3B9C0118BEBE0000BBE59 /* barkmel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = barkmel.c; path = external/libvorbis/lib/barkmel.c; sourceTree = "<group>"; };
43C3B9C1118BEBE0000BBE59 /* psytune.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psytune.c; path = external/libvorbis/lib/psytune.c; sourceTree = "<group>"; }; 43C3B9C1118BEBE0000BBE59 /* psytune.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = psytune.c; path = external/libvorbis/lib/psytune.c; sourceTree = "<group>"; };
43C3B9C2118BEBE0000BBE59 /* tone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tone.c; path = external/libvorbis/lib/tone.c; sourceTree = "<group>"; }; 43C3B9C2118BEBE0000BBE59 /* tone.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tone.c; path = external/libvorbis/lib/tone.c; sourceTree = "<group>"; };
43D4861511EE6F6F00997E08 /* DejaVuSans-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSans-Bold.ttf"; path = "external/fonts/DejaVuSans-Bold.ttf"; sourceTree = "<group>"; };
43D4861611EE6F6F00997E08 /* DejaVuSans.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = DejaVuSans.ttf; path = external/fonts/DejaVuSans.ttf; sourceTree = "<group>"; };
43E188F311440CC9000870EB /* tsearch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tsearch.c; path = "external/gettext/gettext-runtime/intl/tsearch.c"; sourceTree = "<group>"; }; 43E188F311440CC9000870EB /* tsearch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tsearch.c; path = "external/gettext/gettext-runtime/intl/tsearch.c"; sourceTree = "<group>"; };
43E188F411440CC9000870EB /* tsearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tsearch.h; path = "external/gettext/gettext-runtime/intl/tsearch.h"; sourceTree = "<group>"; }; 43E188F411440CC9000870EB /* tsearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tsearch.h; path = "external/gettext/gettext-runtime/intl/tsearch.h"; sourceTree = "<group>"; };
43E1897311441009000870EB /* os2compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = os2compat.c; path = "external/gettext/gettext-runtime/intl/os2compat.c"; sourceTree = "<group>"; }; 43E1897311441009000870EB /* os2compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = os2compat.c; path = "external/gettext/gettext-runtime/intl/os2compat.c"; sourceTree = "<group>"; };
@ -1993,6 +2010,7 @@
432BE3FD10D9CF1300A486AB /* vorbis */, 432BE3FD10D9CF1300A486AB /* vorbis */,
0246A05C0BD3C975004D1C70 /* Warzone.icns */, 0246A05C0BD3C975004D1C70 /* Warzone.icns */,
02356D780BD3BB3500E9A019 /* Warzone-Info.plist */, 02356D780BD3BB3500E9A019 /* Warzone-Info.plist */,
43D4861411EE6F4000997E08 /* Fonts */,
43025C2B111FB072006C49B1 /* wzlocal */, 43025C2B111FB072006C49B1 /* wzlocal */,
); );
name = Resources; name = Resources;
@ -3028,6 +3046,15 @@
name = coupled; name = coupled;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
43D4861411EE6F4000997E08 /* Fonts */ = {
isa = PBXGroup;
children = (
43D4861511EE6F6F00997E08 /* DejaVuSans-Bold.ttf */,
43D4861611EE6F6F00997E08 /* DejaVuSans.ttf */,
);
name = Fonts;
sourceTree = "<group>";
};
43F3008010D344B000707B6E /* x86 */ = { 43F3008010D344B000707B6E /* x86 */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -3396,6 +3423,7 @@
buildConfigurationList = 02356D790BD3BB3600E9A019 /* Build configuration list for PBXNativeTarget "Warzone" */; buildConfigurationList = 02356D790BD3BB3600E9A019 /* Build configuration list for PBXNativeTarget "Warzone" */;
buildPhases = ( buildPhases = (
02356D710BD3BB3400E9A019 /* Resources */, 02356D710BD3BB3400E9A019 /* Resources */,
43D4861211EE6EEC00997E08 /* Copy Fonts */,
43025CD1111FB66E006C49B1 /* i18n */, 43025CD1111FB66E006C49B1 /* i18n */,
02356D720BD3BB3400E9A019 /* Sources */, 02356D720BD3BB3400E9A019 /* Sources */,
02356D730BD3BB3400E9A019 /* Frameworks */, 02356D730BD3BB3400E9A019 /* Frameworks */,
@ -4001,6 +4029,20 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "DirectorY=\"gettext-0.17.mpkg_\"\nOutDir=\"gettext-0.17.mpkg\"\nFileName=\"gettext-0.17.mpkg.tar.gz\"\nBuiltDLP=\"http://downloads.sourceforge.net/project/warzone2100/build-tools/mac/gettext-0.17.mpkg.tar.gz\"\nMD5Sum=\"ba7984918fe0b36e2e7c786693e005f2\"\n\n# Checks\nexport PATH=$PATH:/sw/bin:/opt/local/bin\nif type -aP msgfmt; then\n echo \"msgfmt exists, skipping\"\n exit 0\nelif [ -x \"/opt/local/bin/port\" ]; then\n echo \"warning: Please run the following command in the terminal: 'sudo port install gettext'.\" >&2\n open -b com.apple.Terminal\n exit 1\nelif [ -d \"${SRCROOT}/external/${OutDir}\" ]; then\n touch build/notrans.dis\n echo \"warning: Gettext support has been disabled because we could not find a binary.\" >&2\n exit 0\nelif [ ! `sw_vers -productVersion | sed -e 's:^...\\(.\\)..$:\\1:'` -ge \"6\" ]; then\n touch build/notrans.dis\n echo \"warning: Gettext support has been disabled because we could not find a binary.\" >&2\n exit 0\nfi\n\nconfigs/FetchPrebuilt.sh \"${DirectorY}\" \"${OutDir}\" \"${FileName}\" \"${BuiltDLP}\" \"${MD5Sum}\"\nFetchExitStatus=$?\n\n# Install\nif [ ! \"${FetchExitStatus}\" = \"0\" ]; then\n exit \"${FetchExitStatus}\"\nelif [ -d \"${SRCROOT}/external/${OutDir}\" ]; then\n echo \" Please install the gettext package before continuing.\" >&2\n open \"${SRCROOT}/external/${OutDir}\"\n exit 1\nfi"; shellScript = "DirectorY=\"gettext-0.17.mpkg_\"\nOutDir=\"gettext-0.17.mpkg\"\nFileName=\"gettext-0.17.mpkg.tar.gz\"\nBuiltDLP=\"http://downloads.sourceforge.net/project/warzone2100/build-tools/mac/gettext-0.17.mpkg.tar.gz\"\nMD5Sum=\"ba7984918fe0b36e2e7c786693e005f2\"\n\n# Checks\nexport PATH=$PATH:/sw/bin:/opt/local/bin\nif type -aP msgfmt; then\n echo \"msgfmt exists, skipping\"\n exit 0\nelif [ -x \"/opt/local/bin/port\" ]; then\n echo \"warning: Please run the following command in the terminal: 'sudo port install gettext'.\" >&2\n open -b com.apple.Terminal\n exit 1\nelif [ -d \"${SRCROOT}/external/${OutDir}\" ]; then\n touch build/notrans.dis\n echo \"warning: Gettext support has been disabled because we could not find a binary.\" >&2\n exit 0\nelif [ ! `sw_vers -productVersion | sed -e 's:^...\\(.\\)..$:\\1:'` -ge \"6\" ]; then\n touch build/notrans.dis\n echo \"warning: Gettext support has been disabled because we could not find a binary.\" >&2\n exit 0\nfi\n\nconfigs/FetchPrebuilt.sh \"${DirectorY}\" \"${OutDir}\" \"${FileName}\" \"${BuiltDLP}\" \"${MD5Sum}\"\nFetchExitStatus=$?\n\n# Install\nif [ ! \"${FetchExitStatus}\" = \"0\" ]; then\n exit \"${FetchExitStatus}\"\nelif [ -d \"${SRCROOT}/external/${OutDir}\" ]; then\n echo \" Please install the gettext package before continuing.\" >&2\n open \"${SRCROOT}/external/${OutDir}\"\n exit 1\nfi";
}; };
43D4865411EE98F300997E08 /* Fonts */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = Fonts;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "DirectorY=\"fonts_\"\nOutDir=\"fonts\"\nFileName=\"fonts.tar.gz\"\nBuiltDLP=\"http://downloads.sourceforge.net/project/warzone2100/build-tools/mac/fonts.tar.gz\"\nMD5Sum=\"1b8805b36f6f1ba71026d6b5ece1ed52\"\n\nconfigs/FetchPrebuilt.sh \"${DirectorY}\" \"${OutDir}\" \"${FileName}\" \"${BuiltDLP}\" \"${MD5Sum}\"\nexit ${?}\n\n# tar -czf fonts.tar.gz --exclude '.DS_Store' fonts_";
};
43F3011910D3572400707B6E /* ShellScript */ = { 43F3011910D3572400707B6E /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;

View File

@ -277,34 +277,24 @@ BOOL loadConfig(void)
setWarzoneKeyString("masterserver_name", NETgetMasterserverName()); setWarzoneKeyString("masterserver_name", NETgetMasterserverName());
} }
if (getWarzoneKeyString("fontname", sBuf)) if (getWarzoneKeyString("fontname", sBuf) && strcmp(sBuf,"Lucida Grande"))
{ {
iV_font(sBuf, NULL, NULL); iV_font(sBuf, NULL, NULL);
} }
else else
{ {
#ifdef WZ_OS_MAC
iV_font("Lucida Grande", NULL, NULL);
setWarzoneKeyString("fontname", "Lucida Grande");
#else
iV_font("DejaVu Sans", NULL, NULL); iV_font("DejaVu Sans", NULL, NULL);
setWarzoneKeyString("fontname", "DejaVu Sans"); setWarzoneKeyString("fontname", "DejaVu Sans");
#endif
} }
if (getWarzoneKeyString("fontface", sBuf)) if (getWarzoneKeyString("fontface", sBuf) && strcmp(sBuf,"Normal"))
{ {
iV_font(NULL, sBuf, NULL); iV_font(NULL, sBuf, NULL);
} }
else else
{ {
#ifdef WZ_OS_MAC
iV_font(NULL, "Regular", NULL);
setWarzoneKeyString("fontface", "Regular");
#else
iV_font(NULL, "Book", NULL); iV_font(NULL, "Book", NULL);
setWarzoneKeyString("fontface", "Book"); setWarzoneKeyString("fontface", "Book");
#endif
} }
if (getWarzoneKeyString("fontfacebold", sBuf)) if (getWarzoneKeyString("fontfacebold", sBuf))

View File

@ -626,7 +626,7 @@ void intDisplayPowerBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DEC
iV_DrawImage(IntImages,IMAGE_PBAR_TOP,x0,y0); iV_DrawImage(IntImages,IMAGE_PBAR_TOP,x0,y0);
iX = x0 + 3; iX = x0 + 3;
iY = y0 + 9; iY = y0 + 10;
x0 += iV_GetImageWidth(IntImages,IMAGE_PBAR_TOP); x0 += iV_GetImageWidth(IntImages,IMAGE_PBAR_TOP);
@ -2887,7 +2887,7 @@ void intDisplayStatsBar(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DEC
/* draw text value */ /* draw text value */
sprintf(szVal, "%d", BarGraph->iOriginal); sprintf(szVal, "%d", BarGraph->iOriginal);
iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_SetTextColour(WZCOL_TEXT_BRIGHT);
iV_DrawText( szVal, x0, iY+2 ); iV_DrawText( szVal, x0, iY );
//draw the comparison value - only if not zero //draw the comparison value - only if not zero
if (BarGraph->minorSize != 0) if (BarGraph->minorSize != 0)
@ -2944,7 +2944,7 @@ void intDisplayDesignPowerBar(WIDGET *psWidget, UDWORD xOffset,
/* draw text value */ /* draw text value */
sprintf(szVal, "%d", BarGraph->iOriginal); sprintf(szVal, "%d", BarGraph->iOriginal);
iV_SetTextColour(WZCOL_TEXT_BRIGHT); iV_SetTextColour(WZCOL_TEXT_BRIGHT);
iV_DrawText( szVal, x0, iY+2 ); iV_DrawText( szVal, x0, iY );
//draw the comparison value - only if not zero //draw the comparison value - only if not zero
if (BarGraph->minorSize != 0) if (BarGraph->minorSize != 0)