[project @ 2005-02-20 13:19:19 by bursa]
Font rewrite, part 3. Note that Draw export and printing are broken by these changes. svn path=/import/netsurf/; revision=1519
This commit is contained in:
parent
1a52a32e5d
commit
65b5ae0f8f
|
@ -808,7 +808,6 @@ void ro_gui_dialog_click_config(wimp_pointer *pointer)
|
|||
|
||||
void ro_gui_save_options(void)
|
||||
{
|
||||
nsfont_fill_nametable(true);
|
||||
/* NCOS doesnt have the fancy Universal Boot vars; so select
|
||||
* the path to the choices file based on the build options */
|
||||
#ifndef NCOS
|
||||
|
|
1416
riscos/font.c
1416
riscos/font.c
File diff suppressed because it is too large
Load Diff
13
riscos/gui.c
13
riscos/gui.c
|
@ -33,6 +33,7 @@
|
|||
#include "oslib/wimp.h"
|
||||
#include "oslib/wimpspriteop.h"
|
||||
#include "oslib/uri.h"
|
||||
#include "rufl.h"
|
||||
#include "netsurf/content/url_store.h"
|
||||
#include "netsurf/utils/config.h"
|
||||
#include "netsurf/desktop/gui.h"
|
||||
|
@ -258,7 +259,9 @@ void gui_init(int argc, char** argv)
|
|||
#ifndef ncos
|
||||
ro_gui_check_fonts();
|
||||
#endif
|
||||
nsfont_fill_nametable(false);
|
||||
|
||||
/** \todo handle errors */
|
||||
rufl_init();
|
||||
|
||||
/* Issue a *Desktop to poke AcornURI into life */
|
||||
if (getenv("NetSurf$Start_URI_Handler"))
|
||||
|
@ -560,6 +563,7 @@ void gui_quit(void)
|
|||
ro_gui_global_history_save();
|
||||
ro_gui_hotlist_save();
|
||||
ro_gui_history_quit();
|
||||
rufl_quit();
|
||||
free(gui_sprites);
|
||||
xwimp_close_down(task_handle);
|
||||
free(default_stylesheet_url);
|
||||
|
@ -1078,7 +1082,6 @@ 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);
|
||||
|
@ -1125,11 +1128,7 @@ void ro_gui_user_message(wimp_event_no event, wimp_message *message)
|
|||
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);
|
||||
}
|
||||
rufl_invalidate_cache();
|
||||
break;
|
||||
|
||||
#ifdef WITH_URI
|
||||
|
|
|
@ -249,6 +249,10 @@ void ro_gui_print_open(struct gui_window *g, int x, int y, bool sub_menu, bool k
|
|||
void ro_gui_print_click(wimp_pointer *pointer);
|
||||
bool ro_gui_print_keypress(wimp_key *key);
|
||||
|
||||
/* in font.c */
|
||||
bool nsfont_paint(struct css_style *style, const char *string,
|
||||
size_t length, int x, int y, float scale);
|
||||
|
||||
/* in plotters.c */
|
||||
extern const struct plotter_table ro_plotters;
|
||||
extern int ro_plot_origin_x;
|
||||
|
|
|
@ -31,7 +31,7 @@ static bool ro_plot_polygon(int *p, unsigned int n, colour fill);
|
|||
static bool ro_plot_fill(int x0, int y0, int x1, int y1, colour c);
|
||||
static bool ro_plot_clip(int clip_x0, int clip_y0,
|
||||
int clip_x1, int clip_y1);
|
||||
static bool ro_plot_text(int x, int y, struct font_data *font,
|
||||
static bool ro_plot_text(int x, int y, struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c);
|
||||
static bool ro_plot_disc(int x, int y, int radius, colour colour);
|
||||
static bool ro_plot_bitmap(int x, int y, int width, int height,
|
||||
|
@ -62,11 +62,7 @@ const struct plotter_table ro_plotters = {
|
|||
|
||||
int ro_plot_origin_x = 0;
|
||||
int ro_plot_origin_y = 0;
|
||||
|
||||
os_trfm ro_plot_trfm = { {
|
||||
{ 0x10000, 0 },
|
||||
{ 0, 0x10000, },
|
||||
{ 0, 0 } } };
|
||||
float ro_plot_scale = 1.0;
|
||||
|
||||
|
||||
bool ro_plot_clg(colour c)
|
||||
|
@ -300,22 +296,23 @@ bool ro_plot_clip(int clip_x0, int clip_y0,
|
|||
}
|
||||
|
||||
|
||||
bool ro_plot_text(int x, int y, struct font_data *font,
|
||||
bool ro_plot_text(int x, int y, struct css_style *style,
|
||||
const char *text, size_t length, colour bg, colour c)
|
||||
{
|
||||
os_error *error;
|
||||
|
||||
error = xcolourtrans_set_font_colours(font->handle,
|
||||
error = xcolourtrans_set_font_colours(font_CURRENT,
|
||||
bg << 8, c << 8, 14, 0, 0, 0);
|
||||
if (error) {
|
||||
LOG(("xcolourtrans_set_font_colours: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
return false;
|
||||
}
|
||||
return nsfont_paint(font, text, length,
|
||||
|
||||
return nsfont_paint(style, text, length,
|
||||
ro_plot_origin_x + x * 2,
|
||||
ro_plot_origin_y - y * 2,
|
||||
&ro_plot_trfm);
|
||||
ro_plot_scale);
|
||||
}
|
||||
|
||||
|
||||
|
@ -395,6 +392,5 @@ bool ro_plot_group_end(void)
|
|||
|
||||
void ro_plot_set_scale(float scale)
|
||||
{
|
||||
ro_plot_trfm.entries[0][0] = ro_plot_trfm.entries[1][1] =
|
||||
scale * 0x10000;
|
||||
ro_plot_scale = scale;
|
||||
}
|
||||
|
|
|
@ -750,7 +750,7 @@ bool print_find_fonts(struct box *box, struct print_font **print_fonts, int *fon
|
|||
int i;
|
||||
|
||||
assert(box);
|
||||
|
||||
#if 0
|
||||
if (box->text && box->font && box->length > 0) {
|
||||
txt = box->text;
|
||||
txt_len = box->length;
|
||||
|
@ -794,7 +794,7 @@ bool print_find_fonts(struct box *box, struct print_font **print_fonts, int *fon
|
|||
if (!print_find_fonts(a, print_fonts, font_count))
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ static bool draw_plot_polygon(int *p, unsigned int n, colour fill);
|
|||
static bool draw_plot_fill(int x0, int y0, int x1, int y1, colour c);
|
||||
static bool draw_plot_clip(int clip_x0, int clip_y0, int clip_x1,
|
||||
int clip_y1);
|
||||
static bool draw_plot_text(int x, int y, struct font_data *font,
|
||||
static bool draw_plot_text(int x, int y, struct css_style *style,
|
||||
const char *text, size_t length, colour bc, colour colour);
|
||||
static bool draw_plot_disc(int x, int y, int radius, colour colour);
|
||||
static bool draw_plot_bitmap(int x, int y, int width, int height,
|
||||
|
@ -858,9 +858,10 @@ bool draw_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1)
|
|||
* \param colour the text colour
|
||||
* \return true on success, false on error (error got reported)
|
||||
*/
|
||||
bool draw_plot_text(int x, int y, struct font_data *font,
|
||||
bool draw_plot_text(int x, int y, struct css_style *style,
|
||||
const char *text, size_t length, colour bc, colour colour)
|
||||
{
|
||||
#if 0
|
||||
while (length != 0) {
|
||||
size_t width, rolength, consumed;
|
||||
const char *rofontname, *rotext;
|
||||
|
@ -912,6 +913,7 @@ bool draw_plot_text(int x, int y, struct font_data *font,
|
|||
text += consumed;
|
||||
length -= consumed;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <swis.h>
|
||||
#include "rufl.h"
|
||||
#include "oslib/colourtrans.h"
|
||||
#include "oslib/osfile.h"
|
||||
#include "oslib/osspriteop.h"
|
||||
|
@ -112,15 +113,11 @@ 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);
|
||||
rufl_invalidate_cache();
|
||||
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);
|
||||
rufl_invalidate_cache();
|
||||
|
||||
/* Go back from 32bpp to [n]bpp if we should.
|
||||
*/
|
||||
|
|
1273
riscos/ufont.c
1273
riscos/ufont.c
File diff suppressed because it is too large
Load Diff
|
@ -1,70 +0,0 @@
|
|||
/* ufont.h
|
||||
* Licensed under the GNU General Public License,
|
||||
* http://www.opensource.org/licenses/gpl-license
|
||||
* Copyright 2000 James Bursa <bursa@users.sourceforge.net>
|
||||
* Copyright 2004 John Tytgat <John.Tytgat@aaug.net>
|
||||
*/
|
||||
|
||||
#ifndef UFONT_HEADER_INCLUDED
|
||||
#define UFONT_HEADER_INCLUDED
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "oslib/font.h"
|
||||
#include "oslib/os.h"
|
||||
|
||||
typedef struct ufont_font *ufont_f;
|
||||
|
||||
extern os_error *xufont_find_font(char const *font_name,
|
||||
int xsize,
|
||||
int ysize,
|
||||
int xres,
|
||||
int yres,
|
||||
ufont_f *font,
|
||||
int *xresOutP,
|
||||
int *yresOutP);
|
||||
|
||||
extern os_error *xufont_lose_font(ufont_f font);
|
||||
|
||||
extern os_error *xufont_paint(ufont_f font,
|
||||
unsigned char const *string,
|
||||
font_string_flags flags,
|
||||
int xpos,
|
||||
int ypos,
|
||||
font_paint_block const *block,
|
||||
os_trfm const *trfm,
|
||||
int length);
|
||||
|
||||
extern os_error *xufont_scan_string(ufont_f font,
|
||||
unsigned char const *string,
|
||||
font_string_flags flags,
|
||||
int x,
|
||||
int y,
|
||||
font_scan_block const *block,
|
||||
os_trfm const *trfm,
|
||||
int length,
|
||||
unsigned char const **split_point,
|
||||
int *x_out,
|
||||
int *y_out,
|
||||
int *length_out);
|
||||
|
||||
extern os_error *xufont_txtenum(ufont_f font,
|
||||
unsigned char const *string,
|
||||
font_string_flags flags,
|
||||
size_t length,
|
||||
int *width,
|
||||
unsigned char const **rofontname,
|
||||
unsigned char const **rotext,
|
||||
size_t *rolength,
|
||||
size_t *consumed);
|
||||
|
||||
extern os_error *xufont_convert(ufont_f font,
|
||||
unsigned char const *string,
|
||||
size_t length,
|
||||
char **presult,
|
||||
size_t **ptable);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue