コード例 #1
0
ファイル: winfont.c プロジェクト: EPiCS/reconos_v2
BOOL WINAPI
GetCharWidth(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer)
{
	int 		i;
	int		j = 0;
	MWFONTINFO	fi;

	if(!hdc || iLastChar < iFirstChar)
		return FALSE;

	GdGetFontInfo(hdc->font->pfont, &fi);
	for(i=iFirstChar; i <= iLastChar; ++i)
		if(i < fi.firstchar || i > fi.lastchar || i > 255)
			lpBuffer[j++] = 0;
		else lpBuffer[j++] = fi.widths[i];
		lpBuffer[j++] = fi.widths[i];

	return TRUE;
}
コード例 #2
0
ファイル: winfont.c プロジェクト: EPiCS/reconos_v2
BOOL WINAPI
GetTextMetrics(HDC hdc, LPTEXTMETRIC lptm)
{
	MWFONTINFO 	fi;

	if(!hdc)
		return FALSE;

	GdGetFontInfo(hdc->font->pfont, &fi);

	/* FIXME many items are guessed for the time being*/
	lptm->tmHeight = fi.height;

   	 /* reversed for kaffe port
	lptm->tmAscent = fi.height - fi.baseline;
	lptm->tmDescent= fi.baseline;
	 */

	lptm->tmDescent = fi.height - fi.baseline;
	lptm->tmAscent= fi.baseline;
	lptm->tmInternalLeading = 0;
	lptm->tmExternalLeading = 0;
	lptm->tmAveCharWidth = fi.widths['x'];
	lptm->tmMaxCharWidth = fi.maxwidth;
	lptm->tmWeight = FW_NORMAL;
	lptm->tmOverhang = 0;
	lptm->tmDigitizedAspectX = fi.maxwidth;
	lptm->tmDigitizedAspectY = fi.height;
	lptm->tmFirstChar = 32;
	lptm->tmLastChar = 255;
	lptm->tmDefaultChar = '?';
	lptm->tmBreakChar = 0;
	lptm->tmItalic = 0;
	lptm->tmUnderlined = 0;
	lptm->tmStruckOut = 0;
	/* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/
	lptm->tmPitchAndFamily = fi.fixed?
			FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH);
	lptm->tmCharSet = OEM_CHARSET;
	return TRUE;
}
コード例 #3
0
ファイル: microwin.c プロジェクト: Annovae/Dolphin-Core
int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj)
{
    if (sz == sizeof(LOGFONT))
    {
        LOGFONT* logFont = (LOGFONT*) logObj;
        MWFONTINFO fi;
        HFONT hFont = (HFONT) hObj;

        GdGetFontInfo(((MWFONTOBJ*) hFont)->pfont, &fi);

        /* FIXME many items are guessed for the time being*/
        logFont->lfHeight = fi.height;

        /* reversed for kaffe port
           logFont->tmAscent = fi.height - fi.baseline;
           logFont->tmDescent= fi.baseline;
           */

        logFont->lfWidth = fi.widths['x'];
        logFont->lfWeight = FW_NORMAL;
        logFont->lfEscapement = 0;
        logFont->lfOrientation = 0;
        logFont->lfOutPrecision = OUT_OUTLINE_PRECIS;
        logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
        logFont->lfQuality = DEFAULT_QUALITY;
        logFont->lfItalic = 0;
        logFont->lfUnderline = 0;
        logFont->lfStrikeOut = 0;
        /* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/
        logFont->lfPitchAndFamily = fi.fixed?
            FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH);
        logFont->lfCharSet = OEM_CHARSET;
        /* TODO I don't know how to get the font name. May
         * test for different font classes.
         */
        logFont->lfFaceName[0] = 0;
#if 0
        strncpy(logFont->lfFaceName, ??, sizeof(logFont->lfFaceName));
#endif
        return sz;
    }
コード例 #4
0
ファイル: srvmain.c プロジェクト: Mellvik/elks
/*
 * Initialize the graphics and mouse devices at startup.
 * Returns nonzero with a message printed if the initialization failed.
 */
