summaryrefslogtreecommitdiff
path: root/amiga/font_diskfont.c
diff options
context:
space:
mode:
Diffstat (limited to 'amiga/font_diskfont.c')
-rw-r--r--amiga/font_diskfont.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/amiga/font_diskfont.c b/amiga/font_diskfont.c
index eadd80054..20b69856b 100644
--- a/amiga/font_diskfont.c
+++ b/amiga/font_diskfont.c
@@ -35,14 +35,19 @@
#include "amiga/gui.h"
#include "amiga/utf8.h"
+#define MAX_FONT_NAME_SIZE 33
+
static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_style_t *fstyle)
{
struct TextFont *bmfont = NULL;
struct TextAttr tattr;
- char *fontname, *font;
+ char *fontname;
+ char font[MAX_FONT_NAME_SIZE];
if(rp == NULL) return NULL;
+ tattr.ta_Flags = 0;
+
switch(fstyle->family)
{
case PLOT_FONT_FAMILY_SANS_SERIF:
@@ -76,14 +81,12 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st
if (fstyle->weight >= 700)
tattr.ta_Style |= FSF_BOLD;
- if((font = ASPrintf("%s.font", fontname))) {
- tattr.ta_Name = font;
- tattr.ta_YSize = fstyle->size / FONT_SIZE_SCALE;
- LOG("font: %s/%d", tattr.ta_Name, tattr.ta_YSize);
- if((bmfont = OpenDiskFont(&tattr))) {
- SetRPAttrs(rp, RPTAG_Font, bmfont, TAG_DONE);
- }
- FreeVec(font);
+ snprintf(font, MAX_FONT_NAME_SIZE, "%s.font", fontname);
+ tattr.ta_Name = font;
+ tattr.ta_YSize = fstyle->size / FONT_SIZE_SCALE;
+ LOG("font: %s/%d", tattr.ta_Name, tattr.ta_YSize);
+ if((bmfont = OpenDiskFont(&tattr))) {
+ SetRPAttrs(rp, RPTAG_Font, bmfont, TAG_DONE);
}
return bmfont;