+ /*
+ * Initialization succeeded.
+ */
+ // Delete all the old fonts first.
+ DeleteFonts(GuiData);
+ GuiData->Font[FONT_NORMAL] = NewFont;
+
+ /*
+ * Now build the other fonts (bold, underlined, mixed).
+ */
+ GuiData->Font[FONT_BOLD] =
+ CreateDerivedFont(GuiData->Font[FONT_NORMAL],
+ FontWeight < FW_BOLD ? FW_BOLD : FontWeight,
+ FALSE,
+ FALSE);
+ GuiData->Font[FONT_UNDERLINE] =
+ CreateDerivedFont(GuiData->Font[FONT_NORMAL],
+ FontWeight,
+ TRUE,
+ FALSE);
+ GuiData->Font[FONT_BOLD | FONT_UNDERLINE] =
+ CreateDerivedFont(GuiData->Font[FONT_NORMAL],
+ FontWeight < FW_BOLD ? FW_BOLD : FontWeight,
+ TRUE,
+ FALSE);
+
+ /*
+ * Save the settings.
+ */
+ if (FaceName != GuiData->GuiInfo.FaceName)
+ {
+ SIZE_T Length = min(wcslen(FaceName) + 1, LF_FACESIZE); // wcsnlen
+ wcsncpy(GuiData->GuiInfo.FaceName, FaceName, LF_FACESIZE);
+ GuiData->GuiInfo.FaceName[Length] = L'\0'; // NULL-terminate
+ }
+ GuiData->GuiInfo.FontFamily = FontFamily;
+ GuiData->GuiInfo.FontSize = FontSize;
+ GuiData->GuiInfo.FontWeight = FontWeight;
+
+ return TRUE;
+}
+
+
+static BOOL
+OnNcCreate(HWND hWnd, LPCREATESTRUCTW Create)
+{
+ PGUI_CONSOLE_DATA GuiData = (PGUI_CONSOLE_DATA)Create->lpCreateParams;
+ PCONSRV_CONSOLE Console;
+
+ if (NULL == GuiData)
+ {
+ DPRINT1("GuiConsoleNcCreate: No GUI data\n");
+ return FALSE;
+ }
+
+ Console = GuiData->Console;
+
+ GuiData->hWindow = hWnd;
+
+ /* Initialize the fonts */
+ if (!InitFonts(GuiData,
+ GuiData->GuiInfo.FaceName,
+ GuiData->GuiInfo.FontFamily,
+ GuiData->GuiInfo.FontSize,
+ GuiData->GuiInfo.FontWeight))
+ {
+ DPRINT1("GuiConsoleNcCreate: InitFonts failed\n");
+ GuiData->hWindow = NULL;
+ SetEvent(GuiData->hGuiInitEvent);
+ return FALSE;
+ }
+