int
GsInitialize(void)
{
	GR_WINDOW	*wp;		/* root window */
	static IMAGEBITS cursorbits[16] = {
	      0xe000, 0x9800, 0x8600, 0x4180,
	      0x4060, 0x2018, 0x2004, 0x107c,
	      0x1020, 0x0910, 0x0988, 0x0544,
	      0x0522, 0x0211, 0x000a, 0x0004
	};
	static IMAGEBITS cursormask[16] = {
	      0xe000, 0xf800, 0xfe00, 0x7f80,
	      0x7fe0, 0x3ff8, 0x3ffc, 0x1ffc,
	      0x1fe0, 0x0ff0, 0x0ff8, 0x077c,
	      0x073e, 0x021f, 0x000e, 0x0004
	};

	wp = (GR_WINDOW *) malloc(sizeof(GR_WINDOW));
	if (wp == NULL) {
		fprintf(stderr, "Cannot allocate root window\n");
		return -1;
	}

#if !NONETWORK
	if (GsOpenSocket() < 0) {
		perror("Cannot bind to named socket");
		free(wp);
		return -1;
	}
#endif

	if ((keyb_fd = GdOpenKeyboard()) < 0) {
		perror("Cannot initialise keyboard");
		/*GsCloseSocket();*/
		free(wp);
		return -1;
	}

	if (GdOpenScreen() < 0) {
		perror("Cannot initialise screen");
		/*GsCloseSocket();*/
		GdCloseKeyboard();
		free(wp);
		return -1;
	}

	if ((mouse_fd = GdOpenMouse()) == -1) { /* -2 == mou_nul.c */
		perror("Cannot initialise mouse");
		/*GsCloseSocket();*/
		GdCloseScreen();
		GdCloseKeyboard();
		free(wp);
		return -1;
	}

	/*
	 * Get screen dimensions for our own and the client's use,
	 * and the information about the default font.
	 */
	GdGetScreenInfo(&scrdev, &sinfo);
	GdGetFontInfo(&scrdev, FONT_OEM_FIXED, &curfont);
	GdGetModifierInfo(&sinfo.modifiers);
	GdGetButtonInfo(&sinfo.buttons);

	/*
	 * Initialize the root window.
	 */
	wp->id = GR_ROOT_WINDOW_ID;
	wp->parent = wp;
	wp->children = NULL;
	wp->siblings = NULL;
	wp->next = NULL;
	wp->x = 0;
	wp->y = 0;
	wp->width = sinfo.cols;
	wp->height = sinfo.rows;
	wp->bordersize = 0;
	wp->background = BLACK;
	wp->bordercolor = BLACK;
	wp->nopropmask = 0;
	wp->eventclients = NULL;
	wp->cursor = NULL;
	wp->mapped = GR_TRUE;
	wp->unmapcount = 0;
	wp->output = GR_TRUE;

	listwp = wp;
	rootwp = wp;
	focuswp = wp;
	mousewp = wp;
	focusfixed = GR_FALSE;

	/*
	 * Initialize and position the default cursor.
	 */
	curcursor = NULL;
	cursorx = -1;
	cursory = -1;
	GsMoveCursor(sinfo.cols / 2, sinfo.rows / 2);
	GsSetCursor(GR_ROOT_WINDOW_ID, 16, 16, 0, 0, WHITE, BLACK,
		cursorbits, cursormask);

#if FRAMEBUFFER | BOGL
	fb_InitVt();
#endif
	scrdev.FillRect(&scrdev, 0, 0, sinfo.cols-1, sinfo.rows-1,
		GdFindColor(BLACK));

	/*
	 * Finally tell the mouse driver some things.
	 */
	curbuttons = 0;
	/*GdSetAccelMouse(5, 3);*/
	GdRestrictMouse(0, 0, sinfo.cols - 1, sinfo.rows - 1);
	GdMoveMouse(sinfo.cols / 2, sinfo.rows / 2);
	GsFlush();

	/*
	 * All done.
	 */
	connectcount = 0;
	return 0;
}