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 | |
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')
-rw-r--r-- | amiga/Makefile.target | 2 | ||||
-rw-r--r-- | amiga/font.c | 19 | ||||
-rwxr-xr-x | amiga/font.h | 11 | ||||
-rw-r--r-- | amiga/font_bullet.c | 10 | ||||
-rw-r--r-- | amiga/font_cache.c | 2 | ||||
-rw-r--r-- | amiga/font_diskfont.c | 21 | ||||
-rw-r--r-- | amiga/gui.c | 8 | ||||
-rw-r--r-- | amiga/plotters.c | 11 |
8 files changed, 51 insertions, 33 deletions
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..39cb38602 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -32,18 +32,31 @@ #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; 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_int(screen_ydpi) = 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..da23b5989 100755 --- a/amiga/font.h +++ b/amiga/font.h @@ -23,12 +23,14 @@ #include <graphics/rastport.h> #include <graphics/text.h> -struct ami_font_cache_node; - -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); @@ -52,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 2800533a0..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 */ @@ -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) { @@ -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/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/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; diff --git a/amiga/gui.c b/amiga/gui.c index 4e68530dd..3dc575cf0 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)) || @@ -5594,8 +5594,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); 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; } |