From 132be1eed23315c8fbd72acaa06ccdec62363c73 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 16 Jan 2016 19:37:39 +0000 Subject: OS3 build fixes --- amiga/Makefile.target | 2 +- amiga/font.c | 2 +- amiga/font_cache.c | 2 +- amiga/gui.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'amiga') diff --git a/amiga/Makefile.target b/amiga/Makefile.target index 8c850d1db..9172ce0b0 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -7,7 +7,7 @@ CFLAGS += -std=c99 -Dnsamiga ifneq ($(SUBTARGET),os3) CFLAGS += -O2 -finline-functions -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__ else - CFLAGS += -m68020-60 -O0 -DPATH_MAX=1024 -D__m68k__ + CFLAGS += -msoft-float -m68020-60 -O0 -DPATH_MAX=1024 -D__m68k__ endif NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE diff --git a/amiga/font.c b/amiga/font.c index ac5fd129f..b7e31cea8 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -41,7 +41,7 @@ void ami_font_setdevicedpi(int id) if(nsoption_bool(bitmap_fonts) == true) { LOG("WARNING: Using diskfont.library for text. Forcing DPI to 72."); - nsoption_int(screen_ydpi) = 72; + nsoption_set_int(screen_ydpi, 72); } browser_set_dpi(nsoption_int(screen_ydpi)); diff --git a/amiga/font_cache.c b/amiga/font_cache.c index b036f6334..e3f107dd8 100644 --- a/amiga/font_cache.c +++ b/amiga/font_cache.c @@ -171,7 +171,7 @@ void ami_font_cache_insert(struct ami_font_cache_node *nodedata, const char *fon #ifndef __amigaos4__ struct nsObject *node = AddObject(ami_font_cache_list, AMINS_FONT); if(node) { - ObjectCallback(ami_font_bullet_close); + ObjectCallback(node, ami_font_bullet_close); node->objstruct = nodedata; node->dtz_Node.ln_Name = strdup(font); } diff --git a/amiga/gui.c b/amiga/gui.c index 837063639..e0f370f6e 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -562,7 +562,7 @@ static nserror ami_set_options(struct nsoption_s *defaults) nsoption_set_bool(font_antialiasing, false); nsoption_set_bool(truecolour_mouse_pointers, false); nsoption_set_bool(use_openurl_lib, true); - nsoption_set_bool(use_diskfont, true); + nsoption_set_bool(bitmap_fonts, true); #endif if((!nsoption_charp(accept_language)) || -- cgit v1.2.3 From b3aa313e8421a26489719ecb4626cc6837e0079c Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 17 Jan 2016 23:40:50 +0000 Subject: misc amiga fixes re font plotting --- amiga/font.c | 4 ++-- amiga/font.h | 2 -- amiga/font_bullet.c | 6 +++--- amiga/plotters.c | 11 +++++------ 4 files changed, 10 insertions(+), 13 deletions(-) (limited to 'amiga') diff --git a/amiga/font.c b/amiga/font.c index b7e31cea8..27ea62d6e 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -36,14 +36,14 @@ void ami_font_setdevicedpi(int id) { DisplayInfoHandle dih; struct DisplayInfo dinfo; - ULONG ydpi = nsoption_int(screen_ydpi); - ULONG xdpi = nsoption_int(screen_ydpi); if(nsoption_bool(bitmap_fonts) == true) { LOG("WARNING: Using diskfont.library for text. Forcing DPI to 72."); nsoption_set_int(screen_ydpi, 72); } + ULONG ydpi = nsoption_int(screen_ydpi); + ULONG xdpi = nsoption_int(screen_ydpi); 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.h b/amiga/font.h index 416609a8d..e0799ea05 100755 --- a/amiga/font.h +++ b/amiga/font.h @@ -23,8 +23,6 @@ #include #include -struct ami_font_cache_node; - void ami_font_setdevicedpi(int id); void ami_font_init(void); void ami_font_fini(void); diff --git a/amiga/font_bullet.c b/amiga/font_bullet.c index 2800533a0..69757e5a3 100644 --- a/amiga/font_bullet.c +++ b/amiga/font_bullet.c @@ -155,7 +155,7 @@ static inline uint32 amiga_nsfont_decode_surrogate(const uint16 *char1) } } -static inline bool amiga_nsfont_width(const plot_font_style_t *fstyle, +static bool amiga_nsfont_width(const plot_font_style_t *fstyle, const char *string, size_t length, int *width) { @@ -178,7 +178,7 @@ static inline bool amiga_nsfont_width(const plot_font_style_t *fstyle, * \return true on success, false on error and error reported */ -static inline bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, +static bool amiga_nsfont_position_in_string(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { @@ -261,7 +261,7 @@ static inline bool amiga_nsfont_position_in_string(const plot_font_style_t *fsty * Returning char_offset == length means no split possible */ -static inline bool amiga_nsfont_split(const plot_font_style_t *fstyle, +static bool amiga_nsfont_split(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x) { diff --git a/amiga/plotters.c b/amiga/plotters.c index b459dcc7e..d241dd408 100644 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -94,7 +94,7 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) * Height is set to screen width to give enough space for thumbnails * * Also applies to the further gfx/layers functions and memory below */ - ULONG depth = 32; + int depth = 32; struct BitMap *friend = NULL; depth = GetBitMapAttr(scrn->RastPort.BitMap, BMA_DEPTH); @@ -112,6 +112,8 @@ void ami_init_layers(struct gui_globals *gg, ULONG width, ULONG height) if(depth > 8) depth = 8; #endif + if(palette_mapped == true) nsoption_set_bool(font_antialiasing, false); + if(!width) width = nsoption_int(redraw_tile_size_x); if(!height) height = nsoption_int(redraw_tile_size_y); gg->width = width; @@ -429,13 +431,10 @@ static bool ami_text(int x, int y, const char *text, size_t length, LOG("[ami_plotter] Entered ami_text()"); #endif - bool aa = true; - - if((nsoption_bool(font_antialiasing) == false) || (palette_mapped == true)) - aa = false; + if(__builtin_expect(ami_nsfont == NULL, 0)) return false; ami_plot_setapen(glob->rp, fstyle->foreground); - ami_nsfont->text(glob->rp, text, length, fstyle, x, y, aa); + ami_nsfont->text(glob->rp, text, length, fstyle, x, y, nsoption_bool(font_antialiasing)); return true; } -- cgit v1.2.3 From 9c62993efd45bcd685c579d51be013a1ae4f2770 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 18 Jan 2016 00:02:52 +0000 Subject: Don't expose the DPI-related variables --- amiga/font.c | 13 +++++++++++++ amiga/font.h | 9 +++++---- amiga/font_bullet.c | 4 ++-- amiga/gui.c | 6 +++++- 4 files changed, 25 insertions(+), 7 deletions(-) (limited to 'amiga') diff --git a/amiga/font.c b/amiga/font.c index 27ea62d6e..39cb38602 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -32,6 +32,19 @@ #include "amiga/font_diskfont.h" #include "amiga/font_scan.h" +static ULONG ami_devicedpi = 72; +static ULONG ami_xdpi = 72; + +ULONG ami_font_dpi_get_devicedpi(void) +{ + return ami_devicedpi; +} + +ULONG ami_font_dpi_get_xdpi(void) +{ + return ami_xdpi; +} + void ami_font_setdevicedpi(int id) { DisplayInfoHandle dih; diff --git a/amiga/font.h b/amiga/font.h index e0799ea05..da23b5989 100755 --- a/amiga/font.h +++ b/amiga/font.h @@ -23,10 +23,14 @@ #include #include -void ami_font_setdevicedpi(int id); void ami_font_init(void); void ami_font_fini(void); +/* DPI stuff */ +void ami_font_setdevicedpi(int id); +ULONG ami_font_dpi_get_devicedpi(void); +ULONG ami_font_dpi_get_xdpi(void); + /* 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); @@ -50,9 +54,6 @@ struct ami_font_functions { ULONG x, ULONG y, bool aa); }; -ULONG ami_devicedpi; -ULONG ami_xdpi; - const struct ami_font_functions *ami_nsfont; #endif diff --git a/amiga/font_bullet.c b/amiga/font_bullet.c index 69757e5a3..f63455257 100644 --- a/amiga/font_bullet.c +++ b/amiga/font_bullet.c @@ -55,7 +55,7 @@ #define NSA_VALUE_SHEARSIN (1 << 14) #define NSA_VALUE_SHEARCOS (1 << 16) -#define NSA_FONT_EMWIDTH(s) (s / FONT_SIZE_SCALE) * (ami_xdpi / 72.0) +#define NSA_FONT_EMWIDTH(s) (s / FONT_SIZE_SCALE) * (ami_font_dpi_get_xdpi() / 72.0) const uint16 sc_table[] = { 0x0061, 0x1D00, /* a */ @@ -510,7 +510,7 @@ static struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle #endif if(ESetInfo(AMI_OFONT_ENGINE, - OT_DeviceDPI, ami_devicedpi, + OT_DeviceDPI, ami_font_dpi_get_devicedpi(), OT_PointHeight, ysize, OT_EmboldenX, emboldenx, OT_EmboldenY, emboldeny, diff --git a/amiga/gui.c b/amiga/gui.c index e0f370f6e..768b4062a 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -5589,8 +5589,12 @@ int main(int argc, char** argv) #ifdef __amigaos4__ amiga_plugin_hack_init(); -#endif + + /* DataTypes loader needs datatypes.library v45, + * but for some reason that's not in OS3.9. + * Skip it to ensure it isn't causing other problems. */ ret = amiga_datatypes_init(); +#endif /* user options setup */ ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default); -- cgit v1.2.3 From 59ea187b74cb8ec2295c189356321390cea43ab3 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Mon, 18 Jan 2016 00:20:45 +0000 Subject: Ensure the textattr flags field is clear This fixes problems with inconsistent layouting on OS3 --- amiga/font_diskfont.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'amiga') diff --git a/amiga/font_diskfont.c b/amiga/font_diskfont.c index 61f777355..7b8819969 100644 --- a/amiga/font_diskfont.c +++ b/amiga/font_diskfont.c @@ -43,6 +43,8 @@ static struct TextFont *ami_font_bm_open(struct RastPort *rp, const plot_font_st if(rp == NULL) return NULL; + tattr.ta_Flags = 0; + switch(fstyle->family) { case PLOT_FONT_FAMILY_SANS_SERIF: -- cgit v1.2.3 From 750677795ba1ca41627edd68a4de24e0d6c07a20 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Wed, 20 Jan 2016 22:51:05 +0000 Subject: Alloc font name on the stack --- amiga/font_diskfont.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'amiga') diff --git a/amiga/font_diskfont.c b/amiga/font_diskfont.c index 7b8819969..bd1e1f9d0 100644 --- a/amiga/font_diskfont.c +++ b/amiga/font_diskfont.c @@ -35,11 +35,14 @@ #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; @@ -78,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; -- cgit v1.2.3