Implementation of dot matrix font in j2s

Source: Internet
Author: User
Tags 0xc0

The implementation of dot matrix font library in j2s.
Recently, I have no intention of discovering the dot matrix font library in the course of learning C. After sorting out the relevant algorithms, we have implemented the following algorithms in j2s.

Below is a line of DoS
For a small number of Chinese Character graphics programs, there is no need to bring a huge Chinese Character Library to run, as long as the memory permits, you can directly define the Chinese character model as an array of information stored in the EXE file. With this tool, you can extract a single template and paste it in the source code. This tool is powerful in that it not only can generate 12x12, 16x16 these fonts in the DOS font, but also can generate 16x16, and even Custom font fonts, in addition, you can select and preview the effects in six modes! Graphic programming with a small number of Chinese characters can provide great convenience.

Compared to the j2s function that draws these fonts:
First, we need to use tools to generate the gb2312 font model of the dot matrix font library, and then draw it out in the image. Below I will give some font fonts. Let's just talk about them. Let's look at the example here. If you do not understand anything or want to discuss it, go to uhua.3geye.net. My contact information is displayed.

Import javax. microedition. MIDlet .*;
Import javax. microedition. lcdui. Canvas;
Import javax. microedition. lcdui. graphics;
Import javax. microedition. lcdui. display;

