1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-07-31 02:19:50 +00:00
Files
gitlost a4f0fa0fd2 font_wip branch: new WIP font stuff using "stb_truetype.h",
not implemented for EAN/UPC, not fully tested
2026-07-27 12:21:19 +01:00

1852 lines
72 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* zfont.c - handle fonts */
/*
libzint - the open source barcode library
Copyright (C) 2026 Robin Stuart <rstuart114@gmail.com>
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.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
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 OWNER 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.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include "common.h"
#include "output.h"
#define STB_TRUETYPE_IMPLEMENTATION
#include "zfont.h"
#include "fonts/normal_ttf.h"
#include "fonts/normal_bold_ttf.h"
#include "fonts/upcean_ttf.h"
struct zfont_patch_info {
unsigned short offset;
signed char row;
unsigned char len;
signed char row2;
unsigned char len2;
};
static const unsigned char zfont_normal_14_info_idxs[188] = {
188, /* ! */ 188, /* " */ 0, /* # */ 1, /* $ */
2, /* % */ 3, /* & */ 188, /* ' */ 188, /* ( */
4, /* ) */ 5, /* * */ 6, /* + */ 188, /* , */
188, /* - */ 188, /* . */ 188, /* / */ 7, /* 0 */
8, /* 1 */ 9, /* 2 */ 10, /* 3 */ 11, /* 4 */
12, /* 5 */ 13, /* 6 */ 14, /* 7 */ 15, /* 8 */
16, /* 9 */ 188, /* : */ 188, /* ; */ 17, /* < */
188, /* = */ 18, /* > */ 19, /* ? */ 20, /* @ */
21, /* A */ 22, /* B */ 23, /* C */ 24, /* D */
25, /* E */ 26, /* F */ 27, /* G */ 28, /* H */
29, /* I */ 30, /* J */ 31, /* K */ 188, /* L */
32, /* M */ 33, /* N */ 34, /* O */ 35, /* P */
36, /* Q */ 37, /* R */ 38, /* S */ 39, /* T */
188, /* U */ 40, /* V */ 188, /* W */ 41, /* X */
42, /* Y */ 188, /* Z */ 188, /* [ */ 188, /* \ */
188, /* ] */ 43, /* ^ */ 188, /* _ */ 44, /* ` */
45, /* a */ 46, /* b */ 47, /* c */ 48, /* d */
49, /* e */ 50, /* f */ 51, /* g */ 52, /* h */
188, /* i */ 188, /* j */ 53, /* k */ 188, /* l */
54, /* m */ 55, /* n */ 56, /* o */ 57, /* p */
58, /* q */ 59, /* r */ 60, /* s */ 61, /* t */
62, /* u */ 63, /* v */ 188, /* w */ 64, /* x */
188, /* y */ 65, /* z */ 66, /* { */ 188, /* | */
67, /* } */ 68, /* ~ */ 188, /* ¡ */ 69, /* ¢ */
70, /* £ */ 71, /* ¤ */ 72, /* ¥ */ 188, /* ¦ */
73, /* § */ 74, /* ¨ */ 75, /* © */ 76, /* ª */
77, /* « */ 188, /* ¬ */ 78, /* ® */ 188, /* ¯ */
79, /* ° */ 80, /* ± */ 81, /* ² */ 82, /* ³ */
83, /* ´ */ 84, /* µ */ 188, /* ¶ */ 85, /* · */
188, /* ¸ */ 188, /* ¹ */ 86, /* º */ 87, /* » */
188, /* ¼ */ 188, /* ½ */ 88, /* ¾ */ 188, /* ¿ */
89, /* À */ 90, /* Á */ 91, /* Â */ 92, /* Ã */
93, /* Ä */ 94, /* Å */ 95, /* Æ */ 96, /* Ç */
97, /* È */ 98, /* É */ 99, /* Ê */ 100, /* Ë */
101, /* Ì */ 102, /* Í */ 103, /* Î */ 104, /* Ï */
105, /* Ð */ 106, /* Ñ */ 107, /* Ò */ 108, /* Ó */
109, /* Ô */ 110, /* Õ */ 111, /* Ö */ 112, /* × */
113, /* Ø */ 114, /* Ù */ 115, /* Ú */ 116, /* Û */
117, /* Ü */ 118, /* Ý */ 188, /* Þ */ 119, /* ß */
120, /* à */ 121, /* á */ 122, /* â */ 123, /* ã */
124, /* ä */ 125, /* å */ 126, /* æ */ 127, /* ç */
128, /* è */ 129, /* é */ 130, /* ê */ 131, /* ë */
132, /* ì */ 133, /* í */ 134, /* î */ 135, /* ï */
136, /* ð */ 137, /* ñ */ 138, /* ò */ 139, /* ó */
140, /* ô */ 141, /* õ */ 142, /* ö */ 143, /* ÷ */
144, /* ø */ 145, /* ù */ 146, /* ú */ 147, /* û */
148, /* ü */ 149, /* ý */ 188, /* þ */ 150, /* ÿ */
};
static const struct zfont_patch_info zfont_normal_14_infos[] = {
{ 0, 1, 24, 0, 0 }, /* # */
{ 3, 1, 80, 0, 0 }, /* $ */
{ 13, 0, 20, 5, 8 }, /* % */
{ 17, 0, 30, 5, 8 }, /* & */
{ 22, 1, 52, 0, 0 }, /* ) */
{ 29, 4, 6, 0, 0 }, /* * */
{ 30, 1, 8, 3, 16 }, /* + */
{ 33, 0, 16, 0, 0 }, /* 0 */
{ 35, 0, 14, 8, 4 }, /* 1 */
{ 38, 1, 4, 0, 0 }, /* 2 */
{ 39, 1, 48, 8, 8 }, /* 3 */
{ 46, 2, 8, 5, 24 }, /* 4 */
{ 50, 1, 4, 0, 0 }, /* 5 */
{ 51, 1, 4, 4, 4 }, /* 6 */
{ 53, 1, 8, 0, 0 }, /* 7 */
{ 54, 1, 32, 8, 8 }, /* 8 */
{ 59, 0, 64, 0, 0 }, /* 9 */
{ 67, 3, 4, 6, 8 }, /* < */
{ 69, 2, 16, 5, 8 }, /* > */
{ 72, 7, 4, 0, 0 }, /* ? */
{ 73, 4, 72, 12, 4 }, /* @ */
{ 83, 3, 30, 8, 20 }, /* A */
{ 90, 0, 16, 3, 24 }, /* B */
{ 95, 0, 20, 3, 8 }, /* C */
{ 99, 0, 16, 0, 0 }, /* D */
{ 101, 1, 2, 4, 2 }, /* E */
{ 103, 1, 2, 6, 2 }, /* F */
{ 105, 0, 34, 6, 30 }, /* G */
{ 114, 4, 8, 0, 0 }, /* H */
{ 115, 0, 20, 0, 0 }, /* I */
{ 118, 1, 6, 8, 6 }, /* J */
{ 120, 5, 14, 0, 0 }, /* K */
{ 122, 0,100, 0, 0 }, /* M */
{ 135, 2, 8, 0, 0 }, /* N */
{ 136, 0, 44, 6, 12 }, /* O */
{ 144, 1, 8, 6, 8 }, /* P */
{ 146, 0, 44, 6, 22 }, /* Q */
{ 155, 1, 36, 0, 0 }, /* R */
{ 160, 0, 24, 7, 8 }, /* S */
{ 164, 1, 8, 0, 0 }, /* T */
{ 165, 1, 60, 9, 8 }, /* V */
{ 174, 0, 40, 6, 40 }, /* X */
{ 184, 0, 40, 5, 8 }, /* Y */
{ 190, 3, 8, 0, 0 }, /* ^ */
{ 191, 1, 8, 0, 0 }, /* ` */
{ 192, 1, 40, 7, 4 }, /* a */
{ 198, 5, 8, 0, 0 }, /* b */
{ 199, 6, 8, 0, 0 }, /* c */
{ 200, 4, 22, 8, 8 }, /* d */
{ 204, 3, 8, 0, 0 }, /* e */
{ 205, 2, 16, 0, 0 }, /* f */
{ 207, 1, 34, 8, 14 }, /* g */
{ 214, 4, 14, 0, 0 }, /* h */
{ 216, 9, 16, 0, 0 }, /* k */
{ 218, 3, 14, 0, 0 }, /* m */
{ 220, 1, 8, 0, 0 }, /* n */
{ 221, 2, 8, 0, 0 }, /* o */
{ 222, 1, 16, 0, 0 }, /* p */
{ 224, 1, 24, 5, 8 }, /* q */
{ 228, 2, 8, 0, 0 }, /* r */
{ 229, 1, 8, 0, 0 }, /* s */
{ 230, 2, 4, 0, 0 }, /* t */
{ 231, 5, 8, 0, 0 }, /* u */
{ 232, 4, 4, 0, 0 }, /* v */
{ 233, 6, 14, 0, 0 }, /* x */
{ 235, 2, 6, 0, 0 }, /* z */
{ 236, 13, 4, 0, 0 }, /* { */
{ 237, 1, 64, 0, 0 }, /* } */
{ 245, 1, 16, 0, 0 }, /* ~ */
{ 247, 1, 21, 7, 14 }, /* ¢ */
{ 252, 0, 16, 7, 24 }, /* £ */
{ 257, 0, 56, 0, 0 }, /* ¤ */
{ 264, 0, 72, 0, 0 }, /* ¥ */
{ 273, 2, 42, 0, 0 }, /* § */
{ 279, 0, 8, 0, 0 }, /* ¨ */
{ 280, 0, 44, 6, 44 }, /* © */
{ 292, 0, 6, 2, 18 }, /* ª */
{ 296, 1, 40, 0, 0 }, /* « */
{ 301, 0, 8, 3, 64 }, /* ® */
{ 310, 0, 10, 0, 0 }, /* ° */
{ 312, 1, 32, 8, 8 }, /* ± */
{ 317, 5, 5, 0, 0 }, /* ² */
{ 318, 1, 15, 5, 5 }, /* ³ */
{ 321, 2, 4, 0, 0 }, /* ´ */
{ 322, 5, 24, 0, 0 }, /* µ */
{ 325, 0, 4, 0, 0 }, /* · */
{ 326, 0, 10, 5, 5 }, /* º */
{ 329, 1, 24, 0, 0 }, /* » */
{ 332, 3, 32, 0, 0 }, /* ¾ */
{ 336, 0, 16, -3, 0 }, /* À */
{ 338, 0, 16, -3, 0 }, /* Á */
{ 340, 0, 16, -3, 0 }, /* Â */
{ 342, 0, 20, -3, 0 }, /* Ã */
{ 345, 0, 16, -2, 0 }, /* Ä */
{ 347, 0, 40, -3, 0 }, /* Å */
{ 352, 9, 4, 0, 0 }, /* Æ */
{ 353, 0, 40, 11, 20 }, /* Ç */
{ 361, 0, 16, -3, 0 }, /* È */
{ 363, 0, 16, -3, 0 }, /* É */
{ 365, 0, 16, -3, 0 }, /* Ê */
{ 367, 0, 16, -2, 0 }, /* Ë */
{ 369, 0, 39, 0, 0 }, /* Ì */
{ 374, 0, 52, 0, 0 }, /* Í */
{ 381, 0, 78, 0, 0 }, /* Î */
{ 391, 0, 48, 0, 0 }, /* Ï */
{ 397, 0, 20, 4, 10 }, /* Ð */
{ 402, 0, 16, 0, 0 }, /* Ñ */
{ 404, 0, 22, -3, 0 }, /* Ò */
{ 407, 0, 22, -3, 0 }, /* Ó */
{ 410, 0, 22, -3, 0 }, /* Ô */
{ 413, 0, 22, -3, 0 }, /* Õ */
{ 416, 0, 8, -2, 0 }, /* Ö */
{ 417, 0, 48, 0, 0 }, /* × */
{ 423, 1, 44, 7, 44 }, /* Ø */
{ 435, 0, 16, -3, 0 }, /* Ù */
{ 437, 0, 16, -3, 0 }, /* Ú */
{ 439, 0, 16, -3, 0 }, /* Û */
{ 441, 0, 16, -2, 0 }, /* Ü */
{ 443, 0, 16, -3, 0 }, /* Ý */
{ 445, 5, 8, 0, 0 }, /* ß */
{ 0, 0, 0, -3, 0 }, /* à */
{ 0, 0, 0, -3, 0 }, /* á */
{ 446, 1, 16, -3, 0 }, /* â */
{ 448, 1, 16, -3, 0 }, /* ã */
{ 450, 0, 16, -2, 0 }, /* ä */
{ 452, 1, 24, -4, 0 }, /* å */
{ 455, 1, 48, 7, 12 }, /* æ */
{ 463, 6, 7, 0, 0 }, /* ç */
{ 0, 0, 0, -3, 0 }, /* è */
{ 0, 0, 0, -3, 0 }, /* é */
{ 0, 0, 0, -3, 0 }, /* ê */
{ 464, 0, 16, -2, 0 }, /* ë */
{ 466, 1, 30, 0, 0 }, /* ì */
{ 470, 4, 28, 0, 0 }, /* í */
{ 474, 1, 12, 4, 40 }, /* î */
{ 481, 0, 40, 0, 0 }, /* ï */
{ 486, 1, 48, 9, 8 }, /* ð */
{ 493, 1, 14, -3, 0 }, /* ñ */
{ 0, 0, 0, -3, 0 }, /* ò */
{ 0, 0, 0, -3, 0 }, /* ó */
{ 0, 0, 0, -3, 0 }, /* ô */
{ 495, 1, 16, -3, 0 }, /* õ */
{ 497, 0, 16, -2, 0 }, /* ö */
{ 499, 0, 16, 3, 8 }, /* ÷ */
{ 502, 1, 63, 0, 0 }, /* ø */
{ 0, 0, 0, -3, 0 }, /* ù */
{ 0, 0, 0, -3, 0 }, /* ú */
{ 0, 0, 0, -3, 0 }, /* û */
{ 510, 0, 14, -2, 0 }, /* ü */
{ 512, 1, 14, 0, 0 }, /* ý */
{ 514, 1, 7, 0, 0 }, /* ÿ */
};
static const unsigned char zfont_normal_14_patches[] = {
0x24, 0x24, 0x7E, /* # */
0x10, 0x3C, 0x52, 0x50, 0x38, 0x14, 0x12, 0x12, 0x54, 0x38, /* $ */
0x30, 0x04, 0x80, 0x36, /* % */
0x18, 0x09, 0x02, 0x40, 0x39, /* & */
0x8C, 0x46, 0x22, 0x22, 0x26, 0x4C, 0x80, /* ) */
0x48, /* * */
0x00, 0x08, 0x3E, /* + */
0x3C, 0x66, /* 0 */
0x30, 0xA0, 0x10, /* 1 */
0x20, /* 2 */
0x24, 0x42, 0x02, 0x04, 0x18, 0x04, 0x42, /* 3 */
0x14, 0x24, 0x44, 0x7E, /* 4 */
0x40, /* 5 */
0x20, 0x50, /* 6 */
0x02, /* 7 */
0x66, 0x42, 0x42, 0x24, 0x42, /* 8 */
0x3C, 0x66, 0x42, 0x42, 0x66, 0x3A, 0x02, 0x02, /* 9 */
0x30, 0x0C, /* < */
0x30, 0x0C, 0x0C, /* > */
0x10, /* ? */
0x26, 0x92, 0x4C, 0xA4, 0x25, 0x21, 0x29, 0x1A, 0x47, 0x1F, /* @ */
0x22, 0x08, 0x82, 0x20, 0x80, 0xA0, 0x20, /* A */
0xFC, 0x86, 0x84, 0xF8, 0x84, /* B */
0x1F, 0x0C, 0x60, 0x40, /* C */
0xFC, 0x43, /* D */
0x80, 0x80, /* E */
0x81, 0x81, /* F */
0x1F, 0x0C, 0x66, 0x09, 0x00, 0x40, 0x58, 0x13, 0x18, /* G */
0x81, /* H */
0x55, 0x55, 0x50, /* I */
0x04, 0x4D, /* J */
0xD0, 0x44, /* K */
0xC0, 0xF0, 0x3E, 0x1E, 0x85, 0xA1, 0x64, 0x99, 0x26, 0x79, 0x8C, 0x63, 0x10, /* M */
0xA1, /* N */
0x1F, 0x06, 0x31, 0x83, 0x20, 0x20, 0x40, 0x4C, /* O */
0x86, 0x80, /* P */
0x1F, 0x06, 0x31, 0x83, 0x20, 0x20, 0x40, 0x4C, 0x18, /* Q */
0x86, 0x41, 0x20, 0x90, 0x4F, /* R */
0x1C, 0x11, 0x90, 0x00, /* S */
0x08, /* T */
0xC1, 0x90, 0x44, 0x11, 0x8C, 0x22, 0x08, 0x81, 0x08, /* V */
0x40, 0x98, 0x63, 0x30, 0x48, 0x12, 0x0C, 0xC6, 0x19, 0x02, /* X */
0x41, 0x10, 0x42, 0x20, 0xD8, 0x08, /* Y */
0x44, /* ^ */
0x62, /* ` */
0x3C, 0x46, 0x02, 0x3E, 0x42, 0x3B, /* a */
0x42, /* b */
0x44, /* c */
0x3E, 0x85, 0x0A, 0x42, /* d */
0x42, /* e */
0x44, 0x74, /* f */
0x3C, 0x85, 0x0A, 0x14, 0x24, 0x02, 0x88, /* g */
0x7C, 0x85, /* h */
0x44, 0x42, /* k */
0x44, 0x28, /* m */
0x3C, /* n */
0x66, /* o */
0x3C, 0x42, /* p */
0x3C, 0x8D, 0x0A, 0x42, /* q */
0x42, /* r */
0x7C, /* s */
0x46, /* t */
0x42, /* u */
0x28, /* v */
0x44, 0x88, /* x */
0x04, /* z */
0x30, /* { */
0xC2, 0x10, 0x84, 0x30, 0xCC, 0x42, 0x10, 0x8C, /* } */
0x32, 0x4C, /* ~ */
0x08, 0x79, 0x8A, 0x62, 0x78, /* ¢ */
0x18, 0x24, 0x20, 0x40, 0x7C, /* £ */
0x44, 0x7C, 0x6C, 0x44, 0x6C, 0x7C, 0x44, /* ¤ */
0x41, 0x11, 0x0D, 0x82, 0x80, 0x81, 0xF0, 0x20, 0x7C, /* ¥ */
0x42, 0x80, 0xE1, 0x34, 0x2C, 0x87, /* § */
0x52, /* ¨ */
0x1E, 0x04, 0x21, 0x32, 0x49, 0x29, 0x92, 0x49, 0x90, 0x84, 0x0F, 0x00, /* © */
0x21, 0x31, 0x47, 0x00, /* ª */
0x12, 0x24, 0x48, 0x24, 0x12, /* « */
0x1E, 0x92, 0x52, 0x4A, 0x71, 0x49, 0x25, 0x28, 0x42, /* ® */
0x32, 0x52, /* ° */
0x00, 0x10, 0x10, 0x7C, 0x7C, /* ± */
0x70, /* ² */
0x50, 0x88, 0x60, /* ³ */
0xC0, /* ´ */
0x42, 0x66, 0x7A, /* µ */
0xA0, /* · */
0x72, 0xA1, 0x70, /* º */
0x48, 0x24, 0x12, /* » */
0x21, 0x01, 0x24, 0x64, /* ¾ */
0x18, 0x03, /* À */
0x04, 0x02, /* Á */
0x08, 0x05, /* Â */
0x0A, 0x05, 0x80, /* Ã */
0x14, 0x00, /* Ä */
0x08, 0x05, 0x00, 0x80, 0x20, /* Å */
0x41, /* Æ */
0x1F, 0x0C, 0x66, 0x09, 0x00, 0x02, 0x01, 0x80, /* Ç */
0x10, 0x08, /* È */
0x08, 0x10, /* É */
0x18, 0x24, /* Ê */
0x28, 0x00, /* Ë */
0x44, 0x12, 0x49, 0x24, 0x92, /* Ì */
0x12, 0x02, 0x22, 0x22, 0x22, 0x22, 0x20, /* Í */
0x10, 0xA0, 0x04, 0x10, 0x41, 0x04, 0x10, 0x41, 0x04, 0x10, /* Î */
0x50, 0x22, 0x22, 0x22, 0x22, 0x22, /* Ï */
0x7E, 0x10, 0xC6, 0x40, 0xBE, /* Ð */
0x14, 0x2C, /* Ñ */
0x08, 0x00, 0x80, /* Ò */
0x02, 0x00, 0x80, /* Ó */
0x04, 0x01, 0x40, /* Ô */
0x05, 0x01, 0x60, /* Õ */
0x0A, /* Ö */
0x42, 0x24, 0x18, 0x18, 0x24, 0x42, /* × */
0x1F, 0x46, 0x11, 0x85, 0x21, 0x23, 0x48, 0x4A, 0x18, 0x86, 0x2F, 0x80, /* Ø */
0x10, 0x04, /* Ù */
0x08, 0x08, /* Ú */
0x18, 0x12, /* Û */
0x28, 0x00, /* Ü */
0x04, 0x02, /* Ý */
0x48, /* ß */
0x18, 0x24, /* â */
0x14, 0x2C, /* ã */
0x00, 0x14, /* ä */
0x08, 0x14, 0x08, /* å */
0x3F, 0xC4, 0x62, 0x06, 0x23, 0xFC, 0x39, 0xC0, /* æ */
0x44, /* ç */
0x00, 0x28, /* ë */
0x88, 0x24, 0x92, 0x48, /* ì */
0x44, 0x44, 0x44, 0x40, /* í */
0x10, 0xA0, 0x10, 0x41, 0x04, 0x10, 0x41, /* î */
0x05, 0x02, 0x22, 0x22, 0x22, /* ï */
0x14, 0x08, 0x14, 0x02, 0x3E, 0x66, 0x66, /* ð */
0x14, 0x58, /* ñ */
0x14, 0x2C, /* õ */
0x00, 0x28, /* ö */
0x00, 0x10, 0x7C, /* ÷ */
0x3A, 0x22, 0x12, 0x89, 0x45, 0x21, 0x11, 0x70, /* ø */
0x00, 0x50, /* ü */
0x08, 0x20, /* ý */
0x28, /* ÿ */
};
static const char zfont_normal_14_bases[64] = {
'A', 'A', 'A', 'A', 'A', 'A', 0 , 0 , 'E', 'E', 'E', 'E', 0 , 0 , 0 , 0 , /*C0-CF*/
0 , 0 , 'O', 'O', 'O', 'O', 'O', 0 , 0 , 'U', 'U', 'U', 'U', 'Y', 0 , 0 , /*D0-DF*/
'a', 'a', 'a', 'a', 'a', 'a', 0 , 0 , 'e', 'e', 'e', 'e', 0 , 0 , 0 , 0 , /*E0-EF*/
0 , 'n', 'o', 'o', 'o', 'o', 'o', 0 , 0 , 'u', 'u', 'u', 'u', 0 , 0 , 0 , /*F0-FF*/
};
static const unsigned char zfont_bold_14_info_idxs[188] = {
0, /* ! */ 1, /* " */ 2, /* # */ 3, /* $ */
4, /* % */ 5, /* & */ 6, /* ' */ 7, /* ( */
188, /* ) */ 8, /* * */ 9, /* + */ 188, /* , */
10, /* - */ 188, /* . */ 188, /* / */ 11, /* 0 */
12, /* 1 */ 13, /* 2 */ 14, /* 3 */ 15, /* 4 */
16, /* 5 */ 17, /* 6 */ 188, /* 7 */ 18, /* 8 */
19, /* 9 */ 188, /* : */ 20, /* ; */ 21, /* < */
22, /* = */ 23, /* > */ 24, /* ? */ 25, /* @ */
26, /* A */ 27, /* B */ 28, /* C */ 29, /* D */
30, /* E */ 31, /* F */ 32, /* G */ 188, /* H */
188, /* I */ 188, /* J */ 33, /* K */ 188, /* L */
188, /* M */ 34, /* N */ 35, /* O */ 188, /* P */
36, /* Q */ 37, /* R */ 38, /* S */ 188, /* T */
39, /* U */ 40, /* V */ 188, /* W */ 41, /* X */
42, /* Y */ 43, /* Z */ 44, /* [ */ 188, /* \ */
188, /* ] */ 45, /* ^ */ 188, /* _ */ 188, /* ` */
188, /* a */ 188, /* b */ 188, /* c */ 188, /* d */
46, /* e */ 47, /* f */ 48, /* g */ 188, /* h */
188, /* i */ 188, /* j */ 188, /* k */ 188, /* l */
188, /* m */ 188, /* n */ 49, /* o */ 50, /* p */
51, /* q */ 188, /* r */ 52, /* s */ 188, /* t */
188, /* u */ 53, /* v */ 188, /* w */ 54, /* x */
188, /* y */ 188, /* z */ 55, /* { */ 188, /* | */
56, /* } */ 57, /* ~ */ 188, /* ¡ */ 58, /* ¢ */
59, /* £ */ 60, /* ¤ */ 61, /* ¥ */ 62, /* ¦ */
63, /* § */ 188, /* ¨ */ 64, /* © */ 65, /* ª */
66, /* « */ 188, /* ¬ */ 67, /* ® */ 188, /* ¯ */
68, /* ° */ 69, /* ± */ 70, /* ² */ 71, /* ³ */
72, /* ´ */ 188, /* µ */ 73, /* ¶ */ 188, /* · */
188, /* ¸ */ 188, /* ¹ */ 74, /* º */ 75, /* » */
188, /* ¼ */ 76, /* ½ */ 77, /* ¾ */ 78, /* ¿ */
79, /* À */ 80, /* Á */ 81, /* Â */ 82, /* Ã */
83, /* Ä */ 84, /* Å */ 85, /* Æ */ 86, /* Ç */
87, /* È */ 88, /* É */ 89, /* Ê */ 90, /* Ë */
91, /* Ì */ 92, /* Í */ 93, /* Î */ 188, /* Ï */
94, /* Ð */ 95, /* Ñ */ 96, /* Ò */ 97, /* Ó */
98, /* Ô */ 99, /* Õ */ 100, /* Ö */ 188, /* × */
101, /* Ø */ 102, /* Ù */ 103, /* Ú */ 104, /* Û */
105, /* Ü */ 106, /* Ý */ 188, /* Þ */ 188, /* ß */
188, /* à */ 107, /* á */ 108, /* â */ 188, /* ã */
188, /* ä */ 109, /* å */ 110, /* æ */ 111, /* ç */
112, /* è */ 113, /* é */ 114, /* ê */ 115, /* ë */
188, /* ì */ 116, /* í */ 117, /* î */ 188, /* ï */
118, /* ð */ 119, /* ñ */ 120, /* ò */ 121, /* ó */
122, /* ô */ 123, /* õ */ 124, /* ö */ 125, /* ÷ */
126, /* ø */ 127, /* ù */ 188, /* ú */ 128, /* û */
188, /* ü */ 129, /* ý */ 188, /* þ */ 188, /* ÿ */
};
static const struct zfont_patch_info zfont_bold_14_infos[] = {
{ 0, 0, 3, 0, 0 }, /* ! */
{ 1, 3, 6, 0, 0 }, /* " */
{ 2, 0, 32, 7, 8 }, /* # */
{ 7, 3, 16, 7, 32 }, /* $ */
{ 13, 0, 23, 3, 91 }, /* % */
{ 28, 2, 4, 0, 0 }, /* & */
{ 29, 1, 3, 0, 0 }, /* ' */
{ 30, 2, 60, 0, 0 }, /* ( */
{ 38, 4, 6, 0, 0 }, /* * */
{ 39, 1, 8, 4, 16 }, /* + */
{ 42, 0, 10, 0, 0 }, /* - */
{ 44, 0, 16, 5, 8 }, /* 0 */
{ 47, 8, 8, 0, 0 }, /* 1 */
{ 48, 0, 8, 9, 8 }, /* 2 */
{ 50, 0, 8, 0, 0 }, /* 3 */
{ 51, 0, 80, 0, 0 }, /* 4 */
{ 61, 7, 4, 0, 0 }, /* 5 */
{ 62, 0, 12, 0, 0 }, /* 6 */
{ 64, 0, 8, 5, 8 }, /* 8 */
{ 66, 0, 8, 6, 8 }, /* 9 */
{ 68, 9, 3, 0, 0 }, /* ; */
{ 69, 5, 8, 7, 8 }, /* < */
{ 71, 2, 8, 4, 8 }, /* = */
{ 73, 1, 24, 5, 24 }, /* > */
{ 79, 0, 8, 0, 0 }, /* ? */
{ 80, 0,104, 10, 24 }, /* @ */
{ 96, 3, 8, 7, 30 }, /* A */
{ 101, 0, 8, 5, 40 }, /* B */
{ 107, 0, 8, 7, 8 }, /* C */
{ 109, 0, 8, 7, 8 }, /* D */
{ 111, 9, 9, 0, 0 }, /* E */
{ 113, 4, 8, 0, 0 }, /* F */
{ 114, 0, 8, 7, 32 }, /* G */
{ 119, 1, 40, 8, 20 }, /* K */
{ 127, 0, 10, 0, 0 }, /* N */
{ 129, 0, 8, 7, 4 }, /* O */
{ 129, 0, 8, 7, 4 }, /* Q */
{ 131, 1, 20, 6, 40 }, /* R */
{ 139, 0, 8, 0, 0 }, /* S */
{ 140, 0, 10, 9, 8 }, /* U */
{ 143, 0, 80, 0, 0 }, /* V */
{ 153, 0,100, 0, 0 }, /* X */
{ 166, 0, 40, 5, 8 }, /* Y */
{ 172, 2, 16, 9, 4 }, /* Z */
{ 175, 1, 5, 13, 5 }, /* [ */
{ 177, 1, 32, 0, 0 }, /* ^ */
{ 181, 3, 8, 0, 0 }, /* e */
{ 182, 3, 5, 0, 0 }, /* f */
{ 183, 1, 8, 8, 24 }, /* g */
{ 187, 6, 8, 0, 0 }, /* o */
{ 188, 1, 8, 5, 24 }, /* p */
{ 188, 1, 8, 0, 0 }, /* q */
{ 188, 1, 6, 0, 0 }, /* s */
{ 192, 1, 8, 4, 8 }, /* v */
{ 194, 3, 8, 7, 8 }, /* x */
{ 196, 1, 48, 12, 12 }, /* { */
{ 204, 8, 6, 12, 6 }, /* } */
{ 206, 0, 16, 0, 0 }, /* ~ */
{ 208, 0, 16, 3, 56 }, /* ¢ */
{ 217, 0, 24, 8, 8 }, /* £ */
{ 221, 1, 16, 6, 8 }, /* ¤ */
{ 224, 3, 8, 0, 0 }, /* ¥ */
{ 225, 5, 8, 0, 0 }, /* ¦ */
{ 226, 0, 48, 9, 16 }, /* § */
{ 234, 0, 44, 6, 32 }, /* © */
{ 244, 0, 8, 3, 12 }, /* ª */
{ 247, 3, 8, 0, 0 }, /* « */
{ 248, 0, 44, 5, 44 }, /* ® */
{ 260, 1, 5, 3, 5 }, /* ° */
{ 262, 0, 32, 8, 8 }, /* ± */
{ 267, 3, 8, 0, 0 }, /* ² */
{ 268, 0, 8, 0, 0 }, /* ³ */
{ 269, 1, 8, 0, 0 }, /* ´ */
{ 270, 0, 8, 4, 8 }, /* ¶ */
{ 272, 2, 15, 0, 0 }, /* º */
{ 274, 3, 16, 0, 0 }, /* » */
{ 276, 0, 12, 5, 24 }, /* ½ */
{ 281, 0, 24, 3, 12 }, /* ¾ */
{ 285, 1, 24, 7, 24 }, /* ¿ */
{ 291, 0, 30, -3, 0 }, /* À */
{ 295, 0, 30, -3, 0 }, /* Á */
{ 299, 0, 20, -3, 0 }, /* Â */
{ 302, 0, 20, -3, 0 }, /* Ã */
{ 305, 1, 8, -2, 0 }, /* Ä */
{ 306, 0, 40, -3, 0 }, /* Å */
{ 311, 4, 14, 0, 0 }, /* Æ */
{ 313, 0, 30, 7, 60 }, /* Ç */
{ 325, 0, 27, -3, 0 }, /* È */
{ 328, 0, 27, -3, 0 }, /* É */
{ 331, 0, 27, -3, 0 }, /* Ê */
{ 335, 1, 8, -2, 0 }, /* Ë */
{ 336, 0, 15, 0, 0 }, /* Ì */
{ 338, 0, 15, 0, 0 }, /* Í */
{ 340, 1, 8, 0, 0 }, /* Î */
{ 341, 0, 8, 7, 8 }, /* Ð */
{ 343, 0, 20, -3, 0 }, /* Ñ */
{ 346, 0, 33, -3, 0 }, /* Ò */
{ 350, 0, 8, -3, 0 }, /* Ó */
{ 351, 0, 32, -3, 0 }, /* Ô */
{ 355, 0, 22, -3, 0 }, /* Õ */
{ 358, 0, 8, -2, 0 }, /* Ö */
{ 359, 1,110, 0, 0 }, /* Ø */
{ 373, 0, 30, -3, 0 }, /* Ù */
{ 377, 0, 20, -3, 0 }, /* Ú */
{ 380, 1, 8, -3, 0 }, /* Û */
{ 0, 0, 0, -2, 0 }, /* Ü */
{ 381, 0, 30, -3, 0 }, /* Ý */
{ 385, 1, 16, -3, 0 }, /* á */
{ 387, 1, 8, 0, 0 }, /* â */
{ 388, 1, 24, 0, 0 }, /* å */
{ 391, 1, 36, 6, 12 }, /* æ */
{ 398, 8, 8, 0, 0 }, /* ç */
{ 399, 1, 16, -3, 0 }, /* è */
{ 0, 0, 0, -3, 0 }, /* é */
{ 401, 1, 8, -3, 0 }, /* ê */
{ 0, 0, 0, -2, 0 }, /* ë */
{ 402, 2, 5, 0, 0 }, /* í */
{ 403, 1, 6, 0, 0 }, /* î */
{ 404, 1, 54, 9, 16 }, /* ð */
{ 413, 1, 16, 0, 0 }, /* ñ */
{ 415, 0, 0, -3, 0 }, /* ò */
{ 0, 0, 0, -3, 0 }, /* ó */
{ 416, 1, 16, -3, 0 }, /* ô */
{ 418, 1, 16, -3, 0 }, /* õ */
{ 0, 0, 0, -2, 0 }, /* ö */
{ 420, 1, 32, 6, 16 }, /* ÷ */
{ 426, 6, 12, 0, 0 }, /* ø */
{ 428, 1, 16, 0, 0 }, /* ù */
{ 430, 1, 8, 0, 0 }, /* û */
{ 431, 2, 8, 0, 0 }, /* ý */
};
static const unsigned char zfont_bold_14_patches[] = {
0xDB, /* ! */
0x6C, /* " */
0x12, 0x12, 0x24, 0x7E, 0x24, /* # */
0x56, 0x70, 0x16, 0xD2, 0x7E, 0x18, /* $ */
0x00, 0x41, 0x84, 0x49, 0x03, 0xD3, 0x0D, 0xBC, 0x09, 0x20, 0x89, 0x0C, 0x78, 0x41, 0x80, /* % */
0x12, /* & */
0x49, /* ' */
0x63, 0x31, 0x8C, 0x63, 0x18, 0xC3, 0x18, 0x60, /* ( */
0xD8, /* * */
0x00, 0x7E, 0x7E, /* + */
0x7B, 0xC0, /* - */
0x3C, 0x7E, 0x66, /* 0 */
0x7E, /* 1 */
0x38, 0x7E, /* 2 */
0x38, /* 3 */
0x06, 0x0E, 0x1E, 0x36, 0x26, 0x66, 0x46, 0x7F, 0x06, 0x06, /* 4 */
0x66, /* 5 */
0x38, 0x7C, /* 6 */
0x3C, 0x3C, /* 8 */
0x38, 0x06, /* 9 */
0xC0, /* ; */
0x70, 0x07, /* < */
0x7F, 0x7F, /* = */
0x70, 0x3C, 0x07, 0x07, 0x3C, 0x70, /* > */
0x1C, /* ? */
0x0F, 0xC0, 0xC3, 0x0C, 0x0C, 0xCF, 0xB4, 0xCC, 0xAC, 0x45, 0x62, 0x6B, 0x12, 0x30, 0x60, 0xFE, /* @ */
0x12, 0x3F, 0x18, 0x66, 0x18, /* A */
0x7E, 0x7E, 0x18, 0x46, 0x19, 0xFE, /* B */
0x1F, 0x71, /* C */
0x7E, 0x63, /* D */
0x7F, 0x00, /* E */
0x7F, /* F */
0x1F, 0x70, 0xC7, 0xF8, 0x7E, /* G */
0x63, 0x19, 0x86, 0xC1, 0xE0, 0x61, 0x98, 0x30, /* K */
0x61, 0x80, /* N */
0x1F, 0x71, /* O & Q */
0x7F, 0x18, 0xE6, 0x7E, 0x18, 0xC6, 0x19, 0x83, /* R */
0x1C, /* S */
0x61, 0x98, 0x3F, /* U */
0x41, 0x10, 0x46, 0x31, 0x8C, 0x77, 0x0D, 0x83, 0x60, 0xF8, /* V */
0x31, 0x8C, 0x61, 0xB0, 0x7C, 0x0E, 0x03, 0x81, 0xF0, 0x6C, 0x31, 0x8C, 0x60, /* X */
0x40, 0x98, 0x63, 0x30, 0xCC, 0x0C, /* Y */
0x03, 0x03, 0x7F, /* Z */
0x7B, 0x78, /* [ */
0x18, 0x24, 0x24, 0x66, /* ^ */
0x66, /* e */
0x67, /* f */
0x3E, 0x03, 0x66, 0x7C, /* g */
0x36, /* o */
0x3E, 0x73, 0x76, 0x6E, /* p, q & s */
0x42, 0x24, /* v */
0x18, 0x42, /* x */
0x1C, 0xE3, 0x0C, 0x31, 0xC6, 0x1C, 0x38, 0x70, /* { */
0x38, 0x73, /* } */
0x3A, 0x6E, /* ~ */
0x10, 0x10, 0x64, 0x40, 0x40, 0x64, 0x3C, 0x10, 0x10, /* ¢ */
0x1C, 0x36, 0x60, 0xC6, /* £ */
0x42, 0x3C, 0x3C, /* ¤ */
0x24, /* ¥ */
0xCF, /* ¦ */
0x3C, 0x66, 0x60, 0x78, 0x3E, 0x66, 0x66, 0x3C, /* § */
0x1E, 0x04, 0x21, 0x32, 0x29, 0x40, 0x52, 0x89, 0x90, 0x84, /* © */
0x70, 0x51, 0xA0, /* ª */
0x48, /* « */
0x1E, 0x04, 0x21, 0x02, 0x2F, 0x40, 0x9C, 0x4A, 0x51, 0x02, 0x10, 0x80, /* ® */
0x4A, 0x30, /* ° */
0x00, 0x18, 0x18, 0x7E, 0x00, /* ± */
0x43, /* ² */
0x70, /* ³ */
0x33, /* ´ */
0x3E, 0x34, /* ¶ */
0x52, 0x88, /* º */
0x12, 0x36, /* » */
0x20, 0x00, 0x06, 0xC0, 0x42, /* ½ */
0x70, 0x01, 0x08, 0x13, /* ¾ */
0x08, 0x00, 0x08, 0x42, 0x66, 0x3C, /* ¿ */
0x18, 0x03, 0x00, 0x00, /* À */
0x06, 0x03, 0x00, 0x00, /* Á */
0x0C, 0x04, 0x80, /* Â */
0x0A, 0x05, 0x80, /* Ã */
0x00, /* Ä */
0x04, 0x02, 0x80, 0x40, 0x30, /* Å */
0x1B, 0xF8, /* Æ */
0x1F, 0x0F, 0xE7, 0x18, 0x71, 0x8F, 0xE1, 0xF0, 0x10, 0x02, 0x01, 0x80, /* Ç */
0x18, 0x06, 0x00, /* È */
0x0C, 0x0C, 0x00, /* É */
0x0C, 0x09, 0x00, 0x00, /* Ê */
0x00, /* Ë */
0x61, 0x80, /* Ì */
0x33, 0x00, /* Í */
0x48, /* Î */
0x7E, 0x63, /* Ð */
0x0A, 0x05, 0x80, /* Ñ */
0x0C, 0x00, 0xC0, 0x00, /* Ò */
0x03, /* Ó */
0x04, 0x01, 0x40, 0x00, /* Ô */
0x0D, 0x02, 0x60, /* Õ */
0x09, /* Ö */
0x1F, 0x47, 0xF9, 0xC6, 0x31, 0xE6, 0x6C, 0xD9, 0x9E, 0x31, 0x8E, 0x7F, 0x8B, 0xE0, /* Ø */
0x18, 0x03, 0x00, 0x00, /* Ù */
0x06, 0x03, 0x00, /* Ú */
0x12, /* Û */
0x06, 0x03, 0x00, 0x00, /* Ý */
0x0C, 0x18, /* á */
0x18, /* â */
0x10, 0x28, 0x10, /* å */
0x3F, 0xE6, 0x63, 0x07, 0x37, 0x6F, 0x77, /* æ */
0x10, /* ç */
0x30, 0x18, /* è */
0x18, /* ê */
0x60, /* í */
0x30, /* î */
0x19, 0x03, 0x02, 0xC0, 0xE3, 0xF3, 0xB9, 0x77, 0x1F, /* ð */
0x1A, 0x26, /* ñ */
0x0C, /* ò */
0x18, 0x12, /* ô */
0x1A, 0x13, /* õ */
0x00, 0x18, 0x00, 0x7E, 0x18, 0x00, /* ÷ */
0x36, 0x2E, /* ø */
0x30, 0x18, /* ù */
0x18, /* û */
0x18, /* ý */
};
static const char zfont_bold_14_bases[64] = {
'A', 'A', 'A', 'A', 'A', 'A', 0 , 0 , 'E', 'E', 'E', 'E', 0 , 0 , 0 , 0 , /*C0-CF*/
0 , 'N', 'O', 'O', 'O', 'O', 'O', 0 , 0 , 'U', 'U', 'U', 'U', 'Y', 0 , 0 , /*D0-DF*/
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 'e', 'e', 'e', 'e', 0 , 0 , 0 , 0 , /*E0-EF*/
0 , 0 , 'o', 'o', 'o', 'o', 'o', 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , /*F0-FF*/
};
static const struct zfont_patch_info zfont_normal_10_infos[188] = {
{ 0, 0, 0, 0, 0 }, /* ! */
{ 0, 0, 8, 0, 0 }, /* " */
{ 1, 1, 6, 3, 24 }, /* # */
{ 5, 1, 40, 0, 0 }, /* $ */
{ 10, 0, 62, 0, 0 }, /* % */
{ 18, 1, 7, 5, 14 }, /* & */
{ 21, 0, 4, 0, 0 }, /* ' */
{ 22, 4, 12, 0, 0 }, /* ( */
{ 24, 1, 3, 0, 0 }, /* ) */
{ 25, 0, 16, 0, 0 }, /* * */
{ 27, 2, 16, 0, 0 }, /* + */
{ 0, 0, 0, 0, 0 }, /* , */
{ 0, 0, 0, 0, 0 }, /* - */
{ 0, 0, 0, 0, 0 }, /* . */
{ 29, 2, 3, 5, 3 }, /* / */
{ 31, 2, 16, 0, 0 }, /* 0 */
{ 33, 2, 30, 0, 0 }, /* 1 */
{ 37, 0, 4, 0, 0 }, /* 2 */
{ 37, 0, 4, 0, 0 }, /* 3 */
{ 38, 0, 42, 0, 0 }, /* 4 */
{ 44, 3, 6, 0, 0 }, /* 5 */
{ 45, 3, 6, 0, 0 }, /* 6 */
{ 0, 0, 0, 0, 0 }, /* 7 */
{ 46, 0, 24, 6, 6 }, /* 8 */
{ 50, 0, 18, 4, 6 }, /* 9 */
{ 0, 0, 0, 0, 0 }, /* : */
{ 0, 0, 0, 0, 0 }, /* ; */
{ 54, 0, 12, 3, 12 }, /* < */
{ 58, 2, 6, 0, 0 }, /* = */
{ 59, 0, 12, 3, 12 }, /* > */
{ 63, 0, 2, 0, 0 }, /* ? */
{ 64, 1, 60, 8, 8 }, /* @ */
{ 73, 0, 21, 4, 21 }, /* A */
{ 79, 2, 7, 0, 0 }, /* B */
{ 80, 0, 14, 5, 14 }, /* C */
{ 84, 0, 7, 2, 7 }, /* D */
{ 0, 0, 0, 0, 0 }, /* E */
{ 0, 0, 0, 0, 0 }, /* F */
{ 86, 0, 8, 3, 8 }, /* G */
{ 88, 0, 8, 0, 0 }, /* H */
{ 0, 0, 0, 0, 0 }, /* I */
{ 0, 0, 0, 0, 0 }, /* J */
{ 89, 3, 7, 0, 0 }, /* K */
{ 0, 0, 0, 0, 0 }, /* L */
{ 90, 0, 8, 2, 24 }, /* M */
{ 95, 0, 42, 0, 0 }, /* N */
{ 101, 0, 16, 5, 8 }, /* O */
{ 104, 3, 7, 0, 0 }, /* P */
{ 101, 0, 16, 0, 0 }, /* Q */
{ 0, 0, 0, 0, 0 }, /* R */
{ 105, 6, 7, 0, 0 }, /* S */
{ 106, 0, 1, 0, 0 }, /* T */
{ 107, 0, 28, 0, 0 }, /* U */
{ 111, 0, 7, 3, 21 }, /* V */
{ 115, 1, 40, 6, 8 }, /* W */
{ 121, 0, 20, 5, 7 }, /* X */
{ 125, 0, 7, 3, 7 }, /* Y */
{ 127, 6, 6, 0, 0 }, /* Z */
{ 128, 1, 3, 9, 3 }, /* [ */
{ 130, 6, 3, 0, 0 }, /* \ */
{ 131, 1, 3, 9, 3 }, /* ] */
{ 133, 2, 8, 0, 0 }, /* ^ */
{ 0, 0, 0, 0, 0 }, /* _ */
{ 134, 2, 3, 0, 0 }, /* ` */
{ 135, 1, 4, 3, 16 }, /* a */
{ 135, 3, 4, 0, 0 }, /* b */
{ 138, 1, 4, 3, 4 }, /* c */
{ 140, 3, 15, 7, 5 }, /* d */
{ 143, 1, 16, 5, 6 }, /* e */
{ 146, 1, 9, 0, 0 }, /* f */
{ 148, 1, 15, 5, 5 }, /* g */
{ 151, 3, 5, 0, 0 }, /* h */
{ 152, 1, 2, 0, 0 }, /* i */
{ 153, 1, 3, 0, 0 }, /* j */
{ 0, 0, 0, 0, 0 }, /* k */
{ 0, 0, 0, 0, 0 }, /* l */
{ 154, 1, 8, 0, 0 }, /* m */
{ 155, 1, 10, 0, 0 }, /* n */
{ 157, 1, 16, 5, 6 }, /* o */
{ 160, 1, 6, 5, 6 }, /* p */
{ 162, 1, 5, 3, 15 }, /* q */
{ 0, 0, 0, 0, 0 }, /* r */
{ 165, 1, 5, 0, 0 }, /* s */
{ 166, 0, 6, 0, 0 }, /* t */
{ 167, 5, 5, 0, 0 }, /* u */
{ 168, 1, 5, 4, 5 }, /* v */
{ 170, 2, 18, 5, 8 }, /* w */
{ 174, 2, 5, 5, 5 }, /* x */
{ 176, 4, 5, 0, 0 }, /* y */
{ 177, 1, 5, 5, 5 }, /* z */
{ 179, 1, 4, 0, 0 }, /* { */
{ 0, 0, 0, 0, 0 }, /* | */
{ 180, 1, 4, 9, 4 }, /* } */
{ 182, 0, 12, 0, 0 }, /* ~ */
{ 0, 0, 0, 0, 0 }, /* ¡ */
{ 184, 1, 10, 5, 8 }, /* ¢ */
{ 0, 0, 0, 0, 0 }, /* £ */
{ 187, 0, 12, 3, 12 }, /* ¤ */
{ 191, 0, 14, 5, 7 }, /* ¥ */
{ 194, 4, 6, 0, 0 }, /* ¦ */
{ 195, 1, 5, 6, 5 }, /* § */
{ 0, 0, 0, 0, 0 }, /* ¨ */
{ 197, 1, 48, 0, 0 }, /* © */
{ 203, 0, 16, 0, 0 }, /* ª */
{ 205, 1, 18, 0, 0 }, /* « */
{ 208, 1, 6, 0, 0 }, /* ¬ */
{ 209, 1, 48, 0, 0 }, /* ® */
{ 215, 0, 7, 0, 0 }, /* ¯ */
{ 216, 0, 12, 0, 0 }, /* ° */
{ 218, 0, 18, 5, 6 }, /* ± */
{ 222, 3, 8, 0, 0 }, /* ² */
{ 223, 0, 20, 0, 0 }, /* ³ */
{ 226, 0, 6, 0, 0 }, /* ´ */
{ 227, 4, 6, 0, 0 }, /* µ */
{ 228, 1, 35, 0, 0 }, /* ¶ */
{ 0, 0, 0, 0, 0 }, /* · */
{ 233, 1, 6, 0, 0 }, /* ¸ */
{ 234, 0, 16, 0, 0 }, /* ¹ */
{ 236, 0, 16, 0, 0 }, /* º */
{ 238, 1, 16, 0, 0 }, /* » */
{ 240, 0, 56, 0, 0 }, /* ¼ */
{ 247, 0, 63, 0, 0 }, /* ½ */
{ 255, 0, 56, 0, 0 }, /* ¾ */
{ 262, 0, 16, 0, 0 }, /* ¿ */
{ 264, 0, 12, -2, 0 }, /* À */
{ 266, 0, 12, -2, 0 }, /* Á */
{ 268, 0, 12, -2, 0 }, /* Â */
{ 270, 0, 12, -2, 0 }, /* Ã */
{ 272, 0, 6, -2, 0 }, /* Ä */
{ 273, 0, 12, -2, 0 }, /* Å */
{ 0, 0, 0, 0, 0 }, /* Æ */
{ 275, 0, 14, 9, 4 }, /* Ç */
{ 264, 0, 12, 0, 0 }, /* È */
{ 278, 0, 12, 0, 0 }, /* É */
{ 280, 0, 12, 0, 0 }, /* Ê */
{ 272, 0, 6, 0, 0 }, /* Ë */
{ 282, 0, 6, 0, 0 }, /* Ì */
{ 283, 0, 6, 0, 0 }, /* Í */
{ 283, 1, 6, 0, 0 }, /* Î */
{ 284, 0, 4, 0, 0 }, /* Ï */
{ 285, 0, 7, 2, 7 }, /* Ð */
{ 287, 0, 14, -2, 0 }, /* Ñ */
{ 289, 0, 16, -2, 0 }, /* Ò */
{ 291, 0, 16, -2, 0 }, /* Ó */
{ 293, 0, 16, -2, 0 }, /* Ô */
{ 295, 0, 16, -2, 0 }, /* Õ */
{ 297, 0, 6, -2, 0 }, /* Ö */
{ 0, 0, 0, 0, 0 }, /* × */
{ 298, 1, 32, 6, 16 }, /* Ø */
{ 304, 0, 14, -2, 0 }, /* Ù */
{ 306, 0, 14, -2, 0 }, /* Ú */
{ 308, 0, 14, -2, 0 }, /* Û */
{ 310, 0, 7, -2, 0 }, /* Ü */
{ 311, 0, 14, -2, 0 }, /* Ý */
{ 313, 1, 7, 5, 7 }, /* Þ */
{ 0, 0, 0, 0, 0 }, /* ß */
{ 315, 0, 12, -2, 0 }, /* à */
{ 317, 0, 12, -2, 0 }, /* á */
{ 319, 0, 12, -2, 0 }, /* â */
{ 321, 0, 12, -2, 0 }, /* ã */
{ 323, 0, 6, -1, 0 }, /* ä */
{ 324, 0, 16, -3, 0 }, /* å */
{ 326, 1, 8, 3, 27 }, /* æ */
{ 331, 1, 15, 7, 8 }, /* ç */
{ 334, 0, 12, -2, 0 }, /* è */
{ 336, 0, 12, -2, 0 }, /* é */
{ 338, 0, 12, -2, 0 }, /* ê */
{ 340, 0, 6, -1, 0 }, /* ë */
{ 341, 0, 5, 0, 0 }, /* ì */
{ 342, 0, 5, 0, 0 }, /* í */
{ 343, 0, 10, 0, 0 }, /* î */
{ 345, 0, 5, 0, 0 }, /* ï */
{ 346, 1, 6, 3, 16 }, /* ð */
{ 349, 0, 10, -2, 0 }, /* ñ */
{ 351, 0, 12, -2, 0 }, /* ò */
{ 353, 0, 12, -2, 0 }, /* ó */
{ 355, 0, 12, -2, 0 }, /* ô */
{ 357, 0, 12, -2, 0 }, /* õ */
{ 359, 0, 6, -1, 0 }, /* ö */
{ 360, 0, 16, 4, 6 }, /* ÷ */
{ 363, 1, 16, 0, 0 }, /* ø */
{ 365, 0, 10, -2, 0 }, /* ù */
{ 367, 0, 8, -2, 0 }, /* ú */
{ 368, 0, 10, -2, 0 }, /* û */
{ 370, 0, 5, -1, 0 }, /* ü */
{ 371, 0, 8, -2, 0 }, /* ý */
{ 372, 3, 6, 7, 6 }, /* þ */
{ 374, 0, 0, -1, 0 }, /* ÿ */
};
static const unsigned char zfont_normal_10_patches[] = {
0xAA, /* " */
0x29, 0x29, 0xE5, 0x14, /* # */
0x10, 0xE5, 0x0E, 0x19, 0x63, /* $ */
0x22, 0x2A, 0x09, 0x01, 0x01, 0x20, 0xA8, 0x88, /* % */
0x48, 0x48, 0x78, /* & */
0xA0, /* ' */
0x88, 0x84, /* ( */
0x89, /* ) */
0x4E, 0x4A, /* * */
0x21, 0xC2, /* + */
0x29, 0x52, /* / */
0x49, 0x24, /* 0 */
0x20, 0x82, 0x08, 0x70, /* 1 */
0x30, /* 2 and 3 */
0x08, 0x61, 0x8A, 0x78, 0x20, 0x80, /* 4 */
0x78, /* 5 */
0x71, /* 6 */
0x31, 0x24, 0x8C, 0x30, /* 8 */
0x31, 0x24, 0x92, 0x38, /* 9 */
0x10, 0x84, 0x20, 0x41, /* < */
0x78, /* = */
0x20, 0x41, 0x10, 0x82, /* > */
0x31, /* ? */
0x1F, 0x08, 0x24, 0xE9, 0x4A, 0x52, 0x97, 0x64, 0x3E, /* @ */
0x30, 0x61, 0x21, 0x79, 0x0A, 0x10, /* A */
0x44, /* B */
0x38, 0x89, 0x44, 0x70, /* C */
0x78, 0x42, /* D */
0x3C, 0x46, /* G */
0x44, /* H */
0x60, /* K */
0x41, 0x63, 0x55, 0x55, 0x49, /* M */
0x44, 0xC9, 0x92, 0xA4, 0xC9, 0x91, /* N */
0x3C, 0x66, 0x66, /* O,Q */
0x7C, /* P */
0x38, /* S */
0x7C, /* T */
0x44, 0x89, 0x12, 0x24, /* U */
0x44, 0x44, 0x50, 0xA0, /* V */
0x88, 0x92, 0x25, 0x51, 0x54, 0x22, /* W */
0x44, 0x88, 0xA2, 0x44, /* X */
0x44, 0x10, /* Y */
0x78, /* Z */
0x69, 0x60, /* [ */
0x24, /* \ */
0xC9, 0xC0, /* ] */
0x00, /* ^ */
0x20, /* ` */
0x70, 0x39, 0x27, /* a */
0x70, 0x40, /* c */
0x3A, 0x52, 0x38, /* d */
0x31, 0x27, 0x38, /* e */
0x29, 0x80, /* f */
0x3A, 0x52, 0x78, /* g */
0x72, /* h */
0x45, /* i */
0x20, /* j */
0x7E, /* m */
0x5B, 0x52, /* n */
0x31, 0x24, 0x30, /* o */
0x71, 0x71, /* p */
0x3A, 0x4A, 0x4E, /* q */
0x32, /* s */
0x4D, /* t */
0x30, /* u */
0x52, 0x21, /* v */
0x49, 0x2A, 0x8D, 0x12, /* w */
0x21, 0x50, /* x */
0x21, /* y */
0x70, 0x70, /* z */
0x24, /* { */
0x84, 0x80, /* } */
0x29, 0x40, /* ~ */
0x21, 0x90, 0x31, /* ¢ */
0x49, 0xE4, 0x79, 0x20, /* ¤ */
0x44, 0x89, 0x38, /* ¥ */
0x45, /* ¦ */
0x3A, 0x38, /* § */
0x3C, 0x42, 0x5A, 0x52, 0x5A, 0x3C, /* © */
0x35, 0x70, /* ª */
0x25, 0x22, 0x40, /* « */
0x08, /* ¬ */
0x3C, 0x42, 0x5A, 0x52, 0x52, 0x3C, /* ® */
0x7C, /* ¯ */
0x4A, 0x40, /* ° */
0x00, 0x87, 0x00, 0x70, /* ± */
0x60, /* ² */
0x62, 0x62, 0x60, /* ³ */
0x28, /* ´ */
0x59, /* µ */
0x6B, 0x4A, 0x52, 0x94, 0xA0, /* ¶ */
0x28, /* ¸ */
0xC4, 0x4E, /* ¹ */
0x4A, 0xA4, /* º */
0x91, 0x29, /* » */
0xC2, 0x44, 0x48, 0x56, 0x2A, 0x4E, 0x02, /* ¼ */
0xC2, 0x22, 0x12, 0x0A, 0xC2, 0x22, 0x20, 0x18, /* ½ */
0xC2, 0x44, 0xC8, 0x56, 0xAA, 0x4E, 0x02, /* ¾ */
0x20, 0x02, /* ¿ */
0x20, 0x20, /* À */
0x10, 0x40, /* Á */
0x30, 0x90, /* Â */
0x28, 0xA0, /* Ã */
0x28, /* Ä */
0x10, 0x50, /* Å */
0x3C, 0x85, 0x10, /* Ç */
0x08, 0x20, /* É */
0x10, 0x50, /* Ê */
0x45, /* Ì */
0x51, /* Í */
/* Î */
0xA1, /* Ï */
0x78, 0x43, /* Ð */
0x14, 0x51, /* Ñ */
0x20, 0x10, /* Ò */
0x04, 0x08, /* Ó */
0x08, 0x14, /* Ô */
0x14, 0x28, /* Õ */
0x14, /* Ö */
0x3A, 0x44, 0x4A, 0x52, 0x22, 0x5C, /* Ø */
0x20, 0x20, /* Ù */
0x08, 0x20, /* Ú */
0x10, 0x50, /* Û */
0x28, /* Ü */
0x08, 0x20, /* Ý */
0x78, 0x78, /* Þ */
0x40, 0x87, /* à */
0x10, 0x87, /* á */
0x31, 0x27, /* â */
0x29, 0x47, /* ã */
0x28, /* ä */
0x10, 0xA1, /* å */
0x7F, 0x3F, 0x24, 0x1D, 0xC0, /* æ */
0x72, 0x10, 0x11, /* ç */
0x20, 0x40, /* è */
0x10, 0x80, /* é */
0x31, 0x20, /* ê */
0x28, /* ë */
0x88, /* ì */
0x28, /* í */
0x22, 0x80, /* î */
0xA0, /* ï */
0x28, 0x29, 0xE4, /* ð */
0x2A, 0x80, /* ñ */
0x20, 0x40, /* ò */
0x20, 0x40, /* ó */
0x31, 0x20, /* ô */
0x29, 0x40, /* õ */
0x28, /* ö */
0x10, 0x03, 0x10, /* ÷ */
0x29, 0x56, /* ø */
0x20, 0x80, /* ù */
0x11, /* ú */
0x22, 0x80, /* û */
0x28, /* ü */
0x11, /* ý */
0x71, 0x71, /* þ */
/* ÿ */
};
static const char zfont_normal_10_bases[64] = {
'A', 'A', 'A', 'A', 'A', 'A', 0 , 0 , 'E', 'E', 'E', 'E', 0 , 0 , 0 , 0 , /*C0-CF*/
0 , 'N', 'O', 'O', 'O', 'O', 'O', 0 , 0 , 'U', 'U', 'U', 'U', 'Y', 0 , 0 , /*D0-DF*/
'a', 'a', 'a', 'a', 'a', 'a', 0 , 0 , 'e', 'e', 'e', 'e', 0 , 0 , 0 , 0 , /*E0-EF*/
0 , 'n', 'o', 'o', 'o', 'o', 'o', 0 , 0 , 'u', 'u', 'u', 'u', 'y', 0 , 'y', /*F0-FF*/
};
static const unsigned char zfont_normal_21_info_idxs[] = {
188, /* ! */ 0, /* " */ 188, /* # */ 188, /* $ */
188, /* % */ 1, /* & */ 188, /* ' */ 188, /* ( */
188, /* ) */ 2, /* * */ 188, /* + */ 188, /* , */
188, /* - */ 188, /* . */ 188, /* / */ 3, /* 0 */
188, /* 1 */ 4, /* 2 */ 5, /* 3 */ 188, /* 4 */
6, /* 5 */ 7, /* 6 */ 188, /* 7 */ 8, /* 8 */
9, /* 9 */ 188, /* : */ 188, /* ; */ 188, /* < */
188, /* = */ 188, /* > */ 188, /* ? */ 188, /* @ */
10, /* A */ 11, /* B */ 12, /* C */ 188, /* D */
188, /* E */ 188, /* F */ 13, /* G */ 188, /* H */
188, /* I */ 188, /* J */ 188, /* K */ 188, /* L */
188, /* M */ 188, /* N */ 14, /* O */ 188, /* P */
15, /* Q */ 16, /* R */ 17, /* S */ 188, /* T */
18, /* U */ 188, /* V */ 19, /* W */
};
static const struct zfont_patch_info zfont_normal_21_infos[] = {
{ 0, 1, 28, 0, 0 }, /* " */
{ 4, 1, 14, 0, 0 }, /* & */
{ 6, 5, 8, 0, 0 }, /* * */
{ 7, 0, 55, 11, 44 }, /* 0 */
{ 20, 0, 30, 14, 10 }, /* 2 */
{ 26, 0, 32, 6, 88 }, /* 3 */
{ 41, 2, 64, 11, 32 }, /* 5 */
{ 53, 0, 8, 13, 8 }, /* 6 */
{ 55, 0, 32, 5,108 }, /* 8 */
{ 73, 0, 99, 13, 8 }, /* 9 */
{ 87, 1, 12, 3, 8 }, /* A */
{ 90, 6, 36, 14, 12 }, /* B */
{ 97, 0, 12, 13, 14 }, /* C */
{ 101, 0, 8, 13, 12 }, /* G */
{ 104, 0, 80, 10, 80 }, /* O */
{ 124, 0, 80, 10, 48 }, /* Q */
{ 140, 3, 42, 0, 0 }, /* R */
{ 146, 0, 8, 13, 12 }, /* S */
{ 149, 10, 64, 0, 0 }, /* U */
{ 157, 1, 32, 0, 0 }, /* W */
};
static const unsigned char zfont_normal_21_patches[] = {
0x66, 0xCD, 0x9B, 0x30, /* " */
0x07, 0x80, /* & */
0x18, /* * */
0x00, 0x03, 0xF0, 0xE7, 0x18, 0x67, 0x0E, 0x70, 0xE6, 0x18, 0xE7, 0x0F, 0xC0, /* 0 */
0x00, 0x0F, 0xC7, 0x38, 0xFF, 0x80, /* 2 */
0x00, 0x03, 0xF0, 0xE7, 0x03, 0x81, 0xE0, 0x0E, 0x00, 0x60, 0x06, 0xC0, 0xD8, 0x31, 0xCE, /* 3 */
0x60, 0x0C, 0x01, 0x80, 0x30, 0x07, 0xF8, 0xE3, 0x00, 0x6C, 0x18, 0xE7, /* 5 */
0x00, 0x33, /* 6 */
0x00, 0x03, 0xE0, 0xC6, 0x60, 0xC6, 0x30, 0x7C, 0x18, 0xC6, 0x0C, 0xC1, 0x98, 0x33, 0x06, 0x31, 0x83, 0xE0, /* 8 */
0x00, 0x03, 0xE0, 0xC6, 0x30, 0x66, 0x0C, 0xC1, 0x98, 0x33, 0x8E, 0x3F, 0xC0, 0x33, /* 9 */
0x03, 0x00, 0x04, /* A */
0x60, 0xC7, 0xF8, 0x60, 0xC0, 0x7F, 0xC0, /* B */
0x00, 0x00, 0x1C, 0xF0, /* C */
0x00, 0x1C, 0x78, /* G */
0x00, 0x00, 0x0F, 0xF0, 0x1C, 0x38, 0x30, 0x0C, 0x30, 0x0C, 0x60, 0x06, 0x30, 0x0C, 0x30, 0x0C, 0x1C, 0x38, 0x0F, 0xF0, /* O */
0x00, 0x00, 0x0F, 0xF0, 0x1C, 0x38, 0x30, 0x0C, 0x30, 0x0C, 0x60, 0x06, 0x30, 0x0C, 0x38, 0x1C, /* Q */
0x60, 0x39, 0x80, 0x66, 0x03, 0x80, /* R */
0x00, 0x38, 0x70, /* S */
0x60, 0x19, 0x81, 0x8C, 0x0C, 0x30, 0xC0, 0xFC, /* U */
0x40, 0x60, 0x66, 0x06, /* W */
};
static const unsigned char zfont_bold_21_info_idxs[] = {
188, /* ! */ 188, /* " */ 188, /* # */ 188, /* $ */
188, /* % */ 188, /* & */ 188, /* ' */ 188, /* ( */
188, /* ) */ 188, /* * */ 188, /* + */ 188, /* , */
188, /* - */ 188, /* . */ 188, /* / */ 0, /* 0 */
188, /* 1 */ 1, /* 2 */ 2, /* 3 */ 188, /* 4 */
188, /* 5 */ 3, /* 6 */ 188, /* 7 */ 4, /* 8 */
5, /* 9 */
};
static const struct zfont_patch_info zfont_bold_21_infos[] = {
{ 0, 0, 55, 11, 44 }, /* 0 */
{ 13, 0, 66, 9, 66 }, /* 2 */
{ 31, 0, 22, 8, 11 }, /* 3 */
{ 36, 0, 8, 0, 0 }, /* 6 */
{ 37, 0, 60, 6,108 }, /* 8 */
{ 59, 0, 33, 0, 0 }, /* 9 */
};
static const unsigned char zfont_bold_21_patches[] = {
0x00, 0x03, 0xF0, 0xFF, 0x1C, 0xE7, 0x0E, 0x70, 0xE7, 0x38, 0xFF, 0x0F, 0xC0, /* 0 */
0x00, 0x03, 0xE0, 0xFE, 0x38, 0xE6, 0x0C, 0x01, 0x80, 0x0E, 0x03, 0x80, 0xE0, 0x38, 0x07, 0xFC, 0xFF, 0x80, /* 2 */
0x00, 0x03, 0xF0, 0x0F, 0x80, /* 3 */
0x00, /* 6 */
0x00, 0x01, 0xF0, 0x3F, 0x87, 0x1C, 0x60, 0xC0, 0x3F, 0x81, 0xF0, 0x3F, 0x87, 0x1C, 0x60, 0xC6, 0x0C, 0x71, 0xC3, 0xF8, 0x1F, 0x00, /* 8 */
0x00, 0x03, 0xF0, 0xFF, 0x00, /* 9 */
};
static const unsigned char zfont_normal_28_info_idxs[] = {
188, /* ! */ 188, /* " */ 188, /* # */ 188, /* $ */
188, /* % */ 188, /* & */ 188, /* ' */ 188, /* ( */
188, /* ) */ 188, /* * */ 188, /* + */ 188, /* , */
188, /* - */ 188, /* . */ 188, /* / */ 0, /* 0 */
188, /* 1 */ 1, /* 2 */ 2, /* 3 */ 188, /* 4 */
188, /* 5 */ 3, /* 6 */ 188, /* 7 */ 4, /* 8 */
5, /* 9 */
};
static const struct zfont_patch_info zfont_normal_28_infos[] = {
{ 0, 1,182, 15, 28 }, /* 0 */
{ 27, 0, 8, 9, 12 }, /* 2 */
{ 30, 0, 98, 15, 12 }, /* 3 */
{ 45, 10, 28, 0, 0 }, /* 6 */
{ 49, 0,238, 19, 12 }, /* 8 */
{ 81, 0, 40, 6, 70 }, /* 9 */
};
static const unsigned char zfont_normal_28_patches[] = {
0x0F, 0xC0, 0x7F, 0x83, 0x87, 0x0C, 0x0C, 0x70, 0x39, 0x80, 0x66, 0x01, 0x98, 0x06, 0x60, 0x19, 0x80, 0x66, 0x01, 0x98, 0x06, 0x60, 0x18, 0x60, 0x19, 0xC0, 0xC0, /* 0 */
0x00, 0x00, 0xE0, /* 2 */
0x00, 0x00, 0x7F, 0x83, 0xFF, 0x1C, 0x1C, 0x60, 0x39, 0x80, 0xE0, 0x03, 0x80, 0xE0, 0x18, /* 3 */
0x70, 0x39, 0xC0, 0xE0, /* 6 */
0x00, 0x00, 0x7F, 0x83, 0xFF, 0x1C, 0x0E, 0x60, 0x19, 0x80, 0x66, 0x01, 0x9C, 0x0E, 0x38, 0x70, 0x7F, 0x81, 0xFE, 0x0E, 0x1C, 0x70, 0x39, 0x80, 0x66, 0x01, 0x98, 0x06, 0x60, 0x18, 0x1F, 0xE0, /* 8 */
0x00, 0x00, 0x7F, 0x03, 0xFE, 0x60, 0x39, 0x80, 0xE6, 0x03, 0x9C, 0x1E, 0x70, 0xF8, /* 9 */
};
static const struct zfont_patch_info zfont_upcean_20_infos[] = {
{ 0, 1, 44, 11, 55 }, /* 0 */
{ 0, 0, 0, 0, 0 }, /* 1 */
{ 13, 1, 30, 14, 20 }, /* 2 */
{ 20, 1, 22, 12, 44 }, /* 3 */
{ 29, 8, 32, 12, 8 }, /* 4 */
{ 34, 1, 4, 0, 0 }, /* 5 */
{ 35, 8, 33, 12, 4 }, /* 6 */
{ 34, 1, 4, 0, 0 }, /* 7 */
{ 41, 5, 64, 13, 8 }, /* 8 */
{ 50, 3, 55, 10, 8 }, /* 9 */
{ 0, 0, 0, 0, 0 }, /* : */
{ 0, 0, 0, 0, 0 }, /* ; */
{ 58, 1, 32, 7, 64 }, /* < */
{ 0, 0, 0, 0, 0 }, /* = */
{ 70, 0, 66, 9, 40 }, /* > */
};
static const unsigned char zfont_upcean_20_patches[] = {
0x1E, 0x07, 0xE1, 0x86, 0x30, 0xC0, 0xC0, 0xCC, 0x31, 0x86, 0x1F, 0x81, 0xE0, /* 0 */
0x1F, 0x0F, 0xE7, 0x1C, 0x7F, 0x8F, 0xF0, /* 2 */
0xFF, 0xDF, 0xF8, 0x00, 0xC0, 0x33, 0xFE, 0x3F, 0x80, /* 3 */
0x62, 0x0C, 0x63, 0x0C, 0xFF, /* 4 */
0x7F, /* 5 */
0x71, 0x9C, 0x1B, 0x03, 0x60, 0xC0, /* 6 */
0x73, 0x87, 0xE0, 0x78, 0x1F, 0x87, 0x39, 0xC3, 0xE1, /* 8 */
0xE1, 0xD8, 0x1B, 0x03, 0x60, 0x6E, 0x1C, 0x03, /* 9 */
0x03, 0xC0, 0xF0, 0x78, 0x70, 0x07, 0x80, 0x78, 0x03, 0xC0, 0x3C, 0x01, /* < */
0xC0, 0x1E, 0x01, 0xE0, 0x0F, 0x00, 0xF0, 0x07, 0x00, 0x1E, 0x0F, 0x03, 0xC0, 0x60, /* > */
};
#define rnd1dpf(arg) z_stripf(roundf((arg) * 10.0f) / 10.0f) /* Round to 1 decimal place */
#define ZFONT_UPCO_FONT_FACTOR 0.75f /* What to reduce UPC-E, UPC-A font by for outside chars */
/* Initialize a font */
INTERNAL int zint_font_init(struct zfont *zfnt, struct zint_symbol *symbol, const int upceanflag) {
const int bold = upceanflag ? 0 : symbol->output_options & BOLD_TEXT;
const unsigned char *const data = upceanflag ? upcean_ttf : bold ? normal_bold_ttf : normal_ttf;
memset(zfnt, 0, sizeof(*zfnt));
zfnt->upceanflag = upceanflag;
if (!stbtt_InitFont(&zfnt->info, data, 0 /*offset*/)) {
return z_errtxt(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, "Internal error: failed to initialize font");
}
zfnt->patch_info_idxs = NULL;
zfnt->patch_infos = NULL;
zfnt->patches = NULL;
zfnt->bases = NULL;
zfnt->upco_patch_infos = NULL;
zfnt->upco_patches = NULL;
zfnt->first_ch = 255;
zfnt->last_ch = 0;
if ((zfnt->space_glyph = stbtt_FindGlyphIndex(&zfnt->info, ' ')) == 0) {
zfnt->space_glyph = -1;
}
return 0;
}
/* Free any resources used */
INTERNAL void zint_font_free(struct zfont *zfnt, const int si) {
assert(zfnt);
if (si) {
const int upcea = zfnt->upceanflag == OUT_UPCEANFLAG_UPCE || zfnt->upceanflag == OUT_UPCEANFLAG_UPCA;
int i;
assert(zfnt->first_ch >= 0 && zfnt->last_ch <= 255);
for (i = zfnt->first_ch; i <= zfnt->last_ch; i++) {
if (zfnt->bitmaps[i]) {
free(zfnt->bitmaps[i]);
zfnt->bitmaps[i] = NULL;
}
}
if (upcea) {
for (i = 0; i < 10; i++) {
if (zfnt->upco_bitmaps[i]) {
free(zfnt->upco_bitmaps[i]);
zfnt->upco_bitmaps[i] = NULL;
}
}
}
}
}
static void zfont_set_patches(struct zfont *zfnt, struct zint_symbol *symbol) {
const int bold = zfnt->upceanflag ? 0 : symbol->output_options & BOLD_TEXT;
if (!zfnt->upceanflag) {
if (zfnt->font_height == 14) {
if (bold) {
zfnt->patch_info_idxs = zfont_bold_14_info_idxs;
zfnt->patch_info_idxs_size = (int) sizeof(zfont_bold_14_info_idxs);
zfnt->patch_infos = zfont_bold_14_infos;
zfnt->patches = zfont_bold_14_patches;
zfnt->bases = zfont_bold_14_bases;
} else {
zfnt->patch_info_idxs = zfont_normal_14_info_idxs;
zfnt->patch_info_idxs_size = (int) sizeof(zfont_normal_14_info_idxs);
zfnt->patch_infos = zfont_normal_14_infos;
zfnt->patches = zfont_normal_14_patches;
zfnt->bases = zfont_normal_14_bases;
}
} else if (zfnt->font_height == 10) {
if (bold) {
} else {
zfnt->patch_infos = zfont_normal_10_infos;
zfnt->patches = zfont_normal_10_patches;
zfnt->bases = zfont_normal_10_bases;
}
} else if (zfnt->font_height == 21) {
if (bold) {
zfnt->patch_info_idxs = zfont_bold_21_info_idxs;
zfnt->patch_info_idxs_size = (int) sizeof(zfont_bold_21_info_idxs);
zfnt->patch_infos = zfont_bold_21_infos;
zfnt->patches = zfont_bold_21_patches;
} else {
zfnt->patch_info_idxs = zfont_normal_21_info_idxs;
zfnt->patch_info_idxs_size = (int) sizeof(zfont_normal_21_info_idxs);
zfnt->patch_infos = zfont_normal_21_infos;
zfnt->patches = zfont_normal_21_patches;
}
} else if (zfnt->font_height == 28) {
if (bold) {
} else {
zfnt->patch_info_idxs = zfont_normal_28_info_idxs;
zfnt->patch_info_idxs_size = (int) sizeof(zfont_normal_28_info_idxs);
zfnt->patch_infos = zfont_normal_28_infos;
zfnt->patches = zfont_normal_28_patches;
}
}
} else {
if (zfnt->font_height == 20) {
zfnt->patch_infos = zfont_upcean_20_infos;
zfnt->patches = zfont_upcean_20_patches;
}
}
}
static float zfont_stb_hadvance(const struct zfont *zfnt, const int ch, const int next_ch, const int upco) {
float scaled_hadvance = 0.0f;
int advanceWidth, leftSideBearing;
if (upco) {
const int upco_ch = ch - '0';
assert(next_ch == 0);
if (zfnt->upco_glyphs[upco_ch] != -1) {
stbtt_GetGlyphHMetrics(&zfnt->info, zfnt->upco_glyphs[upco_ch], &advanceWidth, &leftSideBearing);
scaled_hadvance = z_stripf(advanceWidth * zfnt->upco_scale);
}
} else if (zfnt->glyphs[ch] != -1) {
stbtt_GetGlyphHMetrics(&zfnt->info, zfnt->glyphs[ch], &advanceWidth, &leftSideBearing);
if (next_ch && zfnt->glyphs[next_ch] != -1) {
const int kern_advance = stbtt_GetGlyphKernAdvance(&zfnt->info, zfnt->glyphs[ch], zfnt->glyphs[next_ch]);
scaled_hadvance = z_stripf((advanceWidth + kern_advance) * zfnt->scale);
} else {
scaled_hadvance = z_stripf(advanceWidth * zfnt->scale);
}
}
return scaled_hadvance;
}
static const struct zfont_patch_info *zfont_patch_info_get(const struct zfont *zfnt, const int ch) {
if (z_iscntrl(ch) || ch == ' ' || (!z_isascii(ch) && ch < 0xA0) || ch == 0xAD /*SHY*/) {
return NULL;
} else {
const unsigned char ch_idx = zfnt->upceanflag ? ch - '0'
: z_isascii(ch) ? ch - 0x21 : ch < 0xAD ? ch - 0x43 : ch - 0x44;
if (zfnt->patch_info_idxs) {
return ch_idx >= zfnt->patch_info_idxs_size || zfnt->patch_info_idxs[ch_idx] == 188
? NULL : zfnt->patch_infos + zfnt->patch_info_idxs[ch_idx];
}
return zfnt->patch_infos + ch_idx;
}
}
static const unsigned char *zfont_do_patch(const unsigned char *patch, const int len, unsigned char *pb,
unsigned char *const pbe) {
int i, j;
for (i = 0; i < len; i += 8) {
for (j = 0; j < 8 && j + i < len && pb < pbe; j++) {
*pb++ = '0' + ((*patch >> (7 - j)) & 1);
}
patch++;
}
return patch;
}
static void zfont_patch(struct zfont *zfnt, const int ch, int bitmap_dims[4], unsigned char *bitmap,
unsigned char *const pbe, const int upco) {
if (upco) {
if (zfnt->upco_patch_infos) {
}
}
if (zfnt->patch_infos) {
const struct zfont_patch_info *patch_info = zfont_patch_info_get(zfnt, ch);
if (patch_info) {
if (patch_info->len && patch_info->row >= 0) {
const int out_w = bitmap_dims[0];
unsigned char *pb = bitmap + patch_info->row * out_w;
const unsigned char *patch = zfnt->patches + patch_info->offset;
patch = zfont_do_patch(patch, patch_info->len, pb, pbe);
if (patch_info->len2 && patch_info->row2 >= 0) {
pb = bitmap + patch_info->row2 * out_w;
(void) zfont_do_patch(patch, patch_info->len2, pb, pbe);
}
}
}
if (ch >= 0xC0 && ch <= 0xFF && zfnt->bases && zfnt->bases[ch - 0xC0]) {
const int bch = zfnt->bases[ch - 0xC0];
const struct zfont_patch_info *bpatch_info = zfont_patch_info_get(zfnt, bch);
if (bpatch_info) {
const int brow = patch_info && patch_info->row2 < 0 ? -patch_info->row2 : 0;
const int out_w = bitmap_dims[0];
unsigned char *pb = bitmap + (bpatch_info->row + brow) * out_w;
const unsigned char *patch = zfnt->patches + bpatch_info->offset;
patch = zfont_do_patch(patch, bpatch_info->len, pb, pbe);
if (bpatch_info->len2 && bpatch_info->row2 >= 0) {
pb = bitmap + (bpatch_info->row2 + brow) * out_w;
(void) zfont_do_patch(patch, bpatch_info->len2, pb, pbe);
}
}
}
}
}
static int zfont_set_bitmap(struct zfont *zfnt, struct zint_symbol *symbol, const int ch, const float scale,
int *p_glyph, int bitmap_dims[4], unsigned char **p_bitmap, const int upco) {
int glyph = *p_glyph;
unsigned char *bitmap = NULL;
int xMin, yMin, xMax, yMax;
int out_w, out_h;
size_t out_wh;
stbtt_GetGlyphBitmapBoxSubpixel(&zfnt->info, glyph, scale, scale, 0.0f /*shift_x*/, 0.0f /*shift_y*/,
&xMin, &yMin, &xMax, &yMax);
bitmap_dims[0] = out_w = xMax - xMin;
bitmap_dims[1] = out_h = yMax - yMin;
bitmap_dims[2] = xMin;
bitmap_dims[3] = yMin;
out_wh = (size_t) out_h * out_w;
if (!out_wh) {
glyph = zfnt->space_glyph;
} else {
if (!(bitmap = malloc(out_wh))) {
return z_errtxt(ZINT_ERROR_MEMORY, symbol, 651, "Insufficient memory for glyph bitmap buffer");
}
if (!stbtt_MakeGlyphBitmapSubpixel(&zfnt->info, bitmap, out_w, out_h, out_w /*out_stride*/,
scale, scale, 0.0f /*shift_x*/, 0.0f /*shift_y*/, glyph)) {
return z_errtxtf(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0,
"Internal error: failed to get glyph bitmap (%d)", ch);
}
if (!zfnt->grayscale) {
unsigned char *pb = bitmap;
unsigned char *const pbe = pb + out_wh;
for (; pb < pbe; pb++) {
*pb = '0' + (*pb >= 0x80);
}
zfont_patch(zfnt, ch, bitmap_dims, bitmap, pbe, upco);
}
}
*p_glyph = glyph;
*p_bitmap = bitmap;
return 0;
}
static int zfont_set_glyph(struct zfont *zfnt, struct zint_symbol *symbol, const int si, const int ch) {
if (!zfnt->glyphs[ch]) {
if ((zfnt->glyphs[ch] = stbtt_FindGlyphIndex(&zfnt->info, ch)) == 0) {
zfnt->glyphs[ch] = zfnt->space_glyph;
} else if (si) {
int error_number;
if ((error_number = zfont_set_bitmap(zfnt, symbol, ch, zfnt->scale, &zfnt->glyphs[ch],
zfnt->bitmap_dims[ch], &zfnt->bitmaps[ch], 0 /*upco*/))) {
return error_number;
}
if (ch < zfnt->first_ch) {
zfnt->first_ch = ch;
}
if (ch > zfnt->last_ch) {
zfnt->last_ch = ch;
}
}
}
return 0;
}
static int zfont_upco_set_glyph(struct zfont *zfnt, struct zint_symbol *symbol, const int si, const int ch) {
const int upco_ch = ch - '0';
if (!zfnt->upco_glyphs[upco_ch]) {
if ((zfnt->upco_glyphs[upco_ch] = stbtt_FindGlyphIndex(&zfnt->info, upco_ch)) == 0) {
zfnt->upco_glyphs[upco_ch] = -1;
} else if (si) {
int error_number;
if ((error_number = zfont_set_bitmap(zfnt, symbol, ch, zfnt->upco_scale, &zfnt->upco_glyphs[upco_ch],
zfnt->upco_bitmap_dims[upco_ch], &zfnt->upco_bitmaps[upco_ch],
1 /*upco*/))) {
return error_number;
}
}
}
return 0;
}
/* Calculate various font metrics, and return total height of text */
INTERNAL int zint_font_text_height(struct zfont *zfnt, struct zint_symbol *symbol, const int si,
const float max_width, const unsigned char addon[6], const int addon_len) {
int error_number = 0;
const int small_text = symbol->output_options & SMALL_TEXT;
const int upcea = zfnt->upceanflag == OUT_UPCEANFLAG_UPCE || zfnt->upceanflag == OUT_UPCEANFLAG_UPCA;
const int ean2_5 = zfnt->upceanflag == OUT_UPCEANFLAG_EAN2 || zfnt->upceanflag == OUT_UPCEANFLAG_EAN5;
const int upcean_guard_whitespace = !(symbol->output_options & BARCODE_NO_QUIET_ZONES)
&& (symbol->output_options & EANUPC_GUARD_WHITESPACE);
const int hrt_font_height = (symbol->show_hrt >> 16) & 0xFF;
const float nonzero_si = si ? si : 2.0f;
const float antialias_fudge_factor = 0.01f;
int ascent, descent, lineGap;
float descent_factor;
float line_height;
float text_height;
int i;
zfnt->grayscale = zint_out_grayscale(symbol);
/* Temporarily not allowing font height for EAN/UPC */
if (!zfnt->upceanflag && hrt_font_height >= 10 && hrt_font_height <= 200) {
zfnt->font_height = hrt_font_height;
/* If were using for EAN/UPC set UPC-E/A outside font height */
if (upcea) {
zfnt->upco_font_height = (int) ceilf(hrt_font_height * ZFONT_UPCO_FONT_FACTOR);
}
} else {
if (zfnt->upceanflag) {
const float digit_ascender_factor = 0.11f; /* Assuming digit ascender height roughly 11% of font size */
zfnt->font_height = (small_text ? 7 : 10) * nonzero_si;
if (upcea) {
/* Although font size 7 (for normal) seems small it meets GS1 General Spec (GGS) Section 5.2.5:
"the size of the first and last digits should be reduced to a maximum width equivalent to four
modules" */
zfnt->upco_font_height = (small_text ? 6 : 7) * nonzero_si;
}
zfnt->digit_ascender = z_stripf(zfnt->font_height * digit_ascender_factor);
} else {
zfnt->font_height = (small_text ? 5 : 7) * nonzero_si;
}
}
zfnt->antialias_fudge = z_stripf(zfnt->font_height * antialias_fudge_factor);
zfont_set_patches(zfnt, symbol);
assert(zfnt->info.data);
zfnt->scale = stbtt_ScaleForMappingEmToPixels(&zfnt->info, zfnt->font_height);
if (upcea) {
zfnt->upco_scale = stbtt_ScaleForMappingEmToPixels(&zfnt->info, zfnt->upco_font_height);
}
stbtt_GetFontVMetrics(&zfnt->info, &ascent, &descent, &lineGap);
zfnt->ascent = z_stripf(ascent * zfnt->scale);
descent_factor = ascent - descent ? (float) -descent / (ascent - descent) : 0.5f /*50%*/;
zfnt->descent_adj = z_stripf(zfnt->font_height * descent_factor);
zfnt->line_gap = z_stripf(lineGap * zfnt->scale);
line_height = z_stripf((ascent - descent + lineGap) * zfnt->scale);
/* Set glyphs & calculate text widths & lines */
if (zfnt->upceanflag <= OUT_UPCEANFLAG_EAN5) {
/* All non-EAN/UPC barcodes + EAN-2 & EAN-5 */
unsigned int u, state = 0;
int iso_map[ZFONT_MAX_CHARS] = {0};
int iso_len = 0;
float line_width = 0;
int lines = 0;
int iso_line_idx = 0;
int last_oversized = 0;
const int length = (int) z_ustrlen(symbol->text);
/* Convert HRT from UTF-8 to ISO/IEC 8859-1 (only printing this for now) */
for (i = 0; i < length;) {
iso_map[iso_len] = i;
do {
z_decode_utf8(&state, &u, symbol->text[i++]);
} while (i < length && state != 0 && state != 12);
assert(state == 0); /* UTF-8 must be valid to have got here */
zfnt->iso_text[iso_len++] = (unsigned char) (u <= 0xFF ? u : ' ');
}
iso_map[iso_len] = i;
zfnt->iso_text[iso_len] = '\0';
zfnt->iso_len = iso_len;
for (i = 0; i < zfnt->iso_len; i++) {
const unsigned char ch = zfnt->iso_text[i];
const unsigned char next_ch = i + i < zfnt->iso_len ? zfnt->iso_text[i + 1] : 0;
if ((error_number = zfont_set_glyph(zfnt, symbol, si, ch))) {
return error_number;
}
if (next_ch && (error_number = zfont_set_glyph(zfnt, symbol, si, next_ch))) {
return error_number;
}
zfnt->hadvances[i] = zfont_stb_hadvance(zfnt, ch, next_ch, 0 /*upco*/);
if (ch == '\n') {
if (lines + 1 == ZFONT_MAX_LINES) {
break;
}
zfnt->iso_line_idxs[lines] = iso_line_idx;
zfnt->line_idxs[lines] = iso_map[iso_line_idx];
iso_line_idx = i;
zfnt->line_widths[lines] = line_width;
if (line_width > zfnt->max_line_width) {
zfnt->max_line_width = line_width;
}
line_width = 0;
lines++;
} else if (line_width + zfnt->hadvances[i] >= max_width) {
if (lines + 1 == ZFONT_MAX_LINES) {
break;
}
zfnt->iso_line_idxs[lines] = iso_line_idx;
zfnt->line_idxs[lines] = iso_map[iso_line_idx];
last_oversized = i == iso_line_idx;
if (last_oversized) {
assert(line_width == 0);
assert(zfnt->hadvances[i] >= max_width);
zfnt->line_widths[lines] = max_width;
if (max_width > zfnt->max_line_width) {
zfnt->max_line_width = max_width;
}
line_width = 0;
} else {
iso_line_idx = i;
zfnt->line_widths[lines] = line_width;
if (line_width > zfnt->max_line_width) {
zfnt->max_line_width = line_width;
}
line_width = zfnt->hadvances[i];
}
lines++;
} else {
line_width += zfnt->hadvances[i];
}
}
if (lines + 1 != ZFONT_MAX_LINES && !last_oversized) {
zfnt->iso_line_idxs[lines] = iso_line_idx;
zfnt->line_idxs[lines] = iso_map[iso_line_idx];
zfnt->line_widths[lines] = line_width;
if (line_width > zfnt->max_line_width) {
zfnt->max_line_width = line_width;
}
lines++;
}
zfnt->lines = lines;
zfnt->line_advance = (int) roundf(line_height);
if (ean2_5) {
/* Temp hack for backwards-compatibility */
text_height = si ? 7 * si : 10 * 2;
} else {
text_height = z_stripf((ascent - descent) * zfnt->scale);
if (lines > 1) {
text_height += zfnt->line_advance * (lines - 1);
}
}
if (ean2_5 && upcean_guard_whitespace) {
const unsigned char ch = '>';
assert(lines > 0 && lines + 1 < ZFONT_MAX_LINES);
zfnt->iso_text[iso_len++] = ch;
zfnt->iso_line_idxs[lines] = zfnt->iso_line_idxs[lines - 1];
zfnt->line_idxs[zfnt->lines] = zfnt->iso_line_idxs[lines];
if ((error_number = zfont_set_glyph(zfnt, symbol, si, ch))) {
return error_number;
}
zfnt->line_widths[lines] = zfont_stb_hadvance(zfnt, ch, 0 /*next_ch*/, 0 /*upco*/);
zfnt->line_idxs[lines] = length + 1;
zfnt->iso_line_idxs[zfnt->lines] = zfnt->iso_len + 1;
} else {
zfnt->line_idxs[zfnt->lines] = length;
zfnt->iso_line_idxs[zfnt->lines] = zfnt->iso_len;
}
} else {
/* UPC-E, EAN-8, UPC-A, EAN-13 */
/* Following just a bug-filled sketch, not used */
float line_width = 0;
int lines = 0;
int iso_line_idx = 0;
int length;
int addon_idx = 0;
if (zfnt->upceanflag == OUT_UPCEANFLAG_EAN8 && upcean_guard_whitespace) {
zfnt->iso_text[0] = '<';
assert(symbol->text_length >= 8);
memcpy(zfnt->iso_text + 1, symbol->text, 8);
length = 9;
if (!addon_len) {
zfnt->iso_text[length++] = '>';
}
} else {
memcpy(zfnt->iso_text, symbol->text, symbol->text_length);
length = symbol->text_length;
}
if (addon_len) {
addon_idx = length;
memcpy(zfnt->iso_text + length, addon, addon_len);
length += addon_len;
if (upcean_guard_whitespace) {
zfnt->iso_text[length++] = '>';
}
}
for (i = 0; i < length; i++) {
const unsigned char ch = zfnt->iso_text[i];
if (upcea && (i == 0 || (zfnt->upceanflag == OUT_UPCEANFLAG_UPCE && i == 7)
|| (zfnt->upceanflag == OUT_UPCEANFLAG_UPCA && i == 11))) {
if ((error_number = zfont_upco_set_glyph(zfnt, symbol, si, ch))) {
return error_number;
}
zfnt->hadvances[i] = zfont_stb_hadvance(zfnt, ch, 0 /*next_ch*/, 1 /*upco*/);
zfnt->iso_line_idxs[lines] = iso_line_idx;
lines++;
} else {
const int new_line = (zfnt->upceanflag == OUT_UPCEANFLAG_UPCE && i == 6)
|| (zfnt->upceanflag == OUT_UPCEANFLAG_EAN8 && (i == 3 || i == 7))
|| (zfnt->upceanflag == OUT_UPCEANFLAG_UPCA && (i == 5 || i == 10))
|| (zfnt->upceanflag == OUT_UPCEANFLAG_EAN13 && (i == 0 || i == 6 || i == 12))
|| (addon_len && (i == addon_idx
|| (upcean_guard_whitespace && i + 1 == length)));
const unsigned next_ch = i + 1 < length && !new_line ? zfnt->iso_text[i + 1] : 0;
if ((error_number = zfont_set_glyph(zfnt, symbol, si, ch))) {
return error_number;
}
if (next_ch && (error_number = zfont_set_glyph(zfnt, symbol, si, next_ch))) {
return error_number;
}
zfnt->hadvances[i] = zfont_stb_hadvance(zfnt, ch, next_ch, 0 /*upco*/);
if (new_line) {
zfnt->iso_line_idxs[lines] = iso_line_idx;
zfnt->line_idxs[lines] = iso_line_idx;
iso_line_idx = i;
zfnt->line_widths[lines] = line_width;
line_width = zfnt->hadvances[i];
lines++;
} else {
line_width += zfnt->hadvances[i];
}
}
}
zfnt->iso_line_idxs[lines] = iso_line_idx;
zfnt->line_idxs[lines] = iso_line_idx;
zfnt->line_widths[lines] = line_width;
/* Temp hack for backwards-compatibility */
if (si) {
text_height = z_stripf(7 * si);
} else {
text_height = z_stripf(zfnt->font_height);
}
}
/* Return `text_height` in 2-pixel `scale` units */
zfnt->text_height = z_stripf(text_height / nonzero_si);
return 0;
}
/* Raster rendering */
INTERNAL void zint_font_text_render(struct zfont *zfnt, struct zint_symbol *symbol, unsigned char *pixelbuf,
const int line, const int main_width, const int xoffset, const int roffset, const int yposn,
const int textflags, const int image_width, const int image_height, const int si) {
const unsigned char *const pe = pixelbuf + image_width * image_height;
const unsigned char *const text = zfnt->iso_text;
int start = zfnt->iso_line_idxs[line];
const int end = zfnt->iso_line_idxs[line + 1];
const int max_width = (int) roundf(zfnt->max_line_width);
const int text_width = (int) roundf(zfnt->line_widths[line]);
const int full_width = main_width + xoffset + roffset;
int xposn;
float x, y;
int yi;
int i, j, k;
(void)symbol, (void)si;
if (max_width >= full_width) {
xposn = 0;
} else {
if (textflags & OUT_HALIGN_LEFT) {
xposn = max_width > main_width + xoffset ? 0 : xoffset;
} else if (textflags & OUT_HALIGN_RIGHT) {
xposn = (max_width > main_width + roffset ? max_width : main_width + roffset) - text_width;
} else {
if (main_width > text_width) {
xposn = xoffset + (main_width - text_width) / 2;
} else {
xposn = (full_width - text_width) / 2;
}
}
}
if (xposn < 0) {
xposn = 0;
}
x = xposn;
/* For compatibility with vector, steal some space from the font's inleading (accent space)
TODO: not do this or use proper `inleading_adj` calculation */
y = z_stripf(yposn + zfnt->ascent - zfnt->descent_adj / 2.0f);
yi = (int) ceilf(y);
if (start < end && text[start] == '\n') {
/* Ignore newline at start of line */
start++;
}
for (i = start; i < end; i++) {
const int ch = text[i];
const int out_w = zfnt->bitmap_dims[ch][0];
const int out_h = zfnt->bitmap_dims[ch][1];
if (out_w > 0 && out_h > 0) {
const int xMin = zfnt->bitmap_dims[ch][2];
const int yMin = zfnt->bitmap_dims[ch][3];
const int xi = (int) roundf(x);
unsigned char *const out = zfnt->bitmaps[ch];
for (j = 0; j < out_h; j++) {
unsigned char *pb = pixelbuf + (yi + yMin + j) * image_width + xi + xMin;
const unsigned char *const pedge = pb + (image_width - xi - xMin);
const unsigned char *const pbe = pedge < pe ? pedge : pe;
const unsigned char *const o = out + j * out_w;
for (k = 0; k < out_w && pb < pbe; k++) {
*pb++ |= o[k];
}
}
}
x += zfnt->hadvances[i];
}
}
/* vim: set ts=4 sw=4 et : */