Select fonts, sizes and colours for splash screen text rather than relying on system

default

svn path=/trunk/netsurf/; revision=12776
This commit is contained in:
Chris Young 2011-09-07 23:01:53 +00:00
parent ef56ab5d80
commit 8e67ad8051
3 changed files with 43 additions and 3 deletions

View File

@ -691,3 +691,16 @@ void ami_font_setdevicedpi(int id)
ami_xdpi = xdpi;
ami_devicedpi = (xdpi << 16) | ydpi;
}
/* The below are simple font routines which should not be used for page rendering */
struct TextFont *ami_font_open_disk_font(struct TextAttr *tattr)
{
struct TextFont *tfont = OpenDiskFont(tattr);
return tfont;
}
void ami_font_close_disk_font(struct TextFont *tfont)
{
CloseFont(tfont);
}

View File

@ -21,6 +21,7 @@
#include "desktop/plotters.h"
#include <graphics/rastport.h>
#include <graphics/text.h>
struct ami_font_node;
@ -30,4 +31,8 @@ void ami_font_setdevicedpi(int id);
void ami_init_fonts(void);
void ami_close_fonts(void);
void ami_font_close(struct ami_font_node *node);
/* Simple diskfont functions for graphics.library use (not page rendering) */
struct TextFont *ami_font_open_disk_font(struct TextAttr *tattr);
void ami_font_close_disk_font(struct TextFont *tfont);
#endif

View File

@ -3935,6 +3935,8 @@ Object *ami_gui_splash_open(void)
struct Screen *wbscreen = LockPubScreen("Workbench");
uint32 top = 0, left = 0;
STRPTR ver_string;
struct TextAttr tattr;
struct TextFont *tfont;
win_obj = WindowObject,
WA_Borderless, TRUE,
@ -3957,11 +3959,30 @@ Object *ami_gui_splash_open(void)
IA_Left, &left,
TAG_DONE);
SetDrMd(win->RPort, LEVELS);
SetRPAttrs(win->RPort, RPTAG_APenColor, 0x003F6DFE, TAG_DONE);
SetDrMd(win->RPort, JAM1);
Move(win->RPort, left + 5, top + 20);
tattr.ta_Name = "DejaVu Serif Oblique.font";
tattr.ta_YSize = 24;
tattr.ta_Style = 0;
tattr.ta_Flags = 0;
if(tfont = ami_font_open_disk_font(&tattr))
SetFont(win->RPort, tfont);
Move(win->RPort, left + 5, top + 25);
Text(win->RPort, "Initialising...", strlen("Initialising..."));
if(tfont) ami_font_close_disk_font(tfont);
tattr.ta_Name = "DejaVu Sans.font";
tattr.ta_YSize = 16;
tattr.ta_Style = 0;
tattr.ta_Flags = 0;
if(tfont = ami_font_open_disk_font(&tattr))
SetFont(win->RPort, tfont);
#ifdef NDEBUG
ver_string = ASPrintf("NetSurf %s", netsurf_version);
#else
@ -3971,7 +3992,8 @@ Object *ami_gui_splash_open(void)
Move(win->RPort, left + 185, top + 220);
Text(win->RPort, ver_string, strlen(ver_string));
FreeVec(ver_string);
if(ver_string) FreeVec(ver_string);
if(tfont) ami_font_close_disk_font(tfont);
UnlockPubScreen(NULL, wbscreen);