| 601 | // ---------------------------------------------------------------------------- |
| 602 | |
| 603 | int grFont::draw_char(grSurface *sf, int x, int y, int ch, tCharProperties *chprop) { |
| 604 | gr_font_record *ft; |
| 605 | int next_x = 0, width, index; |
| 606 | |
| 607 | ASSERT(m_FontHandle > -1); |
| 608 | if ((ch < min_ascii()) || (ch > max_ascii())) |
| 609 | return (next_x + 1); |
| 610 | |
| 611 | // save current x and get this font |
| 612 | ft = &grFont::m_FontList[m_FontHandle]; |
| 613 | next_x = x; |
| 614 | index = ch - ft->font.min_ascii; |
| 615 | |
| 616 | // draw either a color bitmap or mono font. |
| 617 | if (ft->font.flags & FT_PROPORTIONAL) { |
| 618 | width = (int)ft->font.char_widths[index]; |
| 619 | } else { |
| 620 | width = (int)ft->font.width; |
| 621 | } |
| 622 | |
| 623 | // perform blt. |
| 624 | if (sf->get_flags() & SURFFLAG_RENDERER) { |
| 625 | rend_SetCharacterParameters(chprop->col[0], chprop->col[1], chprop->col[2], chprop->col[3]); |
| 626 | rend_DrawFontCharacter(ft->bmps[ft->ch_surf[index]], x, y, x + ft->ch_w[index] - 1, y + ft->ch_h[index] - 1, |
| 627 | ft->ch_uf[index], ft->ch_vf[index], ft->ch_wf[index], ft->ch_hf[index]); |
| 628 | } else if (ft->font.flags & FT_COLOR) { |
| 629 | sf->blt(x, y, ft->surfs[ft->ch_surf[index]], ft->ch_u[index], ft->ch_v[index], ft->ch_w[index], ft->ch_h[index]); |
| 630 | } else { |
| 631 | charblt16(sf, chprop->col[0], x, y, ft->surfs[ft->ch_surf[index]], ft->ch_u[index], ft->ch_v[index], |
| 632 | ft->ch_w[index], ft->ch_h[index]); |
| 633 | } |
| 634 | |
| 635 | // adjust next x value with kerning and return it. |
| 636 | next_x += width; |
| 637 | |
| 638 | return next_x; |
| 639 | } |
| 640 | |
| 641 | int grFont::draw_char(grSurface *sf, int x, int y, int ch, int sx, int sy, int sw, int sh, tCharProperties *chprop) { |
| 642 | gr_font_record *ft; |
no test coverage detected