[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haiku-commits
Subject:    [haiku-commits] haiku: hrev56314 - in src/servers/app: . font
From:       Adrien Destugues <pulkomandy () pulkomandy ! tk>
Date:       2022-07-26 7:13:31
Message-ID: 20220726071331.99C154062D () turing ! freelists ! org
[Download RAW message or body]

hrev56314 adds 1 changeset to branch 'master'
old head: f515b1c0f3ffae894605eb1bb534fe65977115cd
new head: 12ae5308f2ecd33e0764518a51912e11aa6d09a8
overview: https://git.haiku-os.org/haiku/log/?qt=range&q=12ae5308f2ec+%5Ef515b1c0f3ff

----------------------------------------------------------------------------

12ae5308f2ec: 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>

                                     [ John Scipione <jscipione@gmail.com> ]

----------------------------------------------------------------------------

Revision:    hrev56314
Commit:      12ae5308f2ecd33e0764518a51912e11aa6d09a8
URL:         https://git.haiku-os.org/haiku/commit/?id=12ae5308f2ec
Author:      John Scipione <jscipione@gmail.com>
Date:        Sun Jul 24 01:53:49 2022 UTC
Committer:   Adrien Destugues <pulkomandy@pulkomandy.tk>
Commit-Date: Tue Jul 26 07:13:27 2022 UTC

----------------------------------------------------------------------------

4 files changed, 34 insertions(+), 26 deletions(-)
src/servers/app/ServerApp.cpp        | 25 ++++++++++++-------------
src/servers/app/ServerConfig.h       | 19 +++++++++++++++----
src/servers/app/font/FontManager.cpp | 15 ++++++---------
src/servers/app/font/FontManager.h   |  1 +

----------------------------------------------------------------------------

diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp
index 874b06d22e..36044e7012 100644
--- a/src/servers/app/ServerApp.cpp
+++ b/src/servers/app/ServerApp.cpp
@@ -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);
diff --git a/src/servers/app/ServerConfig.h b/src/servers/app/ServerConfig.h
index a58b5eda43..dde87dd458 100644
--- a/src/servers/app/ServerConfig.h
+++ b/src/servers/app/ServerConfig.h
@@ -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
diff --git a/src/servers/app/font/FontManager.cpp b/src/servers/app/font/FontManager.cpp
index c9c0128ddd..92c2f476ae 100644
--- a/src/servers/app/font/FontManager.cpp
+++ b/src/servers/app/font/FontManager.cpp
@@ -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));
diff --git a/src/servers/app/font/FontManager.h b/src/servers/app/font/FontManager.h
index a4f9149745..818c86d31d 100644
--- a/src/servers/app/font/FontManager.h
+++ b/src/servers/app/font/FontManager.h
@@ -19,6 +19,7 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
+
 class BEntry;
 class BPath;
 struct node_ref;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic