mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
Fixed header, made different font plotters optional.
svn path=/trunk/netsurf/; revision=13230
This commit is contained in:
parent
905b3c2641
commit
7d4a0be284
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef WITH_FREETYPE_FONT_DRIVER
|
||||
#include <ft2build.h>
|
||||
#include FT_CACHE_H
|
||||
|
||||
@ -96,7 +96,6 @@ ft_new_face(const char *option, const char *resname, const char *fontfile)
|
||||
FT_Error error;
|
||||
FT_Face aface;
|
||||
char buf[PATH_MAX];
|
||||
char resname2[PATH_MAX];
|
||||
|
||||
newf = calloc(1, sizeof(ftc_faceid_t));
|
||||
if (option != NULL) {
|
||||
@ -274,7 +273,7 @@ static bool ft_font_init(void)
|
||||
"fonts/fantasy.ttf",
|
||||
DEJAVU_PATH"DejaVuSerifCondensed-Bold.ttf");
|
||||
|
||||
/* set the default render mode */
|
||||
/* set the default render mode */
|
||||
if (option_atari_font_monochrom == true)
|
||||
ft_load_type = FT_LOAD_MONOCHROME;
|
||||
else
|
||||
@ -426,11 +425,12 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
|
||||
size_t nxtchr = 0;
|
||||
FT_Glyph glyph;
|
||||
FT_BitmapGlyph bglyph;
|
||||
GRECT loc, clip;
|
||||
GRECT loc;
|
||||
uint32_t c = fstyle->foreground ;
|
||||
/* in -> BGR */
|
||||
/* out -> ARGB */
|
||||
c = ABGR_TO_RGB(c);
|
||||
|
||||
while (nxtchr < length) {
|
||||
ucs4 = utf8_to_ucs4(text + nxtchr, length - nxtchr);
|
||||
nxtchr = utf8_next(text, length, nxtchr);
|
||||
@ -491,3 +491,5 @@ static int dtor( FONT_PLOTTER self )
|
||||
bitmap_destroy( fontbmp );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef WITH_INTERNAL_FONT_DRIVER
|
||||
#include "atari/plot/plotter.h"
|
||||
#include "atari/plot/font_internal.h"
|
||||
|
||||
@ -228,14 +228,14 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
|
||||
tmp.fd_addr = buf;
|
||||
memset( tmp.fd_addr, 0, size );
|
||||
}
|
||||
int ypos;
|
||||
short ypos;
|
||||
int rowsize = tmp.fd_wdwidth << 1;
|
||||
char * d;
|
||||
uint32_t * pp;
|
||||
for (chr = 0; chr < blen; chr++) {
|
||||
pp = (uint32_t*)fb_font->data + ((unsigned char)buffer[chr] * fb_font->height);
|
||||
d = ((uint8_t*)tmp.fd_addr) + chr;
|
||||
for( ypos=0; (unsigned int)ypos<loc.g_h; ypos++){
|
||||
for( ypos=0; ypos<loc.g_h; ypos++){
|
||||
*d = (unsigned char)*pp++;
|
||||
d += rowsize;
|
||||
}
|
||||
@ -2348,3 +2348,4 @@ const struct fb_font_desc font_regular = {
|
||||
.encoding = "CP1252",
|
||||
.data = fontdata_regular,
|
||||
};
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifdef WITH_INTERNAL_FONT_DRIVER
|
||||
#ifndef FONT_PLOTTER_INTERNAL
|
||||
#define FONT_PLOTTER_INTERNAL
|
||||
|
||||
@ -30,3 +31,4 @@ struct fb_font_desc {
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef WITH_VDI_FONT_DRIVER
|
||||
#include "atari/plot/plotter.h"
|
||||
#include "atari/plot/font_vdi.h"
|
||||
|
||||
@ -210,8 +210,8 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
|
||||
if( fstyle->weight > 450 )
|
||||
fx |= 1;
|
||||
|
||||
/* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss), use that value
|
||||
pass it as arg, to reduce netsurf dependency */
|
||||
/* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss),
|
||||
use that value or pass it as arg, to reduce netsurf dependency */
|
||||
pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 );
|
||||
}
|
||||
x += CURFB(self->plotter).x;
|
||||
@ -231,3 +231,4 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,9 +15,11 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifdef WITH_VDI_FONT_DRIVER
|
||||
#ifndef FONT_PLOTTER_VDI
|
||||
#define FONT_PLOTTER_VDI
|
||||
|
||||
int ctor_font_plotter_vdi( FONT_PLOTTER self );
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -32,15 +32,34 @@
|
||||
#include "atari/plot/eddi.h"
|
||||
#include "atari/plot/plotter.h"
|
||||
#include "atari/plot/plotter_vdi.h"
|
||||
#include "atari/plot/plotter_nvdi.h"
|
||||
#include "atari/plot/font_vdi.h"
|
||||
#include "atari/plot/font_internal.h"
|
||||
#include "atari/plot/font_freetype.h"
|
||||
#ifdef WITH_VDI_FONT_DRIVER
|
||||
#include "atari/plot/font_vdi.h"
|
||||
#endif
|
||||
#ifdef WITH_INTERNAL_FONT_DRIVER
|
||||
#include "atari/plot/font_internal.h"
|
||||
#endif
|
||||
#ifdef WITH_FREETYPE_FONT_DRIVER
|
||||
#include "atari/plot/font_freetype.h"
|
||||
#endif
|
||||
#include "atari/gui.h"
|
||||
#include "utils/log.h"
|
||||
#include "atari/misc.h"
|
||||
#include "atari/osspec.h"
|
||||
|
||||
|
||||
/* get index to driver in driver list by name */
|
||||
static int drvrname_idx( char * name );
|
||||
|
||||
/* Error code translations: */
|
||||
static const char * plot_error_codes[] =
|
||||
{
|
||||
"None",
|
||||
"ERR_BUFFERSIZE_EXCEEDS_SCREEN",
|
||||
"ERR_NO_MEM",
|
||||
"ERR_PLOTTER_NOT_AVAILABLE"
|
||||
};
|
||||
|
||||
#ifdef WITH_8BPP_SUPPORT
|
||||
unsigned short vdi_web_pal[216][3] = {
|
||||
{0x000,0x000,0x000}, {0x0c8,0x000,0x000}, {0x190,0x000,0x000}, {0x258,0x000,0x000}, {0x320,0x000,0x000}, {0x3e8,0x000,0x000},
|
||||
{0x000,0x0c8,0x000}, {0x0c8,0x0c8,0x000}, {0x190,0x0c8,0x000}, {0x258,0x0c8,0x000}, {0x320,0x0c8,0x000}, {0x3e8,0x0c8,0x000},
|
||||
@ -79,6 +98,7 @@ unsigned short vdi_web_pal[216][3] = {
|
||||
{0x000,0x320,0x3e8}, {0x0c8,0x320,0x3e8}, {0x190,0x320,0x3e8}, {0x258,0x320,0x3e8}, {0x320,0x320,0x3e8}, {0x3e8,0x320,0x3e8},
|
||||
{0x000,0x3e8,0x3e8}, {0x0c8,0x3e8,0x3e8}, {0x190,0x3e8,0x3e8}, {0x258,0x3e8,0x3e8}, {0x320,0x3e8,0x3e8}, {0x3e8,0x3e8,0x3e8}
|
||||
};
|
||||
#endif
|
||||
|
||||
static short prev_vdi_clip[4];
|
||||
struct s_vdi_sysinfo vdi_sysinfo;
|
||||
@ -86,15 +106,20 @@ struct s_vdi_sysinfo vdi_sysinfo;
|
||||
struct s_driver_table_entry screen_driver_table[] =
|
||||
{
|
||||
{(char*)"vdi", ctor_plotter_vdi, 0, 32},
|
||||
/* {(char*)"nvdi", ctor_plotter_vdi, PLOT_FLAG_OFFSCREEN, 32},*/
|
||||
{(char*)NULL, NULL, 0, 0 }
|
||||
};
|
||||
|
||||
const struct s_font_driver_table_entry font_driver_table[] =
|
||||
{
|
||||
#ifdef WITH_VDI_FONT_DRIVER
|
||||
{(char*)"vdi", ctor_font_plotter_vdi, 0},
|
||||
#endif
|
||||
#ifdef WITH_FREETYPE_FONT_DRIVER
|
||||
{(char*)"freetype", ctor_font_plotter_freetype, 0},
|
||||
#endif
|
||||
#ifdef WITH_INTERNAL_FONT_DRIVER
|
||||
{(char*)"internal", ctor_font_plotter_internal, 0},
|
||||
#endif
|
||||
{(char*)NULL, NULL, 0}
|
||||
};
|
||||
|
||||
|
@ -64,17 +64,8 @@
|
||||
|
||||
/* Error codes: */
|
||||
#define ERR_BUFFERSIZE_EXCEEDS_SCREEN 1 /* The buffer allocated is larger than the screen */
|
||||
#define ERR_NO_MEM 2 /* Not enough memory for requested operation */
|
||||
#define ERR_PLOTTER_NOT_AVAILABLE 3 /* invalid plotter driver name passed */
|
||||
|
||||
/* Error code translations: */
|
||||
static const char * plot_error_codes[] =
|
||||
{
|
||||
"None",
|
||||
"ERR_BUFFERSIZE_EXCEEDS_SCREEN",
|
||||
"ERR_NO_MEM",
|
||||
"ERR_PLOTTER_NOT_AVAILABLE"
|
||||
};
|
||||
#define ERR_NO_MEM 2 /* Not enough memory for requested operation */
|
||||
#define ERR_PLOTTER_NOT_AVAILABLE 3 /* invalid plotter driver name passed */
|
||||
|
||||
/* Grapics & Font Plotter "Objects": */
|
||||
typedef struct s_font_plotter * FONT_PLOTTER;
|
||||
@ -247,9 +238,6 @@ struct s_font_driver_table_entry
|
||||
typedef struct s_driver_table_entry * PLOTTER_INFO;
|
||||
typedef struct s_font_driver_table_entry * FONT_PLOTTER_INFO;
|
||||
|
||||
/* get index to driver in driver list by name */
|
||||
static int drvrname_idx( char * name );
|
||||
|
||||
/* get s_driver_table_entry from driver table */
|
||||
struct s_driver_table_entry * get_screen_driver_entry(char * name);
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "atari/plot/eddi.h"
|
||||
#include "atari/plot/plotter.h"
|
||||
#include "atari/plot/plotter_vdi.h"
|
||||
#include "atari/plot/font_vdi.h"
|
||||
|
||||
/* assign vdi line style to dst ( netsurf type ) */
|
||||
#define NSLT2VDI(dst, src) \
|
||||
@ -68,17 +67,19 @@ static int bitmap( GEM_PLOTTER self, struct bitmap * bmp, int x, int y,
|
||||
static int plot_mfdb( GEM_PLOTTER self, GRECT * where, MFDB * mfdb, uint32_t flags);
|
||||
static int text(GEM_PLOTTER self, int x, int y, const char *text,size_t length, const plot_font_style_t *fstyle);
|
||||
|
||||
#ifdef WITH_8BPP_SUPPORT
|
||||
static unsigned short sys_pal[256][3]; /*RGB*/
|
||||
static unsigned short pal[256][3]; /*RGB*/
|
||||
|
||||
extern unsigned char rgb_web_pal[126][3];
|
||||
extern unsigned short vdi_web_pal[126][3];
|
||||
int32 * hermes_pal_p;
|
||||
#endif
|
||||
extern struct s_vdi_sysinfo vdi_sysinfo;
|
||||
|
||||
static HermesHandle hermes_pal_h; /* hermes palette handle */
|
||||
static HermesHandle hermes_cnv_h; /* hermes converter instance handle */
|
||||
static HermesHandle hermes_res_h;
|
||||
int32 * hermes_pal_p;
|
||||
|
||||
|
||||
static inline void vsl_rgbcolor( short vdih, uint32_t cin )
|
||||
{
|
||||
@ -169,6 +170,7 @@ int ctor_plotter_vdi(GEM_PLOTTER self )
|
||||
clip.y1 = FIRSTFB(self).h;
|
||||
self->clip( self, &clip );
|
||||
/* store system palette & setup the new (web) palette: */
|
||||
#ifdef WITH_8BPP_SUPPORT
|
||||
i = 0;
|
||||
if( app.nplanes <= 8 ){
|
||||
for( i=0; i<=255; i++ ) {
|
||||
@ -192,6 +194,7 @@ int ctor_plotter_vdi(GEM_PLOTTER self )
|
||||
} else {
|
||||
/* no need to change the palette - its application specific */
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned char * col;
|
||||
assert( Hermes_Init() );
|
||||
@ -253,16 +256,20 @@ static int dtor( GEM_PLOTTER self )
|
||||
free( self->fbuf[i].mem );
|
||||
}
|
||||
|
||||
|
||||
/* close Hermes stuff: */
|
||||
Hermes_ConverterReturn( hermes_cnv_h );
|
||||
|
||||
#ifdef WITH_8BPP_SUPPORT
|
||||
if( app.nplanes <= 8 ){
|
||||
/* restore system palette */
|
||||
for( i=0; i<=255; i++ ) {
|
||||
vs_color( self->vdi_handle, i, &sys_pal[i][0] );
|
||||
}
|
||||
}
|
||||
Hermes_PaletteReturn( hermes_pal_h );
|
||||
#endif
|
||||
|
||||
/* close Hermes stuff: */
|
||||
Hermes_ConverterReturn( hermes_cnv_h );
|
||||
/* Hermes_PaletteReturn( hermes_pal_h ); */
|
||||
Hermes_Done();
|
||||
|
||||
if( self->priv_data != NULL ){
|
||||
@ -279,9 +286,9 @@ static int resize( GEM_PLOTTER self, int w, int h )
|
||||
{
|
||||
if( w == CURFB(self).w && h == CURFB(self).h )
|
||||
return( 1 );
|
||||
/* todo: needed when using offscreen buffers...
|
||||
int newsize = calc_chunked_buffer_size( w, h, w, self->bpp_virt );
|
||||
LOG(("%s: %s, oldsize: %d\n", (char*)__FILE__, __FUNCTION__, CURFB(self).size ));
|
||||
/* todo: needed when using offscreen buffers...
|
||||
if( newsize > self->screen_buffer_size ) {
|
||||
self->screen_buffer_size = newsize;
|
||||
self->screen_buffer =realloc( self->screen_buffer , self->screen_buffer_size );
|
||||
@ -1064,7 +1071,6 @@ static int plot_mfdb (GEM_PLOTTER self, GRECT * loc, MFDB * insrc, uint32_t flag
|
||||
MFDB screen, tran;
|
||||
MFDB * src;
|
||||
short pxy[8];
|
||||
short pxyclip[4];
|
||||
short c[2] = {OFFSET_CUSTOM_COLOR, WHITE};
|
||||
GRECT off;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user