App Server: Style fixes related to font updates

Reorder font defines to plain, fallback, bold, fallback, fixed, fallback.

Minor functional changes: No BeOS font fallbacks for Haiku apps.

Use FALLBACK_BOLD_FONT_STYLE instead of DEFAULT.

Change-Id: Id053fd9434e8d34290cf68af89cf58fe7811f786
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5497
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
John Scipione 2022-07-23 21:53:49 -04:00 committed by Adrien Destugues
parent f515b1c0f3
commit 12ae5308f2
4 changed files with 34 additions and 26 deletions

View File

@ -99,6 +99,8 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
fSignature(signature),
fClientTeam(clientTeam),
fWindowListLock("window list"),
fInitialWorkspace(desktop->CurrentWorkspace()),
// TODO: this should probably be retrieved when the app is loaded!
fTemporaryDisplayModeChange(0),
fMapLocker("server app maps"),
fAppCursor(NULL),
@ -107,11 +109,11 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
fIsActive(false),
fMemoryAllocator(new (std::nothrow) ClientMemoryAllocator(this), true)
{
if (fSignature == "")
if (fSignature.IsEmpty())
fSignature = "application/no-signature";
char name[B_OS_NAME_LENGTH];
snprintf(name, sizeof(name), "a<%" B_PRId32 ":%s", clientTeam,
snprintf(name, sizeof(name), "a<%" B_PRId32 ":%s", fClientTeam,
SignatureLeaf());
fMessagePort = create_port(DEFAULT_MONITOR_PORT_SIZE, name);
@ -120,10 +122,10 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
fLink.SetSenderPort(fClientReplyPort);
fLink.SetReceiverPort(fMessagePort);
fLink.SetTargetTeam(clientTeam);
fLink.SetTargetTeam(fClientTeam);
// we let the application own the port, so that we get aware when it's gone
if (set_port_owner(fMessagePort, clientTeam) < B_OK) {
if (set_port_owner(fMessagePort, fClientTeam) < B_OK) {
delete_port(fMessagePort);
fMessagePort = -1;
return;
@ -132,9 +134,6 @@ ServerApp::ServerApp(Desktop* desktop, port_id clientReplyPort,
BMessenger::Private(fHandlerMessenger).SetTo(fClientTeam,
clientLooperPort, clientToken);
fInitialWorkspace = desktop->CurrentWorkspace();
// TODO: this should probably be retrieved when the app is loaded!
// record the current system wide fonts..
desktop->LockSingleWindow();
DesktopSettings settings(desktop);
@ -1620,13 +1619,13 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
char type[B_OS_NAME_LENGTH];
status_t status = link.ReadString(type, sizeof(type));
if (status == B_OK) {
if (!strcmp(type, "plain")) {
if (strcmp(type, "plain") == 0)
font = *gFontManager->DefaultPlainFont();
} else if (!strcmp(type, "bold")) {
else if (strcmp(type, "bold") == 0)
font = *gFontManager->DefaultBoldFont();
} else if (!strcmp(type, "fixed")) {
else if (strcmp(type, "fixed") == 0)
font = *gFontManager->DefaultFixedFont();
} else
else
status = B_BAD_VALUE;
}
@ -1664,8 +1663,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
}
// The client is requesting the system fonts, this
// could happend either at application start up, or
// because the client is resyncing with the global
// could have happened either at application start up,
// or because the client is resyncing with the global
// fonts. So we record the current system wide fonts
// into our own copies at this point.
DesktopSettings settings(fDesktop);

View File

@ -28,18 +28,29 @@
// These definitions provide the server something to use for default
// system fonts.
#define DEFAULT_PLAIN_FONT_FAMILY "Noto Sans Display"
#define FALLBACK_PLAIN_FONT_FAMILY "Swis721 BT"
#define DEFAULT_PLAIN_FONT_STYLE "Book"
#define DEFAULT_PLAIN_FONT_STYLE "Regular"
#define DEFAULT_PLAIN_FONT_SIZE 12.0f
#define FALLBACK_PLAIN_FONT_FAMILY "Noto Sans Thai"
#define FALLBACK_PLAIN_FONT_STYLE "Regular"
#define FALLBACK_PLAIN_FONT_SIZE 12.0f
#define DEFAULT_BOLD_FONT_FAMILY "Noto Sans Display"
#define FALLBACK_BOLD_FONT_FAMILY "Swis721 BT"
#define DEFAULT_BOLD_FONT_STYLE "Bold"
#define DEFAULT_BOLD_FONT_SIZE 12.0f
#define FALLBACK_BOLD_FONT_FAMILY "Noto Sans Thai"
#define FALLBACK_BOLD_FONT_STYLE "Bold"
#define FALLBACK_BOLD_FONT_SIZE 12.0f
#define DEFAULT_FIXED_FONT_FAMILY "Noto Sans Mono"
#define FALLBACK_FIXED_FONT_FAMILY "Courier10 BT"
#define DEFAULT_FIXED_FONT_STYLE "Regular"
#define DEFAULT_FIXED_FONT_SIZE 12.0f
#define FALLBACK_FIXED_FONT_FAMILY "Noto Sans Thai"
#define FALLBACK_FIXED_FONT_STYLE "Regular"
#define FALLBACK_FIXED_FONT_SIZE 12.0f
// This is the port capacity for all monitoring objects - ServerApps
// and ServerWindows
#define DEFAULT_MONITOR_PORT_SIZE 50

View File

@ -106,11 +106,9 @@ FontManager::FontManager()
fDirectories(10, true),
fMappings(10, true),
fFamilies(20),
fDefaultPlainFont(NULL),
fDefaultBoldFont(NULL),
fDefaultFixedFont(NULL),
fScanned(false),
fNextID(0)
{
@ -143,9 +141,8 @@ FontManager::~FontManager()
// free families before we're done with FreeType
for (int32 i = fFamilies.CountItems(); i-- > 0;) {
for (int32 i = fFamilies.CountItems(); i-- > 0;)
delete fFamilies.ItemAt(i);
}
FT_Done_FreeType(gFreeTypeLibrary);
}
@ -467,11 +464,11 @@ FontManager::_GetDefaultStyle(const char *familyName, const char *styleName,
status_t
FontManager::_SetDefaultFonts()
{
FontStyle* style = NULL;
// plain font
FontStyle* style = _GetDefaultStyle(DEFAULT_PLAIN_FONT_FAMILY,
DEFAULT_PLAIN_FONT_STYLE, FALLBACK_PLAIN_FONT_FAMILY,
DEFAULT_PLAIN_FONT_STYLE,
B_REGULAR_FACE);
style = _GetDefaultStyle(DEFAULT_PLAIN_FONT_FAMILY, DEFAULT_PLAIN_FONT_STYLE,
FALLBACK_PLAIN_FONT_FAMILY, FALLBACK_PLAIN_FONT_STYLE, B_REGULAR_FACE);
if (style == NULL)
return B_ERROR;
@ -482,7 +479,7 @@ FontManager::_SetDefaultFonts()
// bold font
style = _GetDefaultStyle(DEFAULT_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE,
FALLBACK_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE, B_BOLD_FACE);
FALLBACK_BOLD_FONT_FAMILY, FALLBACK_BOLD_FONT_STYLE, B_BOLD_FACE);
fDefaultBoldFont.SetTo(new (std::nothrow) ServerFont(*style,
DEFAULT_BOLD_FONT_SIZE));

View File

@ -19,6 +19,7 @@
#include <ft2build.h>
#include FT_FREETYPE_H
class BEntry;
class BPath;
struct node_ref;