2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
9 /******************************************************************************
17 FONTNAME/A,FONTSIZE/N/A,SCREEN/S
25 Set the default system/screen Font
29 FONTNAME -- the name of the font
30 FONTSIZE -- the size of the font
31 SCREEN -- if specified set the default screen font otherwise
32 set the default system font.
37 The default system font must be mono spaced (non-proportional)
41 SetDefaultFont ttcourier 12
51 ******************************************************************************/
54 #include <exec/exec.h>
56 #include <graphics/gfxbase.h>
57 #include <graphics/text.h>
58 #include <proto/exec.h>
59 #include <proto/dos.h>
60 #include <proto/graphics.h>
61 #include <proto/intuition.h>
62 #include <proto/diskfont.h>
66 const TEXT version
[] = "$VER: SetDefaultFont 41.1 (1.2.2001)\n";
68 #define ARG_TEMPLATE "FONTNAME/A,FONTSIZE/N/A,SCREEN/S"
78 static struct RDArgs
*myargs
;
79 static IPTR args
[NOOFARGS
];
81 static char *fontname
;
83 static BOOL screenfont
;
85 static void Cleanup(char *msg
)
89 Printf("SetDefaultFont: %s\n",msg
);
98 int GfxBase_version
= 0;
99 int IntuitionBase_version
= 0;
100 int DiskFontBase_version
= 0;
102 static ULONG
GetArguments(void)
104 if (!(myargs
= ReadArgs(ARG_TEMPLATE
, args
, 0)))
106 Fault(IoErr(), 0, s
, 255);
111 fontname
= (char *)args
[ARG_FONTNAME
];
112 fontsize
= *(IPTR
*)args
[ARG_FONTSIZE
];
113 screenfont
= args
[ARG_SCREEN
] ? TRUE
: FALSE
;
118 static ULONG
Action(void)
121 struct TextFont
*font
;
124 if (!strstr(fontname
, ".font")) strcat(s
, ".font");
127 ta
.ta_YSize
= fontsize
;
131 font
= OpenDiskFont(&ta
);
134 Cleanup("Can't open font!");
140 SetDefaultScreenFont(font
);
144 if (font
->tf_Flags
& FPF_PROPORTIONAL
)
147 Cleanup("The font must be mono spaced (non-proportional)!");
152 GfxBase
->DefaultFont
= font
;