diff options
author | Richard Wilson <rjw@netsurf-browser.org> | 2004-11-03 02:29:01 +0000 |
---|---|---|
committer | Richard Wilson <rjw@netsurf-browser.org> | 2004-11-03 02:29:01 +0000 |
commit | 3276fe3ed8ee18580d4519164be1e35f44b859ce (patch) | |
tree | a874c2571962ce768838ba2ec1c8856f54f25ee4 /riscos | |
parent | ce0fc3daf7f7548b412bce606e5ed9284e993ac5 (diff) | |
download | netsurf-3276fe3ed8ee18580d4519164be1e35f44b859ce.tar.gz netsurf-3276fe3ed8ee18580d4519164be1e35f44b859ce.tar.bz2 |
[project @ 2004-11-03 02:29:01 by rjw]
Changing screenmodes causes font handles to be refound.
svn path=/import/netsurf/; revision=1338
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/font.c | 79 | ||||
-rw-r--r-- | riscos/gui.c | 12 | ||||
-rw-r--r-- | riscos/gui.h | 1 | ||||
-rw-r--r-- | riscos/history.c | 11 | ||||
-rw-r--r-- | riscos/thumbnail.c | 7 |
5 files changed, 102 insertions, 8 deletions
diff --git a/riscos/font.c b/riscos/font.c index 5ebfa0054..92b1f5523 100644 --- a/riscos/font.c +++ b/riscos/font.c @@ -1,7 +1,7 @@ /* * This file is part of NetSurf, http://netsurf.sourceforge.net/ * Licensed under the GNU General Public License, - * http://www.opensource.org/licenses/gpl-license + * http://www.opensource.org/licenses/gpl-license * Copyright 2004 James Bursa <bursa@users.sourceforge.net> * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net> * Copyright 2004 John Tytgat <John.Tytgat@aaug.net> @@ -30,7 +30,7 @@ #define FONT_MAX_NAME 128 /* max length of a font name */ #define FONT_FAMILIES 6 /* Number of families */ -#define FONT_FACES 4 /* Number of faces per family */ +#define FONT_FACES 4 /* Number of faces per family */ /* Font Variants */ #define FONT_SMALLCAPS 4 @@ -40,12 +40,12 @@ #define FONT_SLANTED 1 /* Font families */ -#define FONT_DEFAULT (0 * FONT_FACES) +#define FONT_DEFAULT (0 * FONT_FACES) #define FONT_SANS_SERIF (1 * FONT_FACES) -#define FONT_SERIF (2 * FONT_FACES) +#define FONT_SERIF (2 * FONT_FACES) #define FONT_MONOSPACE (3 * FONT_FACES) -#define FONT_CURSIVE (4 * FONT_FACES) -#define FONT_FANTASY (5 * FONT_FACES) +#define FONT_CURSIVE (4 * FONT_FACES) +#define FONT_FANTASY (5 * FONT_FACES) /* a font_set is just a linked list of font_data for each face for now */ struct font_set { @@ -1180,3 +1180,70 @@ char *nsfont_create_font_name(char *base, int id) free(created); return NULL; } + + +/** + * Reopens all font handles to the current screen resolution + */ +void nsfont_reopen_set(struct font_set *fonts) { + os_error *error; + char fontName1[FONT_MAX_NAME+10]; + char fontName2[FONT_MAX_NAME+10]; + struct font_data *f; + bool using_fb; + + for (int i = 0; i < (FONT_FAMILIES * FONT_FACES); i++) { + for (f = fonts->font[i]; f; f = f->next) { + switch (f->ftype) { + case FONTTYPE_UFONT: + error = xufont_lose_font((ufont_f)f->handle); + if (error) { + LOG(("xufont_lose_font: 0x%x: %s", + error->errnum, error->errmess)); + } + error = nsfont_open_ufont(fontName1, fontName2, (int)f->size, + &f->handle, &using_fb, true); + if (error) { + LOG(("nsfont_open_standard: 0x%x: %s", + error->errnum, error->errmess)); + } + break; + case FONTTYPE_STANDARD_LATIN1: + error = xfont_lose_font((font_f)f->handle); + if (error) { + LOG(("xfont_lose_font: 0x%x: %s", + error->errnum, error->errmess)); + } + strcpy(fontName1, font_table[f->id]); + strcat(fontName1, "\\ELatin1"); + strcpy(fontName2, font_table[f->id % 4]); + strcat(fontName2, "\\ELatin1"); + error = nsfont_open_standard(fontName1, fontName2, (int)f->size, + &f->handle, &using_fb, true); + if (error) { + LOG(("nsfont_open_standard: 0x%x: %s", + error->errnum, error->errmess)); + } + break; + case FONTTYPE_STANDARD_UTF8ENC: + error = xfont_lose_font((font_f)f->handle); + if (error) { + LOG(("xfont_lose_font: 0x%x: %s", + error->errnum, error->errmess)); + } + strcpy(fontName1, font_table[f->id]); + strcat(fontName1, "\\EUTF8"); + strcpy(fontName2, font_table[f->id % 4]); + strcat(fontName2, "\\EUTF8"); + error = nsfont_open_standard(fontName1, fontName2, (int)f->size, + &f->handle, &using_fb, true); + if (error) { + LOG(("nsfont_open_standard: 0x%x: %s", + error->errnum, error->errmess)); + } + break; + } + f->space_width = nsfont_width(f, " ", sizeof(" ")-1); + } + } +} diff --git a/riscos/gui.c b/riscos/gui.c index 745220a68..0aefc6a00 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -87,7 +87,7 @@ static clock_t gui_last_poll; /**< Time of last wimp_poll. */ osspriteop_area *gui_sprites; /**< Sprite area containing pointer and hotlist sprites */ /** Accepted wimp user messages. */ -static wimp_MESSAGE_LIST(33) task_messages = { { +static wimp_MESSAGE_LIST(34) task_messages = { { message_HELP_REQUEST, message_DATA_SAVE, message_DATA_SAVE_ACK, @@ -96,6 +96,7 @@ static wimp_MESSAGE_LIST(33) task_messages = { { message_DATA_OPEN, message_MENU_WARNING, message_MENUS_DELETED, + message_MODE_CHANGE, #ifdef WITH_URI message_URI_PROCESS, message_URI_RETURN_RESULT, @@ -996,6 +997,7 @@ void ro_gui_keypress(wimp_key *key) void ro_gui_user_message(wimp_event_no event, wimp_message *message) { + struct content *c; switch (message->action) { case message_HELP_REQUEST: ro_gui_interactive_help_request(message); @@ -1036,6 +1038,14 @@ void ro_gui_user_message(wimp_event_no event, wimp_message *message) ro_gui_hotlist_menu_closed(); } break; + case message_MODE_CHANGE: + ro_gui_history_mode_change(); + for (c = content_list; c; c = c->next) { + if ((c->type == CONTENT_HTML) && + (c->data.html.fonts)) + nsfont_reopen_set(c->data.html.fonts); + } + break; #ifdef WITH_URI case message_URI_PROCESS: diff --git a/riscos/gui.h b/riscos/gui.h index d034cabb9..47b76fe14 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -194,6 +194,7 @@ void ro_gui_window_redraw_all(void); /* in history.c */ void ro_gui_history_init(void); void ro_gui_history_quit(void); +void ro_gui_history_mode_change(void); void ro_gui_history_open(struct browser_window *bw, struct history *history, int wx, int wy); void ro_gui_history_redraw(wimp_draw *redraw); diff --git a/riscos/history.c b/riscos/history.c index bb6adc17f..153d3c629 100644 --- a/riscos/history.c +++ b/riscos/history.c @@ -273,6 +273,15 @@ void ro_gui_history_quit(void) /** + * Update resources folowing a mode change + */ +void ro_gui_history_mode_change(void) +{ + font_lose_font(history_font); + history_font = font_find_font("Homerton.Medium", 112, 128, 0, 0, 0, 0); +} + +/** * Open history window. */ @@ -415,7 +424,7 @@ void ro_gui_history_redraw_tree(struct history_entry *he, (char *)(header), x0 + he->x * FULL_WIDTH + MARGIN, y0 - he->y * FULL_HEIGHT - FULL_HEIGHT + MARGIN, - tinct_ERROR_DIFFUSE); + tinct_ERROR_DIFFUSE | tinct_BILINEAR_FILTER); } else { unsigned int size; os_factors factors; diff --git a/riscos/thumbnail.c b/riscos/thumbnail.c index 4f2b9399c..fb9fac8c8 100644 --- a/riscos/thumbnail.c +++ b/riscos/thumbnail.c @@ -20,6 +20,7 @@ #include "oslib/osspriteop.h" #include "netsurf/content/content.h" #include "netsurf/desktop/plotters.h" +#include "netsurf/render/font.h" #include "netsurf/riscos/gui.h" #include "netsurf/riscos/options.h" #include "netsurf/riscos/thumbnail.h" @@ -106,9 +107,15 @@ void thumbnail_create(struct content *content, osspriteop_area *area, colourtrans_set_gcol(os_COLOUR_WHITE, colourtrans_SET_BG, os_ACTION_OVERWRITE, 0); os_clg(); + if ((content->type == CONTENT_HTML) && + (content->data.html.fonts)) + nsfont_reopen_set(content->data.html.fonts); content_redraw(content, 0, 0, width, height, 0, 0, width, height, scale, 0xFFFFFF); thumbnail_restore_output(save_area); + if ((content->type == CONTENT_HTML) && + (content->data.html.fonts)) + nsfont_reopen_set(content->data.html.fonts); /* Go back from 32bpp to [n]bpp if we should. */ |