mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-01 00:34:31 +03:00
Added plot_get/set_text_plotter and comments
This commit is contained in:
parent
569b748172
commit
2c0bcc39bd
@ -46,23 +46,38 @@ void dump_font_drivers(void)
|
||||
|
||||
|
||||
/*
|
||||
Create an new text plotter object
|
||||
* Create an new text plotter object
|
||||
* Available: "vdi", "freetype"
|
||||
* @param vdihandle the vdi handle to act upon,
|
||||
* @param name selector ID (string) of the font plotter.
|
||||
* @flags flags configration flags of the plotter,
|
||||
* available flags:
|
||||
* FONTPLOT_FLAG_MONOGLYPH - Enable 1 bit font plotting
|
||||
* @param error set to != 0 when errors occur
|
||||
*/
|
||||
FONT_PLOTTER new_font_plotter( int vdihandle, char * name, unsigned long flags,
|
||||
int * error)
|
||||
{
|
||||
int i=0;
|
||||
int res = 0-ERR_PLOTTER_NOT_AVAILABLE;
|
||||
FONT_PLOTTER fplotter = (FONT_PLOTTER)malloc( sizeof(struct s_font_plotter) );
|
||||
FONT_PLOTTER fplotter;
|
||||
|
||||
/* allocate the font plotter instance: */
|
||||
fplotter = (FONT_PLOTTER)malloc( sizeof(struct s_font_plotter) );
|
||||
if( fplotter == NULL ) {
|
||||
*error = 0-ERR_NO_MEM;
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
/* Initialize the font plotter with the requested settings: */
|
||||
memset( fplotter, 0, sizeof(FONT_PLOTTER));
|
||||
fplotter->vdi_handle = vdihandle;
|
||||
fplotter->name = name;
|
||||
fplotter->flags = 0;
|
||||
fplotter->flags |= flags;
|
||||
|
||||
/* Find the selector string in the font plotter table: */
|
||||
/* And bail out when the font plotter is not available: */
|
||||
for( i = 0; ; i++) {
|
||||
if( font_driver_table[i].name == NULL ) {
|
||||
res = 0-ERR_PLOTTER_NOT_AVAILABLE;
|
||||
|
@ -60,10 +60,15 @@ struct s_font_plotter
|
||||
};
|
||||
|
||||
|
||||
FONT_PLOTTER plot_get_text_plotter(void);
|
||||
/* Set the font plotting engine.
|
||||
*/
|
||||
void plot_set_text_plotter(FONT_PLOTTER font_plotter);
|
||||
void dump_font_drivers(void);
|
||||
FONT_PLOTTER new_font_plotter( int vdihandle, char * name, unsigned long flags,
|
||||
int * error);
|
||||
int delete_font_plotter( FONT_PLOTTER p );
|
||||
|
||||
#ifdef WITH_VDI_FONT_DRIVER
|
||||
#include "atari/plot/font_vdi.h"
|
||||
#endif
|
||||
|
@ -1974,6 +1974,16 @@ void plot_get_clip_grect(GRECT * out)
|
||||
out->g_h = clip.y1 - clip.y0;
|
||||
}
|
||||
|
||||
FONT_PLOTTER plot_get_text_plotter()
|
||||
{
|
||||
return(fplotter);
|
||||
}
|
||||
|
||||
void plot_set_text_plotter(FONT_PLOTTER font_plotter)
|
||||
{
|
||||
fplotter = font_plotter;
|
||||
}
|
||||
|
||||
static bool plot_text(int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle )
|
||||
{
|
||||
fplotter->text(fplotter, x, y, text, length, fstyle);
|
||||
|
Loading…
Reference in New Issue
Block a user