From d9bb1ef4867e63172e7238f48601c6cacecd190b Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Sat, 15 Jan 2005 22:12:05 +0000 Subject: [PATCH] Implemented _font_control() git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10767 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Font.cpp | 43 ++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/Font.cpp b/src/kits/interface/Font.cpp index 1dced12de8..266250ffc1 100644 --- a/src/kits/interface/Font.cpp +++ b/src/kits/interface/Font.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include //---------------------------------------------------------------------------------------- // Globals @@ -43,12 +45,51 @@ const BFont *be_fixed_font = &sFixedFont; /*! - \brief Private function used by Be. Exists only for compatibility. Does nothing. + \brief Private function originally used by Be. Now used for initialization + \param font The font to initialize + \param cmd message code to send to the app_server + \param data unused + + While it is not known what Be used it for, Haiku uses it to initialize the + three system fonts when the interface kit is initialized when an app starts. */ void _font_control_(BFont *font, int32 cmd, void *data) { + if(!font || (cmd!=AS_SET_SYSFONT_PLAIN && cmd!=AS_SET_SYSFONT_BOLD && + cmd!=AS_SET_SYSFONT_FIXED) ) + { + // this shouldn't ever happen, but just in case.... + printf("DEBUG: Bad parameters in _font_control_()\n"); + return; + } + + int32 code; + BPrivate::BAppServerLink link; + + link.StartMessage(cmd); + link.Flush(); + link.GetNextReply(&code); + + if(code!=SERVER_TRUE) + { + // Once again, this shouldn't ever happen, but I want to know about it + // if it does + printf("DEBUG: Couldn't initialize font in _font_control()\n"); + return; + } + + // there really isn't that much data that we need to set for such cases -- most + // of them need to be set to the defaults. The stuff that can change are family, + // style/face, size, and height. + link.Read(&font->fFamilyID); + link.Read(&font->fStyleID); + link.Read(&font->fSize); + link.Read(&font->fFace); + + // we may or may not need this ultimately + link.Read(&font->fHeight); }