summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amiga/font.c5
-rw-r--r--amiga/font_bitmap.c20
2 files changed, 23 insertions, 2 deletions
diff --git a/amiga/font.c b/amiga/font.c
index 80e34bd10..5e4c9fc63 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -891,6 +891,11 @@ void ami_font_setdevicedpi(int id)
ULONG ydpi = nsoption_int(screen_ydpi);
ULONG xdpi = nsoption_int(screen_ydpi);
+ if(nsoption_bool(use_diskfont) == true) {
+ LOG(("WARNING: Using diskfont.library for text. Forcing DPI to 72."));
+ nsoption_int(screen_ydpi) = 72;
+ }
+
browser_set_dpi(nsoption_int(screen_ydpi));
if(id && (nsoption_int(monitor_aspect_x) != 0) && (nsoption_int(monitor_aspect_y) != 0))
diff --git a/amiga/font_bitmap.c b/amiga/font_bitmap.c
index d620ea90c..2bf411209 100644
--- a/amiga/font_bitmap.c
+++ b/amiga/font_bitmap.c
@@ -44,7 +44,7 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st
{
struct TextFont *bmfont = NULL;
struct TextAttr tattr;
- char *fontname, font;
+ char *fontname, *font;
if(rp == NULL) return NULL;
@@ -84,7 +84,7 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st
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);
}
@@ -103,7 +103,14 @@ bool amiga_bm_nsfont_width(const plot_font_style_t *fstyle,
const char *string, size_t length,
int *width)
{
+ *width = length;
+
+ if((glob == NULL) || (glob->rp == NULL)) return false;
+
struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
+
+ if(bmfont == NULL) return false;
+
// convert to local charset
*width = TextLength(glob->rp, string, length);
ami_font_bm_close(bmfont);
@@ -130,8 +137,12 @@ bool amiga_bm_nsfont_position_in_string(const plot_font_style_t *fstyle,
struct TextExtent extent;
struct TextFont *bmfont;
+ if((glob == NULL) || (glob->rp == NULL)) return false;
+
bmfont = ami_font_bm_open(glob->rp, fstyle);
+ if(bmfont == NULL) return false;
+
// convert to local charset
*char_offset = TextFit(glob->rp, string, length,
&extent, NULL, 1, x, 32767);
@@ -174,8 +185,13 @@ bool amiga_bm_nsfont_split(const plot_font_style_t *fstyle,
struct TextExtent extent;
ULONG co;
char *charp;
+
+ if((glob == NULL) || (glob->rp == NULL)) return false;
+
struct TextFont *bmfont = ami_font_bm_open(glob->rp, fstyle);
+ if(bmfont == NULL) return false;
+
co = TextFit(glob->rp, string, length,
&extent, NULL, 1, x, 32767);