ULONG SetFont (HWND Owner_window, HPS Presentation_space)
{
  FONTDLG Dialog = {                                                           /* Dialog control struct   */
                    .cbSize        = sizeof (FONTDLG),                         /* Set size of structure   */
                    .fl            = FNTS_CENTER |                             /* Specify centered dlg    */
                                     FNTS_HELPBUTTON,                          /* Include help button     */
                    .hpsScreen     = Presentation_space,                       /* Presentation space      */
                    .hpsPrinter    = 0,                                        /* No printer font         */
                    .pszTitle      = NULL,                                     /* Default title           */
                    .pfnDlgProc    = NULL,                                     /* Use standard dlg proc   */
                    .hmod          = 0,
                    .idDlg         = 0,
                    .pszPreview    = NULL,                                     /* Default preview string  */
                    .pszPtSizeList = NULL,                                     /* Default point sizes     */
                    .flFlags       = 0,                                        /* Default flags           */
                    .pszFamilyname = NULL,                                     /* System default          */
                    .fxPointSize   = MAKEFIXED (12, 0),                        /* 12-point vertical size  */
                    .usWeight      = FWEIGHT_NORMAL,                           /* Weight or thickness     */
                    .usWidth       = FWIDTH_NORMAL,                            /* Character width         */
                    .flType        = 0,                                        /* No additional attribs   */
                    .flStyle       = 0,                                        /* No additional styles    */
                    .flCHSOptions  = 0,                                        /* No additional options   */
                    .clrFore       = CLR_BLACK,                                /* Black characters        */
                    .clrBack       = CLR_WHITE                                 /* White background        */
                   };

  WinFontDlg (Owner_window, &Dialog);                                          /* Invoke font dialog      */

  if (Dialog.lReturn == DID_OK)                                                /* Check result            */
  {
    ULONG Font_id = 1;                                                         /* Local font identifier   */

    GpiCreateLogFont (Presentation_space,                                      /* Create logical font     */
                      NULL,                                                    /* No name                 */
                      Font_id,                                                 /* Local font identifier   */
                      Dialog.fAttrs);                                          /* Returned attributes     */

    GpiSetCharSet (Presentation_space, Font_id);                               /* Set font                */

    CHARBUNDLE Attributes = {                                                  /* Character attributes    */
                             .lColor     = Dialog.clrFore,                     /* Foreground color        */
                             .lBackColor = Dialog.clrBack                      /* Background color        */
                            };

    GpiSetAttrs (Presentation_space,                                           /* Set attributes          */
                 PRIM_CHAR,                                                    /* Character attributes    */
                 CBB_COLOR |                                                   /* Attributes to be set    */
                 CBB_BACK_COLOR,
                 0,                                                            /* Defaults mask           */
                 (PBUNDLE) &Attributes);                                       /* Attribute structure     */
  }

  return Dialog.lReturn;
}
