update amiga font layout handling to use table

This commit is contained in:
Vincent Sanders 2016-04-24 19:04:48 +01:00
parent 6ddb66ccfb
commit 7677901edf
4 changed files with 15 additions and 11 deletions

View File

@ -25,7 +25,7 @@
#include "utils/log.h"
#include "utils/nsoption.h"
#include "desktop/browser.h"
#include "desktop/font.h"
#include "desktop/gui_layout.h"
#include "amiga/font.h"
#include "amiga/font_bullet.h"
@ -119,7 +119,7 @@ void ami_font_fini(void)
}
/* Stub entry points */
static bool nsfont_width(const plot_font_style_t *fstyle,
static nserror ami_font_width(const plot_font_style_t *fstyle,
const char *string, size_t length,
int *width)
{
@ -127,7 +127,7 @@ static bool nsfont_width(const plot_font_style_t *fstyle,
return ami_nsfont->width(fstyle, string, length, width);
}
static bool nsfont_position_in_string(const plot_font_style_t *fstyle,
static nserror ami_font_position(const plot_font_style_t *fstyle,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x)
{
@ -135,7 +135,7 @@ static bool nsfont_position_in_string(const plot_font_style_t *fstyle,
return ami_nsfont->posn(fstyle, string, length, x, char_offset, actual_x);
}
static bool nsfont_split(const plot_font_style_t *fstyle,
static nserror ami_font_split(const plot_font_style_t *fstyle,
const char *string, size_t length,
int x, size_t *char_offset, int *actual_x)
{
@ -143,9 +143,10 @@ static bool nsfont_split(const plot_font_style_t *fstyle,
return ami_nsfont->split(fstyle, string, length, x, char_offset, actual_x);
}
const struct font_functions nsfont = {
nsfont_width,
nsfont_position_in_string,
nsfont_split
static struct gui_layout_table layout_table = {
.width = ami_font_width,
.position = ami_font_position,
.split = ami_font_split,
};
struct gui_layout_table *ami_layout_table = &layout_table;

View File

@ -55,5 +55,8 @@ struct ami_font_functions {
};
const struct ami_font_functions *ami_nsfont;
struct gui_layout_table *ami_layout_table;
#endif

View File

@ -30,7 +30,6 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/nsoption.h"
#include "desktop/font.h"
#include "amiga/font.h"
#include "amiga/font_diskfont.h"

View File

@ -50,12 +50,13 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "desktop/printer.h"
#include "desktop/font.h"
#include "desktop/gui_layout.h"
#include "desktop/mouse.h"
#include "desktop/gui_window.h"
#include "content/hlcache.h"
#include "amiga/plotters.h"
#include "amiga/font.h"
#include "amiga/gui.h"
#include "amiga/libs.h"
#include "amiga/misc.h"
@ -414,7 +415,7 @@ void ami_print(struct hlcache_handle *c, int copies)
ami_print_info.PD = (struct PrinterData *)ami_print_info.PReq->io_Device;
ami_print_info.PED = &ami_print_info.PD->pd_SegmentData->ps_PED;
ami_print_info.ps = print_make_settings(PRINT_DEFAULT, nsurl_access(hlcache_handle_get_url(c)), &nsfont);
ami_print_info.ps = print_make_settings(PRINT_DEFAULT, nsurl_access(hlcache_handle_get_url(c)), ami_layout_table);
ami_print_info.ps->page_width = ami_print_info.PED->ped_MaxXDots;
ami_print_info.ps->page_height = ami_print_info.PED->ped_MaxYDots;
ami_print_info.ps->scale = scale;