GitHub Viewer
/* GNUPLOT - bitmap.c */
/*[
* Copyright Jyrki Yli-Nokari 1987
*
* Gnuplot license:
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
*
* Alternative license:
*
* As an alternative to distributing code in this file under the gnuplot license,
* you may instead comply with the terms below. In this case, redistribution and
* use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
]*/
/*
* AUTHORS
*
* Original Software:
* Jyrki Yli-Nokari (1987)
* Modified for use with gnuplot (1990):
* Ronald J. Hartranft
* Russell Lang
*/
/*
** Jyrki Yli-Nokari, December 2013.
** Change to dual licence (Gnuplot + BSD) and remove previous
** restriction to noncommercial use.
*/
#include "bitmap.h"
#include "alloc.h"
#include "util.h"
#include "term_api.h" /* EAM - to pick up fillstyle definitions */
/* global variables */
bitmap *b_p = (bitmap *) NULL; /* global pointer to bitmap */
unsigned int b_xsize, b_ysize; /* the size of the bitmap */
unsigned int b_planes; /* number of color planes */
unsigned int b_psize; /* size of each plane */
unsigned int b_rastermode; /* raster mode rotates -90deg */
unsigned int b_linemask = 0xffff; /* 16 bit mask for dotted lines */
int b_angle; /* rotation of text */
enum JUSTIFY b_justify = LEFT; /* text justification */
int b_maskcount = 0;
/* Local prototypes */
static GP_INLINE void b_setpixel(unsigned int x, unsigned int y, unsigned int value);
static GP_INLINE void b_setmaskpixel(unsigned int x, unsigned int y, unsigned int value);
static void b_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
static void b_wline(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
/* file-scope variables */
static unsigned int b_value = 1; /* colour of lines */
static double b_lw = 1; /* line width */
static unsigned int b_currx, b_curry; /* the current coordinates */
static unsigned int b_hchar; /* width of characters */
static unsigned int b_hbits; /* actual bits in char horizontally */
static unsigned int b_vchar; /* height of characters */
static unsigned int b_vbits; /* actual bits in char vertically */
static char_box b_font[FNT_CHARS]; /* the current font */
static unsigned int b_pattern[] = { 0xffff, 0x1111, 0xffff, 0x5555,
0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f };
static unsigned int b_lastx;
static unsigned int b_lasty; /* last pixel set - used by b_line */
/* 5x9 font, bottom row first, left pixel in lsb */
const char_row fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
/* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000},
/*!*/ {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
/*"*/ {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
/*#*/ {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
/*$*/ {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
/*%*/ {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
/*&*/ {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
/*'*/ {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
/*(*/ {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
/*)*/ {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
/***/ {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
/*+*/ {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
/*,*/ {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
/*-*/ {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
/*.*/ {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
/*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
/*0*/ {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
/*1*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
/*2*/ {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
/*3*/ {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
/*4*/ {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
/*5*/ {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
/*6*/ {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
/*7*/ {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
/*8*/ {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
/*9*/ {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
/*:*/ {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
/*;*/ {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
/**/ {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
/*?*/ {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
/*@*/ {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
/*A*/ {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
/*B*/ {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
/*C*/ {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
/*D*/ {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
/*E*/ {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
/*F*/ {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
/*G*/ {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
/*H*/ {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
/*I*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
/*J*/ {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
/*K*/ {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
/*L*/ {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
/*M*/ {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
/*N*/ {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
/*O*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
/*P*/ {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
/*Q*/ {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
/*R*/ {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
/*S*/ {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
/*T*/ {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
/*U*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
/*V*/ {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
/*W*/ {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
/*X*/ {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
/*Y*/ {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
/*Z*/ {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
/*[*/ {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
/*\ */ {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
/*]*/ {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
/*^*/ {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
/*_*/ {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
/*`*/ {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
/*a*/ {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
/*b*/ {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
/*c*/ {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
/*d*/ {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
/*e*/ {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
/*f*/ {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
/*g*/ {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
/*h*/ {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
/*i*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
/*j*/ {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
/*k*/ {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
/*l*/ {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
/*m*/ {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
/*n*/ {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
/*o*/ {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
/*p*/ {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
/*q*/ {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
/*r*/ {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
/*s*/ {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
/*t*/ {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
/*u*/ {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
/*v*/ {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
/*w*/ {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
/*x*/ {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
/*y*/ {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
/*z*/ {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
/*{*/ {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
/*|*/ {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
/*}*/ {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
/*~*/ {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
/*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
};
/* 9x17 font, bottom row first, left pixel in lsb */
const char_row fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
/* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000},
/*!*/ {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
/*"*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
/*#*/ {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
/*$*/ {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
/*%*/ {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
/*&*/ {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
/*'*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
/*(*/ {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
/*)*/ {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
/***/ {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
/*+*/ {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
/*,*/ {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
000000,000000,000000,000000,000000,000000,000000,000000},
/*-*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,0x01ff,000000,000000,000000,000000,000000,000000},
/*.*/ {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000},
/*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
/*0*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
/*1*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
/*2*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
/*3*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
/*4*/ {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
/*5*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
/*6*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
/*7*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
/*8*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
/*9*/ {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
/*:*/ {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
/*;*/ {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
/**/ {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
/*?*/ {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
/*@*/ {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
/*A*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
/*B*/ {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
/*C*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
/*D*/ {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
/*E*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
/*F*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
/*G*/ {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
/*H*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
/*I*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
/*J*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
/*K*/ {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
/*L*/ {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
/*M*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
/*N*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
/*O*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
/*P*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
/*Q*/ {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
/*R*/ {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
/*S*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
/*T*/ {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
/*U*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
/*V*/ {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
/*W*/ {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
/*X*/ {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
/*Y*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
/*Z*/ {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
/*[*/ {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
/*\ */ {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
/*]*/ {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
/*^*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
/*_*/ {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000},
/*`*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
/*a*/ {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
/*b*/ {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
/*c*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
/*d*/ {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
/*e*/ {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
/*f*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
/*g*/ {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
/*h*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
/*i*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
/*j*/ {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
/*k*/ {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
/*l*/ {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
/*m*/ {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
/*n*/ {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
/*o*/ {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
/*p*/ {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
/*q*/ {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
/*r*/ {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
/*s*/ {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
/*t*/ {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
/*u*/ {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
/*v*/ {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
/*w*/ {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
/*x*/ {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
/*y*/ {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
/*z*/ {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
/*{*/ {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
/*|*/ {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
/*}*/ {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
/*~*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
/*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
};
/* 13x25 font, bottom row first, left pixel in lsb */
const char_row fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
/* */ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000},
/*!*/ {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
/*"*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000,000000,
0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
/*#*/ {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
/*$*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
/*%*/ {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
/*&*/ {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
/*'*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
/*(*/ {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
/*)*/ {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
/***/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
/*+*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
/*,*/ {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000},
/*-*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
000000,000000,000000,000000,000000,000000,000000},
/*.*/ {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000},
/*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
/*0*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
/*1*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
/*2*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
/*3*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
/*4*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
/*5*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
/*6*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
/*7*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
/*8*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
/*9*/ {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
/*:*/ {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
/*;*/ {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
/**/ {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
/*?*/ {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
/*@*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
/*A*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
/*B*/ {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
/*C*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
/*D*/ {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
/*E*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
/*F*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
/*G*/ {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
/*H*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
/*I*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
/*J*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
/*K*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
/*L*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
/*M*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
/*N*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
/*O*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
/*P*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
/*Q*/ {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
/*R*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
/*S*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
/*T*/ {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
/*U*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
/*V*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
/*W*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
/*X*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
/*Y*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
/*Z*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
/*[*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
/*\ */ {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
/*]*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
/*^*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000,000000,
0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
/*_*/ {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000},
/*`*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
/*a*/ {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
0x03f8,000000,000000,000000,000000,000000,000000},
/*b*/ {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
/*c*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
0x03f8,000000,000000,000000,000000,000000,000000},
/*d*/ {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
/*e*/ {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
0x03f8,000000,000000,000000,000000,000000,000000},
/*f*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
/*g*/ {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
0x13f8,000000,000000,000000,000000,000000,000000},
/*h*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
/*i*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
/*j*/ {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
000000,000000,000000,0x0700,0x0700,0x0700,000000},
/*k*/ {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
/*l*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
/*m*/ {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
0x0209,000000,000000,000000,000000,000000,000000},
/*n*/ {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
0x03f9,000000,000000,000000,000000,000000,000000},
/*o*/ {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
0x03f8,000000,000000,000000,000000,000000,000000},
/*p*/ {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
0x03f9,000000,000000,000000,000000,000000,000000},
/*q*/ {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
0x13f8,000000,000000,000000,000000,000000,000000},
/*r*/ {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
0x03f9,000000,000000,000000,000000,000000,000000},
/*s*/ {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
0x07f8,000000,000000,000000,000000,000000,000000},
/*t*/ {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
/*u*/ {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
0x1001,000000,000000,000000,000000,000000,000000},
/*v*/ {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
0x1001,000000,000000,000000,000000,000000,000000},
/*w*/ {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
0x1001,000000,000000,000000,000000,000000,000000},
/*x*/ {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
0x1001,000000,000000,000000,000000,000000,000000},
/*y*/ {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
0x1001,000000,000000,000000,000000,000000,000000},
/*z*/ {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
0x1fff,000000,000000,000000,000000,000000,000000},
/*{*/ {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
/*|*/ {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
/*}*/ {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
/*~*/ {000000,000000,000000,000000,000000,000000,000000,000000,000000,
000000,000000,000000,000000,000000,000000,000000,000000,000000,
0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
/*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
0x1249,000000,000000,0x1249,000000,000000,0x1249},
};
/*
** The plotting area is defined as a huge bitmap.
** The bitmap is stored in a dynamically allocated pixel array b_p
**
** The bitmap is allocated (and initialized to zero) with
** b_makebitmap(xsize, ysize, planes)
** and freed with b_freebitmap()
** xsize and ysize will be rounded up to a multiple of 8.
**
** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
**
** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
** where the point (x,y) is the target to go from the current point
** To set the color use b_setvalue(value) where value is the value
** (0 or 1 or a color number) to be stored in every pixel.
** To get dotted line styles, use b_setlinetype(linetype).
**
** Internally all plotting goes through b_setpixel(x, y, value).
*/
/* bitmaps used for filled boxes style (ULIG) */
#define fill_bitmap_width 8
#define fill_bitmap_height 8
#define fill_halftone_num 5
static unsigned char fill_halftone_bitmaps[fill_halftone_num][8] ={
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, /* no fill */
{ 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44 }, /* 25% pattern */
{ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa }, /* 50% pattern */
{ 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd }, /* 75% pattern */
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } /* solid pattern */
};
#define fill_pattern_num 8
static unsigned char fill_pattern_bitmaps[fill_pattern_num][8] ={
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } /* no fill */
,{ 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x01 } /* cross-hatch (1) */
,{ 0x88, 0x55, 0x22, 0x55, 0x88, 0x55, 0x22, 0x55 } /* double crosshatch(2) */
,{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } /* solid fill (3) */
,{ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 } /* diagonal stripes (4) */
,{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 } /* diagonal stripes (5) */
,{ 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11 } /* diagonal stripes (6) */
,{ 0x11, 0x11, 0x22, 0x22, 0x44, 0x44, 0x88, 0x88 } /* diagonal stripes (7) */
#if (0)
,{ 0x03, 0x0C, 0x30, 0xC0, 0x03, 0x0C, 0x30, 0xC0 } /* diagonal stripes (8) */
,{ 0xC0, 0x30, 0x0C, 0x03, 0xC0, 0x30, 0x0C, 0x03 } /* diagonal stripes (9) */
#endif
};
/*
* set pixel (x, y, value) to value value (this can be 1/0 or a color number).
*/
static GP_INLINE void
b_setpixel(unsigned int x, unsigned int y, unsigned int value)
{
unsigned int row;
unsigned char mask;
unsigned int i;
if (b_rastermode) {
/* interchange so that new (x,y) is old (y,b_ysize-1-x) */
row = x; /* temp storage */
x = y;
y = b_ysize - 1 - row;
}
if ((x < b_xsize) && (y < b_ysize)) {
row = y / 8;
mask = 1 >= 1;
}
}
#ifdef BITMAPDEBUG
else {
if (b_rastermode)
fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
b_ysize - 1 - y, x, value);
else
fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
x, y, value);
}
#endif
}
/*
* set pixel (x, y) to the set value
*/
void
b_putpixel(unsigned int x, unsigned int y)
{
b_setpixel(x, y, b_value);
}
/*
* get pixel (x,y) value
*/
unsigned int
b_getpixel(unsigned int x, unsigned int y)
{
unsigned int row;
unsigned char mask;
unsigned int value=0; /* HBB 991123: initialize! */
int i;
if (b_rastermode) {
row = x;
x = y;
y = b_ysize-1-row;
}
if ((x < b_xsize) && (y < b_ysize)) {
row = y/8 + (b_planes-1)*b_psize;
mask = 1> b_maskcount) & (unsigned int) (1)) {
b_setpixel(x, y, value);
}
b_maskcount = (b_maskcount + 1) % 16;
b_lastx = x; /* last pixel set with mask */
b_lasty = y;
}
/*
* draw a line from (x1,y1) to (x2,y2)
* with color b_value and dotted mask b_linemask.
*/
static void
b_line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)
{
int runcount;
int dx, dy;
int xinc, yinc;
unsigned int xplot, yplot;
runcount = 0;
dx = abs((int) (x1) - (int) (x2));
if (x2 > x1)
xinc = 1;
else if (x2 == x1)
xinc = 0;
else
xinc = -1;
dy = abs((int) (y1) - (int) (y2));
if (y2 > y1)
yinc = 1;
else if (y2 == y1)
yinc = 0;
else
yinc = -1;
xplot = x1;
yplot = y1;
if (dx > dy) {
/* iterate x */
if ((b_linemask == 0xffff) ||
((xplot != b_lastx) && (yplot != b_lasty)))
b_setmaskpixel(xplot, yplot, b_value);
while (xplot != x2) {
xplot += xinc;
runcount += dy;
if (runcount >= (dx - runcount)) {
yplot += yinc;
runcount -= dx;
}
b_setmaskpixel(xplot, yplot, b_value);
}
} else {
/* iterate y */
if ((b_linemask == 0xffff) ||
((xplot != b_lastx) && (yplot != b_lasty)))
b_setmaskpixel(xplot, yplot, b_value);
while (yplot != y2) {
yplot += yinc;
runcount += dx;
if (runcount >= (dy - runcount)) {
xplot += xinc;
runcount -= dy;
}
b_setmaskpixel(xplot, yplot, b_value);
}
}
}
/* draw a wide line (solid only, no dash pattern */
/* code from sixeltek terminal by Erik Olofsen */
static void
b_wline(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)
{
int runcount;
int dx, dy;
int xinc, yinc;
unsigned int xplot, yplot;
unsigned int i, wh, wh2;
int x;
if (b_lw x1)
xinc = 1;
else if (x2 == x1)
xinc = 0;
else
xinc = -1;
dy = abs((int) (y1) - (int) (y2));
if (y2 > y1)
yinc = 1;
else if (y2 == y1)
yinc = 0;
else
yinc = -1;
xplot = x1;
yplot = y1;
if (dx > dy) {
/* iterate x */
while (xplot != x2) {
xplot += xinc;
runcount += dy;
if (runcount >= (dx - runcount)) {
yplot += yinc;
runcount -= dx;
}
for (i = 1; i