예제 #1
0
파일: jdllcomx.cpp 프로젝트: EdKeith/core
void setguids()
{
	char d[50];
	WCHAR duni[50];
	char* p; char* q;
	char match[]="Class={";
	HRSRC h= FindResourceA(g_hinst, (LPCSTR)MAKEINTRESOURCE(1), "typelib");
	p=(char*)LockResource(LoadResource(g_hinst, h));
	q=p+SizeofResource(g_hinst, h);
	while(p<q)
	{
		p=(char*)memchr(p,match[0],q-p);
		if(!p) return; // bad typelib
		if(!memcmp(p, match, strlen(match))) break;
		++p;
	}
	p+=strlen(match);	// start of class name
	q=strchr(p, '}');	// end of class name
	memcpy(jclass, p, q-p);
	jclass[p-q]=0;
	p=q+2;				// start of version
	q=strchr(p, '}');	// end of version
	memcpy(jversion, p, q-p);
	jversion[q-p]=0;
	p=q+1;				// { at start of CLSD
	q=strchr(p, '}');	// } at end of CLSID
	memcpy(d,p,1+q-p);
	d[1+q-p]=0;
	touni(d, duni);
    CLSIDFromString(duni, &jclsid);
	jlibid=jclsid;
	jiid=jclsid;
	jlibid.Data1+=1;
	jiid.Data1+=2;
}
예제 #2
0
파일: draw.c 프로젝트: poker335/garglk
int gli_draw_string(int x, int y, int fidx, unsigned char *rgb,
        unsigned char *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 = touni(*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;
}
예제 #3
0
파일: draw.c 프로젝트: poker335/garglk
static int charkern(font_t *f, int c0, int c1)
{
    FT_Vector v;
    int err;
    int g0, g1;

    if (!f->kerned)
        return 0;

    kcache_t *item = malloc(sizeof(kcache_t));
    memset(item, 0, sizeof(kcache_t));
    item->pair[0] = c0;
    item->pair[1] = c1;

    kcache_t *match = NULL;
    HASH_FIND(hh, f->kerncache, item->pair, 2 * sizeof(glui32), match);

    if (match)
    {
        free(item);
        return match->value;
    }

    g0 = FT_Get_Char_Index(f->face, touni(c0));
    g1 = FT_Get_Char_Index(f->face, touni(c1));

    if (g0 == 0 || g1 == 0) {
        free(item);
        return 0;
    }

    err = FT_Get_Kerning(f->face, g0, g1, FT_KERNING_UNFITTED, &v);
    if (err)
        winabort("FT_Get_Kerning");

    item->value = (v.x * GLI_SUBPIX) / 64.0;
    HASH_ADD_KEYPTR(hh, f->kerncache, item->pair, 2 * sizeof(glui32), item);

    return item->value;
}
예제 #4
0
파일: draw.c 프로젝트: poker335/garglk
int gli_string_width(int fidx, unsigned char *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 = touni(*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;
}