Public class fontmidlet extends MIDlet {
Public fontmidlet (){
}

Protected void destroyapp (Boolean _ Boolean) throws
Midletstatechangeexception {
}

Protected void pauseapp (){
}

Protected void Startapp () throws midletstatechangeexception {
Display. getdisplay (this). setcurrent (New fontcanvas ());
}

 

Char yi12 [] = {
/* The following is the 12-dot-matrix of '1', 24 bytes */
0x00, 0x00, 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00,
0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0c, 0x00,
0x0c, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
};

Char er12 [] = {
/* The following is the 12-dot-matrix of '2', 24 bytes */
0x00, 0x00, 0x3e, 0x00, 0x63, 0x00, 0x03, 0x00,
0x06, 0x00, 0x0c, 0x00, 0x18, 0x00, 0x30, 0x00,
0x63, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
};

Char dian12 [] = {
/* The following figure shows the 12-dot-matrix ing mode of 'point', 24 bytes */
0x04, 0x00, 0x07, 0xc0, 0x04, 0x00, 0x04, 0x00,
0x3f, 0x80, 0x20, 0x80, 0x20, 0x80, 0x3f, 0x80,
0x00, 0x00, 0x49, 0x40, 0xc9, 0x20, 0x00, 0x00,
};

Char zhen12 [] = {
/* The following figure shows the 12-dot-matrix ing mode of the array, 24 bytes */
0xf2, 0x00, 0x9f, 0xe0, 0x92, 0x00, 0xa5, 0x00,
0xa5, 0x00, 0x97, 0xe0, 0x91, 0x00, 0xb1, 0x00,
0x8f, 0xe0, 0x81, 0x00, 0x81, 0x00, 0x00, 0x00,
};

Char song16 [] = {
/* The following is the 16-dot-matrix of 'son', 32 bytes */
0x02, 0x00, 0x01, 0x00, 0x7f, 0xfe, 0x41, 0x04,
0x81, 0x08, 0x01, 0x00, 0x7f, 0xfc, 0x03, 0x80,
0x05, 0x80, 0x05, 0x40, 0x09, 0x20, 0x11, 0x10,
0x21, 0x0e, 0x41, 0x04, 0x01, 0x00, 0x00, 0x00,
};

Char ti16 [] = {
/* The following is the 16-dot-matrix ry font of 'body', 32 bytes */
0x10, 0x40, 0x18, 0x40, 0x10, 0x40, 0x20, 0x40,
0x37, 0xfc, 0x60, 0xc0, 0xa0, 0xe0, 0x21, 0x60,
0x21, 0x50, 0x22, 0x48, 0x24, 0x4e, 0x2b, 0xf4,
0x20, 0x40, 0x20, 0x40, 0x20, 0x40, 0x00, 0x00,
};

Char zi24 [] = {
/* The following is the 24-dot-matrix character model of the 'word', 72 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0x00, 0x08, 0x1c, 0x10,
0x1f, 0xff, 0xf0, 0x18, 0x00, 0x30, 0x18, 0xff,
0x10, 0x09, 0xc3, 0x90, 0x00, 0x3c, 0x00, 0x00,
0x1c, 0x00, 0x3f, 0xff, 0xfe, 0x7e, 0x0c, 0xfe,
0x00, 0x1c, 0x04, 0x00, 0x1c, 0x00, 0x04, 0x3c,
0x00, 0x03, 0xf8, 0x00, 0x00, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

Char mo24 [] = {
/* The following figure shows the 'module''s 24-dot matrix phantom _ gb2312, 72 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x00,
0x30, 0x03, 0x0c, 0x20, 0x03, 0x04, 0x3c, 0x02,
0x07, 0xe0, 0x02, 0x1c, 0x40, 0x02, 0x00, 0x40,
0x03, 0xc0, 0x70, 0x7e, 0x1f, 0x98, 0x02, 0x08,
0x10, 0x06, 0x0f, 0x90, 0x07, 0x88, 0x10, 0x0a,
0xcb, 0xe0, 0x1a, 0x05, 0x00, 0x12, 0x01, 0x1e,
0x22, 0x0f, 0xfe, 0x42, 0x32, 0x80, 0x02, 0x02,
0x40, 0x02, 0x04, 0x60, 0x02, 0x0c, 0x30, 0x02,
0x18, 0x1c, 0x02, 0x20, 0x0f, 0x02, 0x00, 0x00,
};

Char guan48 [] = {
/* The following is the 48-dot-matrix simhei font of 'fill ', 288 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x38, 0x00,
0x03, 0x00, 0x03, 0xc0, 0x38, 0x00, 0x07, 0x80,
0x03, 0xc0, 0x38, 0x00, 0x07, 0xc0, 0x03, 0xc0,
0x38, 0x00, 0x03, 0xf1, 0xff, 0xff, 0xff, 0xfc,
0x01, 0xf9, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x79,
0xf1, 0xc0, 0x39, 0xfc, 0x00, 0x30, 0x01, 0xc0,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xf0, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xf0,
0xff, 0xe0, 0x00, 0x00, 0xe0, 0x70, 0xe0, 0xe0,
0x0e, 0x00, 0xe0, 0x70, 0xe0, 0xe0, 0x1f, 0x80,
0xe0, 0x70, 0xe0, 0xe0, 0x1f, 0xe0, 0xff, 0xf0,
0xff, 0xe0, 0x07, 0xf0, 0xff, 0xf0, 0xff, 0xe0,
0x01, 0xf0, 0xff, 0xf1, 0xff, 0xe0, 0x00, 0x60,
0x08, 0x07, 0x00, 0x00, 0x00, 0x20, 0x1e, 0x03,
0x80, 0x00, 0x00, 0x00, 0x1e, 0x03, 0x00, 0x00,
0x00, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x00, 0x00,
0x3f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x3f, 0xff,
0xff, 0xf0, 0x00, 0x00, 0x7c, 0x03, 0x80, 0x00,
0x00, 0x20, 0x7c, 0x03, 0x80, 0x00, 0x00, 0x70,
0xfc, 0x03, 0x80, 0x00, 0x00, 0x71, 0xff, 0xff,
0xff, 0xe0, 0x00, 0x73, 0xff, 0xff, 0xff, 0xe0,
0x00, 0xf3, 0xbc, 0x03, 0x80, 0x60, 0x00, 0xe3,
0xbc, 0x03, 0x80, 0x00, 0x01, 0xe1, 0x3c, 0x03,
0x80, 0x00, 0x01, 0xc0, 0x3f, 0xff, 0xff, 0xe0,
0x01, 0xc0, 0x3f, 0xff, 0xff, 0xe0, 0x03, 0xc0,
0x3f, 0xff, 0xff, 0xe0, 0x03, 0x80, 0x3c, 0x03,
0x80, 0x00, 0x07, 0x80, 0x3c, 0x03, 0x80, 0x00,
0x0f, 0x80, 0x3c, 0x03, 0x80, 0x00, 0x0f, 0x00,
0x3f, 0xff, 0xff, 0xf8, 0x1f, 0x00, 0x3f, 0xff,
0xff, 0xf8, 0x1f, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x06, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

Char guan64 [] = {
/* The following is the 64-dot-matrix simplified font of "irrigation", 512 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xc0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0xcf, 0xc0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1e, 0x07, 0xc0, 0x00,
0x00, 0x00, 0x00, 0x03, 0xf8, 0x07, 0x80, 0x00,
0x00, 0x04, 0x00, 0x03, 0xf8, 0x0f, 0x00, 0x00,
0x00, 0x06, 0x00, 0x03, 0xf0, 0x18, 0x00, 0x00,
0x00, 0x07, 0x00, 0x01, 0xf0, 0x30, 0x00, 0x00,
0x00, 0x07, 0x80, 0x01, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x03, 0xc0, 0x01, 0xf0, 0x00, 0x00, 0x00,
0x00, 0x03, 0xe0, 0x00, 0x00, 0x06, 0x00, 0x00,
0x00, 0x03, 0xf0, 0x00, 0x00, 0x0f, 0xe0, 0x00,
0x00, 0x07, 0xf0, 0x00, 0x00, 0x3f, 0xc0, 0x00,
0x00, 0x07, 0xe0, 0x00, 0x01, 0xff, 0x00, 0x00,
0x00, 0x0f, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00,
0x00, 0x0c, 0x00, 0x00, 0x7f, 0xc0, 0x00, 0x00,
0x00, 0x08, 0x00, 0x03, 0xff, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x0f, 0xf0, 0x07, 0xc0, 0x00,
0x00, 0x00, 0x00, 0x3f, 0x40, 0x0f, 0xc0, 0x00,
0x00, 0x00, 0x00, 0x18, 0x80, 0x3f, 0x80, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x7f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x0f, 0xfc, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x1f, 0xf8, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0e, 0x23, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0e, 0xc3, 0xe0, 0x00, 0x00,
0x00, 0x80, 0x00, 0x1f, 0x87, 0xc0, 0x00, 0x00,
0x00, 0xc0, 0x00, 0x1f, 0x8f, 0x87, 0x80, 0x00,
0x00, 0x70, 0x02, 0x0f, 0x9f, 0x0f, 0x80, 0x00,
0x00, 0x7c, 0x02, 0x0f, 0xbe, 0x1c, 0xe0, 0x00,
0x00, 0x3e, 0x04, 0x07, 0xfc, 0x18, 0xe0, 0x00,
0x00, 0x3e, 0x04, 0x03, 0xf0, 0x1b, 0xc0, 0x00,
0x00, 0x3e, 0x0c, 0x01, 0xe0, 0x1f, 0x80, 0x00,
0x00, 0x1c, 0x08, 0x03, 0xc0, 0x1f, 0x00, 0x00,
0x00, 0x18, 0x18, 0x07, 0x80, 0x7c, 0x00, 0x00,
0x00, 0x18, 0x38, 0x0f, 0x01, 0xfc, 0x00, 0x00,
0x00, 0x18, 0x30, 0x1f, 0x07, 0xdc, 0x00, 0x00,
0x00, 0x30, 0x70, 0x3f, 0x1f, 0x0c, 0x00, 0x00,
0x00, 0x30, 0x70, 0x7b, 0x38, 0x0c, 0x00, 0x00,
0x00, 0x30, 0xe0, 0xf3, 0x60, 0x0c, 0x00, 0x00,
0x00, 0x30, 0xe1, 0xe3, 0x00, 0x0e, 0x00, 0x00,
0x00, 0x71, 0xc3, 0xe3, 0x00, 0x3e, 0x00, 0x00,
0x00, 0x71, 0xc3, 0xc3, 0x00, 0x6e, 0x00, 0x00,
0x00, 0x73, 0x83, 0xc3, 0x00, 0xce, 0x00, 0x00,
0x00, 0x77, 0x80, 0x07, 0x00, 0x9e, 0x00, 0x00,
0x00, 0x77, 0x80, 0x07, 0x00, 0x9c, 0x00, 0x00,
0x00, 0x7f, 0x00, 0x07, 0x00, 0x9c, 0x00, 0x00,
0x00, 0x7f, 0x00, 0x07, 0x00, 0xbc, 0x00, 0x00,
0x00, 0x7e, 0x00, 0x07, 0x00, 0xfc, 0x00, 0x00,
0x00, 0x7e, 0x00, 0x07, 0x00, 0xfc, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x07, 0x00, 0xff, 0x00, 0x00,
0x00, 0x7c, 0x00, 0x06, 0x00, 0xde, 0x00, 0x00,
0x00, 0xfc, 0x00, 0x06, 0x00, 0x5c, 0x00, 0x00,
0x01, 0xf8, 0x00, 0x06, 0x00, 0x78, 0x00, 0x00,
0x00, 0xf8, 0x00, 0x0e, 0x00, 0x78, 0xf8, 0x00,
0x00, 0xf8, 0x00, 0x0e, 0x00, 0xff, 0xf8, 0x00,
0x00, 0x78, 0x00, 0x0e, 0x01, 0xff, 0xb0, 0x00,
0x00, 0x70, 0x00, 0x06, 0x01, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

Char matarray16k [] = {
/* The following is the 16-dot-matrix _ gb2312 font of 'Ta', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x08, 0x60, 0x08, 0x00,
0x00, 0x0c, 0x03, 0xf0, 0x18, 0x50, 0x30, 0x90,
0x11, 0x70, 0x11, 0xa8, 0x14, 0x58, 0x18, 0xb0,
0x13, 0x70, 0x04, 0x8c, 0x03, 0x04, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of the 'cheng', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0c, 0xfc,
0x3c, 0x88, 0x08, 0x88, 0x0e, 0x70, 0xf8, 0x18,
0x18, 0xe0, 0x1e, 0x20, 0x28, 0xf0, 0xc8, 0x20,
0x08, 0x3e, 0x09, 0xc0, 0x08, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of the 'sequence', 32 bytes */
0x00, 0x00, 0x00, 0x80, 0x00, 0x90, 0x0b, 0xe0,
0x0c, 0x00, 0x0b, 0xf0, 0x08, 0x40, 0x10, 0x80,
0x11, 0xfc, 0x1e, 0x88, 0x20, 0x80, 0x20, 0x80,
0x40, 0x80, 0x80, 0x80, 0x01, 0x80, 0x00, 0x80,
/* The following is the 16-dot-matrix _ _gb2312 font, 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x40,
0x00, 0xc0, 0x10, 0x80, 0x10, 0x80, 0x1f, 0x00,
0x10, 0x00, 0x10, 0x00, 0x10, 0x04, 0x10, 0x04,
0x08, 0x06, 0x07, 0xf8, 0x00, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of 'set', 32 bytes */
0x00, 0x00, 0x02, 0x80, 0x04, 0x10, 0x07, 0xe0,
0x0c, 0xe0, 0x17, 0x80, 0x05, 0xc0, 0x06, 0xb0,
0x0b, 0x40, 0x08, 0x9c, 0x1f, 0xe0, 0x23, 0x40,
0x05, 0x30, 0x09, 0x1c, 0x31, 0x00, 0x00, 0x00,
/* The following is a 16-dot-matrix _ gb2312 font of 'to', 32 bytes */
0x00, 0x00, 0x03, 0x00, 0x01, 0x30, 0x01, 0x10,
0x01, 0x00, 0x01, 0xc0, 0x1e, 0x80, 0x10, 0x90,
0x12, 0x90, 0x1e, 0x60, 0x12, 0x60, 0x22, 0x60,
0x26, 0x92, 0x45, 0x0a, 0x00, 0x06, 0x00, 0x00,
/* The following is the 16-dot-matrix _ _gb2312 font of '小', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x11, 0x18,
0x11, 0x0c, 0x21, 0x04, 0x21, 0x00, 0x01, 0x00,
0x07, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ _gb2312 font of the 'type', 32 bytes */
0x00, 0x00, 0x00, 0x08, 0x03, 0x08, 0x1e, 0x28,
0x0a, 0x48, 0x0f, 0xc8, 0x7a, 0x48, 0x0a, 0x08,
0x12, 0x18, 0x21, 0x08, 0x01, 0x40, 0x07, 0x80,
0x01, 0x00, 0x01, 0xf8, 0x3e, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of 'han', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x11, 0xf0,
0x02, 0x20, 0x04, 0x20, 0x62, 0x40, 0x29, 0x40,
0x10, 0x80, 0x11, 0x40, 0x22, 0x60, 0x64, 0x38,
0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of the 'word', 32 bytes */
0x00, 0x00, 0x01, 0x00, 0x01, 0x10, 0x11, 0xf8,
0x1e, 0x10, 0x20, 0xc0, 0x07, 0xc0, 0x00, 0x80,
0x01, 0x38, 0x1f, 0xc0, 0x20, 0x80, 0x00, 0x80,
0x00, 0x80, 0x00, 0x80, 0x01, 0x80, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of the 'library ', 32 bytes */
0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x01, 0xf0,
0x0e, 0x80, 0x08, 0xf0, 0x0b, 0x00, 0x09, 0x40,
0x0a, 0x78, 0x13, 0xc0, 0x10, 0x7e, 0x2f, 0xc0,
0x20, 0x40, 0x40, 0x40, 0x00, 0x40, 0x00, 0x40,
/* The following is the 16-dot-matrix _ _gb2312 font of ',', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00,
0x10, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ _gb2312 font of the 'core', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
0x7f, 0x40, 0x00, 0x20, 0x07, 0x20, 0x19, 0x20,
0x12, 0x20, 0x0e, 0x40, 0x00, 0x40, 0x00, 0x40,
0x00, 0x40, 0x00, 0xc0, 0x00, 0x40, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of 'taobao', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3d, 0x90,
0x24, 0x80, 0x24, 0x70, 0x25, 0x90, 0x25, 0x20,
0x35, 0xe0, 0x24, 0xa0, 0x24, 0xc0, 0x45, 0x42,
0x4e, 0x22, 0x88, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of 'off', 32 bytes */
0x00, 0x00, 0x03, 0x00, 0x01, 0x30, 0x1f, 0xc0,
0x00, 0xa0, 0x0f, 0xa0, 0x0a, 0xa0, 0x0f, 0xe0,
0x09, 0x00, 0x03, 0xf8, 0x1e, 0x88, 0x17, 0xc8,
0x14, 0x88, 0x10, 0x70, 0x10, 0x10, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of 'wen', 32 bytes */
0x00, 0x00, 0x02, 0x00, 0x01, 0x80, 0x00, 0x00,
0x00, 0x70, 0x07, 0x80, 0x18, 0x80, 0x01, 0x80,
0x05, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0xc0,
0x38, 0x70, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of the 'part', 32 bytes */
0x00, 0x00, 0x08, 0x40, 0x0c, 0x40, 0x08, 0x40,
0x11, 0x40, 0x11, 0xf0, 0x32, 0x40, 0x50, 0x44,
0x91, 0xf8, 0x12, 0x40, 0x10, 0x40, 0x10, 0x40,
0x10, 0x40, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ _gb2312 font of 's', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0c, 0x20,
0x08, 0x40, 0x10, 0x48, 0x1e, 0xfc, 0x23, 0x0c,
0x24, 0x8c, 0x3c, 0x48, 0x24, 0x08, 0x24, 0x08,
0x3c, 0x08, 0x00, 0x38, 0x00, 0x18, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of the branch, 32 bytes */
0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0xe0, 0x0f, 0x00, 0x01, 0x00, 0x01, 0xc0,
0x0e, 0x40, 0x08, 0x80, 0x06, 0x80, 0x01, 0x00,
0x02, 0xc0, 0x0c, 0x78, 0x30, 0x1c, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of 'Token', 32 bytes */
0x00, 0x00, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20,
0x08, 0x70, 0x3c, 0x20, 0x08, 0x3e, 0x0f, 0xd0,
0x08, 0x1c, 0x3b, 0xf0, 0xc9, 0x10, 0x08, 0x90,
0x08, 0x10, 0x18, 0x10, 0x00, 0x30, 0x00, 0x00,
/* The following is the 16-dot-matrix runtime _ gb2312 font of 'run', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x11, 0x80,
0x00, 0x00, 0x00, 0x78, 0x27, 0x80, 0x71, 0x80,
0x21, 0x20, 0x22, 0xf0, 0x23, 0x10, 0x20, 0x00,
0x5f, 0x80, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
/* The following is the 16-dot-matrix _ gb2312 font of the 'row', 32 bytes */
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0c, 0x38,
0x10, 0x40, 0x24, 0x00, 0x04, 0x1f, 0x0b, 0xf0,
0x18, 0x10, 0x28, 0x10, 0xc8, 0x10, 0x08, 0x10,
0x08, 0x10, 0x08, 0x70, 0x00, 0x20, 0x00, 0x00,
};

Void drawfont (Graphics g ){
Int I, J;

Drawmat (yi12, G, 12, 50, 20, 0 xffffff );
Drawmat (er12, G, 12, 50, 50, 0 xffffff );
Drawmat (dian12, G, 12, 50, 80, 0 xffffff );
Drawmat (zhen12, G, 12, 50,110, 0 xffffff );
Drawmat (song16, G, 16, 50,130, 0xff0000 );
Drawmat (ti16, G, 16, 50,150, 0xff0000 );
Drawmat (zi24, G, 24, 50,180, 0x0000ff );
Drawmat (mo24, G, 24, 50,200, 0x00ff00 );
Drawmat (guan48, G, 48, 50,250, 0x0000ff );
Drawmat (guan64, G, 64, 50,300, 0xff0000 );

// For (I = 0; I <15; I ++ ){
// Drawmat (matarray16k + I * 32, G, 16,200 + I * 15,200, 0 xffffff );
//}
// Drawmat (matarray16k + 8*32, G, 16,200 + I * 15,200, 0 xffffff );
// Drawmat (matarray16k + 9*32, G, 16,200 + (++ I) * 15,200, 0 xffffff );
// Drawmat (matarray16k + 10*32, G, 16,200 + (++ I) * 15,200, 0 xffffff );
// For (I = 18; I <25; I ++ ){
// Drawmat (matarray16k + (I-3) * 32, 16,200 + I * 15,200, 0 xffffff );
//}
}

Void drawmat (char [] mat, graphics g, int matsize, int X, int y, int color)
/* Sequence: modulo pointer, dot matrix size, starting coordinate (x, y), color */
{
Int I, j, k, n;
N = (matsize-1)/8 + 1;
For (j = 0; j <matsize; j ++ ){
For (I = 0; I <n; I ++ ){
For (k = 0; k <8; k ++ ){
If (! (MAT [J * n + I] & (0x80> K) = 0)/* the bit where the test is 1 is displayed */
{
G. setcolor (color );
G. drawline (x + I * 8 + k, Y + J, x + I * 8 + k, Y + J );
// Putpixel (x + I * 8 + k, Y + J, color );
}
// Else
// G. setcolor (0 xffffff );
}
}
}
}

Class fontcanvas extends canvas {
Protected void paint (Graphics g ){
G. setcolor (0x0 );
G. fillrect (0, 0, this. getwidth (), this. getheight ());
Drawfont (g );
}
}

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.