52 int font_height, x, y, px, py, i, w, h, pitch, bpp, first, last;
54 unsigned char *data, *width;
59 goto exit_error_unlocked;
85 font_height = header->
height - 1;
86 pitch = header->
pitch;
87 data = (
unsigned char *)font +
sizeof(
PUT_HEADER);
90 bpp = header->
old.bpp;
93 font_height = header->
old.height - 1;
94 pitch = header->
old.width * bpp;
95 data = (
unsigned char *)font + 4;
98 if ((y + font_height <= context->view_y) || (y >= context->
view_y + context->
view_h))
101 if ((bpp != context->
target_bpp) || (pitch < 4) || (font_height <= 0) || (data[0] != 0)) {
106 first = (int)data[1];
113 if (y < context->view_y) {
114 data += (pitch * (context->
view_y - y));
115 font_height -= (context->
view_y - y);
118 if (y + font_height > context->
view_y + context->
view_h)
119 font_height -= ((y + font_height) - (context->
view_y + context->
view_h));
121 for (w = 0, i = first; i <= last; i++) {
122 char_data[i].
width = (
unsigned int)width[i - first];
123 char_data[i].
data = data;
124 data += (char_data[i].
width * bpp);
125 w += char_data[i].
width;
137 ch = &char_data[(
unsigned char)string->
data[i]];
148 if (x + w >= context->
view_x) {
150 if (x < context->view_x) {
151 data += ((context->
view_x - x) * bpp);
152 w -= (context->
view_x - x);
157 putter(data, context->
line[y] + (px * bpp), w, h, pitch, context->
target_pitch, color, blender, param);
172 (y + font_height <= context->view_y) || (y >= context->
view_y + context->
view_h)) {
176 if (y < context->view_y) {
177 offset = (bytes_count * (context->
view_y - y));
178 font_height -= (context->
view_y - y);
181 if (y + font_height > context->
view_y + context->
view_h)
182 font_height -= ((y + font_height) - (context->
view_y + context->
view_h));
185 if (x < context->view_x) {
186 first = (context->
view_x - x) / w;
190 if (x + ((last - first) * w) > context->
view_x + context->
view_w)
191 last -= ((x + ((last - first) * w) - (context->
view_x + context->
view_w)) / w);
193 for (i = first; i < last; i++, x += w) {
195 if (x + w <= context->view_x)
202 for (py = 0; py < font_height; py++) {
203 for (px = 0; px < w; px++) {
204 if ((*data & (1 << (px & 0x7))) && (x + px >= context->
view_x) && (x + px < context->view_x + context->
view_w))
205 context->
put_pixel(context, x + px, y + py, color);
206 if ((px & 0x7) == 0x7)