Exemplo n.º 1
0
int gli_draw_string_uni(int x, int y, int fidx, unsigned char *rgb,
        glui32 *s, int n, int spw)
{
    font_t *f = &gfont_table[fidx];
    int dolig = ! FT_IS_FIXED_WIDTH(f->face);
    int prev = -1;
    glui32 c;
    int px, sx;

    if ( FT_Get_Char_Index(f->face, UNI_LIG_FI) == 0 )
        dolig = 0;
    if ( FT_Get_Char_Index(f->face, UNI_LIG_FL) == 0 )
        dolig = 0;

    while (n--)
    {
        bitmap_t *glyphs;
        int adv;

        c = *s++;

        if (dolig && n && c == 'f' && *s == 'i')
        {
          c = UNI_LIG_FI;
          s++;
          n--;
        }
        if (dolig && n && c == 'f' && *s == 'l')
        {
          c = UNI_LIG_FL;
          s++;
          n--;
        }

        getglyph(f, c, &adv, &glyphs);

        if (prev != -1)
            x += charkern(f, prev, c);

        px = x / GLI_SUBPIX;
        sx = x % GLI_SUBPIX;

                if (gli_conf_lcd)
                    draw_bitmap_lcd(&glyphs[sx], px, y, rgb);
                else
                    draw_bitmap(&glyphs[sx], px, y, rgb);

        if (spw >= 0 && c == ' ')
            x += spw;
        else
            x += adv;

        prev = c;
    }

    return x;
}
Exemplo n.º 2
0
int gli_string_width_uni(int fidx, glui32 *s, int n, int spw)
{
    font_t *f = &gfont_table[fidx];
    int dolig = ! FT_IS_FIXED_WIDTH(f->face);
    int prev = -1;
    int w = 0;

    if ( FT_Get_Char_Index(f->face, UNI_LIG_FI) == 0 )
        dolig = 0;
    if ( FT_Get_Char_Index(f->face, UNI_LIG_FL) == 0 )
        dolig = 0;

    while (n--)
    {
        bitmap_t *glyphs;
        int adv;
        int c = *s++;

        if (dolig && n && c == 'f' && *s == 'i')
        {
          c = UNI_LIG_FI;
          s++;
          n--;
        }
        if (dolig && n && c == 'f' && *s == 'l')
        {
          c = UNI_LIG_FL;
          s++;
          n--;
        }

        getglyph(f, c, &adv, &glyphs);

        if (prev != -1)
            w += charkern(f, prev, c);

        if (spw >= 0 && c == ' ')
            w += spw;
        else
            w += adv;

        prev = c;
    }

    return w;
}
Exemplo n.º 3
0
static int hasglyph( SFONT *fo, word c, int allowdef)
  {
  return (getglyph(fo,c,allowdef) != NULL);
  }