Made large font selectable by a constant

This commit is contained in:
Robin Daermann 2015-08-06 17:42:52 +02:00
parent c733fec476
commit 5a0d0ca5a3
3 changed files with 32 additions and 15 deletions

View File

@ -1,10 +1,11 @@
/**********************************************/ /***********************************************************/
/* */ /* */
/* Font file generated by rthelen */ /* Font file generated by schrorg */
/* based on the font file generated by rthelen */
/* */ /* */
/**********************************************/ /***********************************************************/
static unsigned int fontdata[] = { static unsigned int bigfontdata[] = {
/* 0 0x00 '^A' */ /* 0 0x00 '^A' */
0x0, /* 0000000000000000 */ 0x0, /* 0000000000000000 */

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// //
#include "zm.h" #include "zm.h"
//#include "zm_font.h" #include "zm_font.h"
#include "zm_bigfont.h" #include "zm_bigfont.h"
#include "zm_image.h" #include "zm_image.h"
#include "zm_utils.h" #include "zm_utils.h"
@ -1721,6 +1721,10 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
const Rgb bg_rgb_col = rgb_convert(bg_colour,subpixelorder); const Rgb bg_rgb_col = rgb_convert(bg_colour,subpixelorder);
const bool bg_trans = (bg_colour == RGB_TRANSPARENT); const bool bg_trans = (bg_colour == RGB_TRANSPARENT);
int zm_text_size = 0x80;
if (ZM_TEXT_SIZE == 2)
zm_text_size = 0x8000;
while ( (index < text_len) && (line_len = strcspn( line, "\n" )) ) while ( (index < text_len) && (line_len = strcspn( line, "\n" )) )
{ {
@ -1760,10 +1764,14 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
unsigned char *temp_ptr = ptr; unsigned char *temp_ptr = ptr;
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ ) for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{ {
int f = fontdata[(line[c] * CHAR_HEIGHT) + r]; int f;
if (ZM_TEXT_SIZE == 2)
f = bigfontdata[(line[c] * CHAR_HEIGHT) + r];
else
f = fontdata[(line[c] * CHAR_HEIGHT) + r];
for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ ) for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
{ {
if ( f & (0x8000 >> i) ) if ( f & (zm_text_size >> i) )
{ {
if ( !fg_trans ) if ( !fg_trans )
*temp_ptr = fg_bw_col; *temp_ptr = fg_bw_col;
@ -1786,10 +1794,14 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
unsigned char *temp_ptr = ptr; unsigned char *temp_ptr = ptr;
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ ) for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{ {
int f = fontdata[(line[c] * CHAR_HEIGHT) + r]; int f;
if (ZM_TEXT_SIZE == 2)
f = bigfontdata[(line[c] * CHAR_HEIGHT) + r];
else
f = fontdata[(line[c] * CHAR_HEIGHT) + r];
for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr += colours ) for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr += colours )
{ {
if ( f & (0x8000 >> i) ) if ( f & (zm_text_size >> i) )
{ {
if ( !fg_trans ) if ( !fg_trans )
{ {
@ -1818,10 +1830,14 @@ void Image::Annotate( const char *p_text, const Coord &coord, const Rgb fg_colou
Rgb* temp_ptr = (Rgb*)ptr; Rgb* temp_ptr = (Rgb*)ptr;
for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ ) for ( unsigned int x = lo_line_x, c = 0; x < hi_line_x && c < line_len; c++ )
{ {
int f = fontdata[(line[c] * CHAR_HEIGHT) + r]; int f;
if (ZM_TEXT_SIZE == 2)
f = bigfontdata[(line[c] * CHAR_HEIGHT) + r];
else
f = fontdata[(line[c] * CHAR_HEIGHT) + r];
for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ ) for ( unsigned int i = 0; i < CHAR_WIDTH && x < hi_line_x; i++, x++, temp_ptr++ )
{ {
if ( f & (0x8000 >> i) ) if ( f & (zm_text_size >> i) )
{ {
if ( !fg_trans ) if ( !fg_trans )
{ {

View File

@ -43,6 +43,7 @@ extern "C"
#define ZM_BUFTYPE_NEW 2 #define ZM_BUFTYPE_NEW 2
#define ZM_BUFTYPE_AVMALLOC 3 #define ZM_BUFTYPE_AVMALLOC 3
#define ZM_BUFTYPE_ZM 4 #define ZM_BUFTYPE_ZM 4
#define ZM_TEXT_SIZE 2
typedef void (*blend_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long, double); typedef void (*blend_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long, double);
typedef void (*delta_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long); typedef void (*delta_fptr_t)(const uint8_t*, const uint8_t*, uint8_t*, unsigned long);
@ -122,8 +123,7 @@ protected:
} }
public: public:
/* enum { CHAR_HEIGHT=11, CHAR_WIDTH=6 }; */ enum { CHAR_HEIGHT=11*ZM_TEXT_SIZE, CHAR_WIDTH=6*ZM_TEXT_SIZE };
enum { CHAR_HEIGHT=22, CHAR_WIDTH=14 };
enum { LINE_HEIGHT=CHAR_HEIGHT+0 }; enum { LINE_HEIGHT=CHAR_HEIGHT+0 };
protected: protected: