一本关于ARM 嵌入系统书籍源代码很实用的

源代码在线查看: font.c

软件大小: 537 K
上传用户: hard
关键词: ARM 嵌入系统 书籍 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				#include 
				#define MWINCLUDECOLORS
				#include "microwin/nano-X.h"
				
				GR_WINDOW_ID  wid;
				GR_GC_ID      gc;
				GR_FONT_ID    font[9];
				int j = 0;
				
				void event_handler (GR_EVENT *event);
				
				int main (void)
				{
				    int degree, fontsize;
					
					fontsize = 12;
					if (GrOpen() < 0)
				    {
				        fprintf (stderr, "GrOpen failed");
				        exit (1);
				    }
				
				    gc = GrNewGC();
				    GrSetGCUseBackground (gc, GR_FALSE);
				    GrSetGCForeground (gc, RED);
				 
				    wid = GrNewWindowEx (GR_WM_PROPS_APPFRAME |
				                         GR_WM_PROPS_CAPTION  |
				                         GR_WM_PROPS_CLOSEBOX,
				                         "Font Test Window",
				                         GR_ROOT_WINDOW_ID, 50, 50, 
				                         500, 500, WHITE);
				
				    GrSelectEvents (wid, GR_EVENT_MASK_EXPOSURE | 
				                         GR_EVENT_MASK_CLOSE_REQ);
				
				    
					degree = 0;
					for (j=0;j					{
						fontsize += 3;
						font[j] = GrCreateFont ("arial", fontsize, NULL);
						degree -= 400;
						GrSetFontRotation(font[j],degree);
					}
					
				    GrMapWindow (wid);
				    GrMainLoop (event_handler);
				    return 0;
				}
				
				void event_handler (GR_EVENT *event)
				{
				    switch (event->type)
				    {
				    case GR_EVENT_TYPE_EXPOSURE:
						for(j = 0;j						{
							GrSetFontAttr(font[j], GR_TFANTIALIAS, 0);
							GrSetGCFont (gc, font[j]);
							GrText (wid, gc, 200, 250, "     Nano-X API",  -1, GR_TFASCII);
				        }
				        break;
				
				    case GR_EVENT_TYPE_CLOSE_REQ:
				        GrClose();
				        exit (0);
				    }
				}			

相关资源