diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2016-01-20 23:32:34 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2016-01-20 23:32:34 +0000 |
commit | 239f999936663c9832bc7569133e694c1ce72741 (patch) | |
tree | 87dba34352fd8a6f8924ea3bfddd67999c3e44c3 /amiga/font_diskfont.c | |
parent | 1724e2835028daf90de80b151ab8fd4c3064fd02 (diff) | |
parent | 750677795ba1ca41627edd68a4de24e0d6c07a20 (diff) | |
download | netsurf-239f999936663c9832bc7569133e694c1ce72741.tar.gz netsurf-239f999936663c9832bc7569133e694c1ce72741.tar.bz2 |
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
Diffstat (limited to 'amiga/font_diskfont.c')
-rw-r--r-- | amiga/font_diskfont.c | 21 |
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; |