From 6697162d5c7466857d59e6766c8075fe116ca3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 12 Apr 2005 13:15:38 +0000 Subject: [PATCH] just a slightly more robust default font handling... should now work on Haiku even if you didn't install fonts from BeOS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12347 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/servers/app/ServerConfig.h | 22 ++++++----- src/servers/app/AppServer.cpp | 45 +++++++++++++++++----- 2 files changed, 48 insertions(+), 19 deletions(-) diff --git a/headers/private/servers/app/ServerConfig.h b/headers/private/servers/app/ServerConfig.h index 2047e96f49..4095690dc6 100644 --- a/headers/private/servers/app/ServerConfig.h +++ b/headers/private/servers/app/ServerConfig.h @@ -91,16 +91,18 @@ // These definitions provide the server something to use for default // system fonts. -#define DEFAULT_PLAIN_FONT_FAMILY "Swis721 BT" -#define DEFAULT_PLAIN_FONT_STYLE "Roman" -#define DEFAULT_PLAIN_FONT_SIZE 12 -#define DEFAULT_BOLD_FONT_FAMILY "Swis721 BT" -#define DEFAULT_BOLD_FONT_STYLE "Bold" -#define DEFAULT_BOLD_FONT_SIZE 12 -#define DEFAULT_FIXED_FONT_FAMILY "Courier10 BT" -#define DEFAULT_FIXED_FONT_STYLE "Roman" -#define DEFAULT_FIXED_FONT_SIZE 12 - +# define DEFAULT_PLAIN_FONT_FAMILY "Bitstream Vera Sans" +# define FALLBACK_PLAIN_FONT_FAMILY "Swis721 BT" +# define DEFAULT_PLAIN_FONT_STYLE "Roman" +# define DEFAULT_PLAIN_FONT_SIZE 12 +# define DEFAULT_BOLD_FONT_FAMILY "Bitstream Vera Sans" +# define FALLBACK_BOLD_FONT_FAMILY "Swis721 BT" +# define DEFAULT_BOLD_FONT_STYLE "Bold" +# define DEFAULT_BOLD_FONT_SIZE 12 +# define DEFAULT_FIXED_FONT_FAMILY "Bitstream Vera Sans Mono" +# define FALLBACK_FIXED_FONT_FAMILY "Courier10 BT" +# define DEFAULT_FIXED_FONT_STYLE "Roman" +# define DEFAULT_FIXED_FONT_SIZE 12 // This is the port capacity for all monitoring objects - ServerApps // and ServerWindows #define DEFAULT_MONITOR_PORT_SIZE 30 diff --git a/src/servers/app/AppServer.cpp b/src/servers/app/AppServer.cpp index 7dd42339c1..e56633c8aa 100644 --- a/src/servers/app/AppServer.cpp +++ b/src/servers/app/AppServer.cpp @@ -113,15 +113,42 @@ AppServer::AppServer(void) // fontserver->ScanDirectory("/boot/home/config/fonts/psfonts/"); fontserver->SaveList(); - if(!fontserver->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY,DEFAULT_PLAIN_FONT_STYLE,DEFAULT_PLAIN_FONT_SIZE)) - printf("Couldn't set plain to %s, %s %d pt\n",DEFAULT_PLAIN_FONT_FAMILY, - DEFAULT_PLAIN_FONT_STYLE,DEFAULT_PLAIN_FONT_SIZE); - if(!fontserver->SetSystemBold(DEFAULT_BOLD_FONT_FAMILY,DEFAULT_BOLD_FONT_STYLE,DEFAULT_BOLD_FONT_SIZE)) - printf("Couldn't set bold to %s, %s %d pt\n",DEFAULT_BOLD_FONT_FAMILY, - DEFAULT_BOLD_FONT_STYLE,DEFAULT_BOLD_FONT_SIZE); - if(!fontserver->SetSystemFixed(DEFAULT_FIXED_FONT_FAMILY,DEFAULT_FIXED_FONT_STYLE,DEFAULT_FIXED_FONT_SIZE)) - printf("Couldn't set fixed to %s, %s %d pt\n",DEFAULT_FIXED_FONT_FAMILY, - DEFAULT_FIXED_FONT_STYLE,DEFAULT_FIXED_FONT_SIZE); + if(!fontserver->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY, + DEFAULT_PLAIN_FONT_STYLE, + DEFAULT_PLAIN_FONT_SIZE) || + !fontserver->SetSystemPlain(FALLBACK_PLAIN_FONT_FAMILY, + DEFAULT_PLAIN_FONT_STYLE, + DEFAULT_PLAIN_FONT_SIZE)) { + printf("Couldn't set plain to %s, %s %d pt\n", + DEFAULT_PLAIN_FONT_FAMILY, + DEFAULT_PLAIN_FONT_STYLE, + DEFAULT_PLAIN_FONT_SIZE); + } + + if(!fontserver->SetSystemBold(DEFAULT_BOLD_FONT_FAMILY, + DEFAULT_BOLD_FONT_STYLE, + DEFAULT_BOLD_FONT_SIZE) || + !fontserver->SetSystemBold(FALLBACK_BOLD_FONT_FAMILY, + DEFAULT_BOLD_FONT_STYLE, + DEFAULT_BOLD_FONT_SIZE)) { + printf("Couldn't set bold to %s, %s %d pt\n", + DEFAULT_BOLD_FONT_FAMILY, + DEFAULT_BOLD_FONT_STYLE, + DEFAULT_BOLD_FONT_SIZE); + } + + if(!fontserver->SetSystemFixed(DEFAULT_FIXED_FONT_FAMILY, + DEFAULT_FIXED_FONT_STYLE, + DEFAULT_FIXED_FONT_SIZE) || + !fontserver->SetSystemFixed(FALLBACK_FIXED_FONT_FAMILY, + DEFAULT_FIXED_FONT_STYLE, + DEFAULT_FIXED_FONT_SIZE)) { + printf("Couldn't set fixed to %s, %s %d pt\n", + DEFAULT_FIXED_FONT_FAMILY, + DEFAULT_FIXED_FONT_STYLE, + DEFAULT_FIXED_FONT_SIZE); + } + fontserver->Unlock();