LECTURE 11 ÆüËܸìʸ»úÎó¤òɽ¼¨¤¹¤ë

¡û ¤Ï¤¸¤á¤Ë

LECTURE 5 ¤Ç¾Ò²ð¤·¤¿ XDrawString() ¤ä XDrawImageString() ¤Ç¤Ï¡¢±Ñ¿ô»ú¤Î¤è¤¦¤Ê 1 ¥Ð¥¤¥Èʸ»ú¤·¤«ÉÁ²è¤Ç¤­¤Þ¤»¤ó¡£¤·¤«¤·ÆüËܿͤȤ·¤Æ¤Ï¤¼¤Ò¤È¤âÆüËܸì¤òɽ¼¨¤·¤¿¤¤¤â¤Î¤Ç¤¹¡£

¤³¤³¤Ç¤Ï X11R5 °Ê¾å¤Î¥Ð¡¼¥¸¥ç¥ó¤ÇƳÆþ¤µ¤ì¤¿¹ñºÝ²½µ¡¹½¤ò´ð¤Ë¤·¤Æ¡¢ÆüËܸì¤Î¤è¤¦¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤òÉÁ²è¤¹¤ëÊýË¡¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤­¤Þ¤¹¡£

¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à

ɽ¼¨¤·¤¿¥¦¥£¥ó¥É¥¦¤Ë "¤³¤ó¤Ë¤Á¤Ï¡¢¤ª¸µµ¤¤Ç¤¹¤«¡©" ¤È¤¤¤¦ÆüËܸìʸ»úÎó¤òɽ¼¨¤¹¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à xmbcs.c ¤Ç¤¹¡£¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤é¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò¸Ç¤á¤¿ tar ¥Ü¡¼¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£

¼Â¹Ô¤¹¤ë¤È¡¢²¼¿Þ¤Î¤è¤¦¤ËÆüËܸìʸ»úÎó¤¬É½¼¨¤µ¤ì¤ë¤È»×¤¤¤Þ¤¹¡£¤¦¤Þ¤¯É½¼¨¤µ¤ì¤Ê¤¤¾ì¹ç¤Ï¡¢¥·¥¹¥Æ¥à¤Î´Ä¶­ÊÑ¿ô LANG ¤¬Àµ¤·¤¯ÀßÄꤵ¤ì¤Æ¤¤¤ë¤«¡¢xmbcs.c ¤¬¥·¥¹¥Æ¥à¤Î¥í¥±¡¼¥ë¤Ç»ÈÍѤµ¤ì¤Æ¤¤¤ëʸ»ú¥³¡¼¥É¤ÇÊݸ¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«Ä´¤Ù¤Æ¤ß¤Æ²¼¤µ¤¤¡£

011mbcs.jpg

--- xmbcs.c ---

    1	#include <X11/Xlib.h>
    2	#include <X11/Xlocale.h> /* ¥í¥±¡¼¥ëÍѥإåÀ¡¼¥Õ¥¡¥¤¥ë */
    3	#include <stdio.h>
    4	#include <string.h>
    5	
    6	#define WIN_W  350  /* ¥¦¥£¥ó¥É¥¦¤ÎÉý   */
    7	#define WIN_H  250  /* ¥¦¥£¥ó¥É¥¦¤Î¹â¤µ */
    8	#define WIN_X  100  /* ¥¦¥£¥ó¥É¥¦É½¼¨°ÌÃÖ(X) */
    9	#define WIN_Y  100  /* ¥¦¥£¥ó¥É¥¦É½¼¨°ÌÃÖ(Y) */
   10	#define BORDER 2    /* ¥Ü¡¼¥À¤ÎÉý */
   11	
   12	
   13	int
   14	main( void )
   15	{
   16		Display*      dpy;            /* ¥Ç¥£¥¹¥×¥ì¥¤ÊÑ¿ô */
   17		Window        root;           /* ¥ë¡¼¥È¥¦¥£¥ó¥É¥¦ */
   18		Window        win;            /* ɽ¼¨¤¹¤ë¥¦¥£¥ó¥É¥¦ */
   19		int           screen;         /* ¥¹¥¯¥ê¡¼¥ó */
   20		unsigned long black,white;    /* ¹õ¤ÈÇò¤Î¥Ô¥¯¥»¥ëÃÍ */
   21		GC            gc;             /* ¥°¥é¥Õ¥£¥Ã¥¯¥¹¥³¥ó¥Æ¥­¥¹¥È */
   22		XEvent        evt;            /* ¥¤¥Ù¥ó¥È¹½Â¤ÂÎ */
   23	
   24		XFontSet      fs;             /* ¥Õ¥©¥ó¥È¥»¥Ã¥È */
   25		int           missing_count;  /* ¸ºß¤·¤Ê¤¤Ê¸»ú½¸¹ç¤Î¿ô */
   26		char**        missing_list;   /* ¸ºß¤·¤Ê¤¤Ê¸»ú½¸¹ç */
   27		char*         def_string;     /* ¢¬¤ËÂФ·¤ÆÉÁ²è¤µ¤ì¤ëʸ»úÎó */
   28	
   29	
   30		/* ÉÁ²è¤¹¤ëÁ´³Ñʸ»úÎó */
   31		char*         string = "¤³¤ó¤Ë¤Á¤Ï¡¢¤ª¸µµ¤¤Ç¤¹¤«¡©";
   32	
   33	
   34		/* ¥í¥±¡¼¥ë¤òÀßÄꤹ¤ë(¸½ºß¥·¥¹¥Æ¥à¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¥í¥±¡¼¥ë¤ò»ÈÍÑ) */
   35		if ( setlocale( LC_CTYPE, "" ) == NULL ) {
   36			printf( "Can't set locale\n" );
   37			return 1;
   38		}
   39	
   40		/* Xlib ¤¬¸½ºß¤Î¥í¥±¡¼¥ë¤ò°·¤¨¤ë¤«¤É¤¦¤«¤òȽÃǤ¹¤ë */
   41		if ( ! XSupportsLocale() ) {
   42			printf( "Current locale is not supported\n" );
   43			return 1;
   44		}
   45	
   46	
   47		dpy = XOpenDisplay( "" );
   48	
   49		root   = DefaultRootWindow( dpy );
   50		screen = DefaultScreen( dpy );
   51		white  = WhitePixel( dpy, screen );
   52		black  = BlackPixel( dpy, screen );
   53	
   54	
   55		win = XCreateSimpleWindow( dpy, root,
   56			   WIN_X, WIN_Y, WIN_W, WIN_H, BORDER, black, white );
   57	
   58	
   59		gc = XCreateGC( dpy, win, 0, NULL );
   60		XSetBackground( dpy, gc, white );
   61		XSetForeground( dpy, gc, black );
   62	
   63	
   64		/* ¥Õ¥©¥ó¥È¥»¥Ã¥È¤òÀ¸À®¤¹¤ë */
   65		fs = XCreateFontSet( dpy, "-*-fixed-medium-r-normal--16-*-*-*", 
   66				     &missing_list, &missing_count, &def_string );
   67	
   68		if ( fs == NULL ) {
   69			printf( "Failed to create fontset\n" );
   70			return 1;
   71		}
   72	
   73		XFreeStringList( missing_list );
   74	
   75		XSelectInput( dpy, win, ExposureMask | KeyPressMask );
   76		XMapWindow( dpy, win );
   77	
   78	
   79		while( 1 ) {
   80			XNextEvent( dpy, &evt );
   81	
   82			switch( evt.type ) {
   83				case Expose:
   84					if( evt.xexpose.count == 0 ) {
   85						XmbDrawString( dpy, win, fs, gc, 
   86							50, 50, string, strlen( string ) );
   87					}
   88					break;
   89	
   90				case KeyPress:
   91					XFreeGC( dpy, gc );
   92					XFreeFontSet( dpy, fs );
   93					XDestroyWindow( dpy, win );
   94					XCloseDisplay( dpy );
   95					return 0;
   96			}
   97		}
   98	}
   99	
  100	/* End of xmbcs.c */

¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÎÀâÌÀ

Îã¤Ë¤è¤Ã¤Æ¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤ÆÀâÌÀ¤·¤Æ¤¤¤­¤Þ¤¹¡£

  • 2 ¹ÔÌÜ

    Xlib ¤Î¹ñºÝ²½µ¡¹½¤ò»È¤Ã¤ÆÆüËܸì(¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú)¤ò°·¤¦¤¿¤á¤ËɬÍ×¤Ê <X11/Xlocale.h> ¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤Æ¤¤¤Þ¤¹¡£

  • 24 ¡Á 27 ¹ÔÌÜ

    ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ÎÉÁ²è¤ËɬÍפʥե©¥ó¥È¥»¥Ã¥È¤òºîÀ®¤¹¤ë¤¿¤á¤Ë»È¤¦ÊÑ¿ô¤¬Àë¸À¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¥Õ¥©¥ó¥È¥»¥Ã¥È¤È¤Ï¡¢¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤òÉÁ²è¤¹¤ë¤Î¤ËɬÍפÊÊ£¿ô¤Î¥Õ¥©¥ó¥È¤ò¤Þ¤È¤á¤Æ°·¤¦ ¤¿¤á¤Î»ÅÁȤߤǤ¹¡£Î㤨¤Ð¡¢È¾³Ñ±Ñ¿ô»ú¤ÈÁ´³Ñʸ»ú¤òÉÁ²è¤¹¤ë¤Ë¤Ï°Û¤Ê¤ë¥Õ¥©¥ó¥È¤¬É¬Í×¤È¤Ê¤ê ¤Þ¤¹¤¬¡¢¤³¤ì¤ò¤Þ¤È¤á¤Æ°·¤¦¤¿¤á¤Î»ÅÁȤߤȻפ¨¤ÐÎɤ¤¡¢¤È»×¤¤¤Þ¤¹¡£¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÉÁ²è´Ø ¿ô¤¬»ØÄꤵ¤ì¤¿¥Õ¥©¥ó¥È¥»¥Ã¥È¤«¤éɬÍפʥե©¥ó¥È¤ò¿ï»þÁªÂò¤·¤Æʸ»ú¤òÉÁ²è¤·¤Æ¤¯¤ì¤Þ¤¹¡£

  • 34 ¡Á 38 ¹ÔÌÜ

    ÆüËܸì(°Ê³°¤Î¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤âƱÍÍ)¤ò°·¤¤¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢¥×¥í¥°¥é¥àÃæ¤Ç¤Þ¤ººÇ½é¤Ë¥í¥± ¡¼¥ë¤òÀßÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£

    ºÇ¶á¤Î Unix ¤Ç¤Ï¡¢¥í¥±¡¼¥ë¤È¤¤¤¦»ÅÁȤߤ¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï°Û¤Ê¤ë¸À¸ì´Ä¶­²¼¤Ë¤ª¤¤ ¤Æ¤â¥³¥ó¥Ñ¥¤¥ë¤·¤Ê¤ª¤¹¤³¤È¤Ê¤¯¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬Æ°ºî¤¹¤ë¤¿¤á¤Î»ÅÁȤߤǤ¹¡£¤³¤ì¤Ï¥·¥¹¥Æ ¥à¤Î C ¥é¥¤¥Ö¥é¥ê¤ÎÊý¤ÇÍÑ°Õ¤µ¤ì¤ë¤³¤È¤â¤¢¤ê¤Þ¤¹¤¬¡¢¥·¥¹¥Æ¥à¤Ë¥í¥±¡¼¥ë¤Î»ÅÁȤߤ¬Ìµ¤¤¾ì ¹ç¤Ç¤â¤½¤Î»ÅÁȤߤòÍøÍѤǤ­¤ë¤è¤¦¤Ë Xlib ¦¤âÆȼ«¤Ë¥í¥±¡¼¥ë¤Î»ÅÁȤߤò»ý¤Ã¤Æ¤¤¤Þ¤¹¡£

    ¥í¥±¡¼¥ë¤òÀßÄꤹ¤ë¤Ë¤Ï setlocale() ¤ò»È¤¤¤Þ¤¹¤¬¡¢C ¥é¥¤¥Ö¥é¥ê¤ÎÊý¤Ç setlocale() ¤¬ÄêµÁ ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¤½¤Á¤é¤ò¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï setlocale() ¤¬¸Æ¤Ð¤ì¤ë¤È _Xsetlocale() ¤ò»È ¤¦¤è¤¦¤Ë <X11/Xlocale.h> Æâ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

      char* setlocale( int category, char* locale );
    
      category : ¥í¥±¡¼¥ë¤Î±Æ¶Á¤ò¼õ¤±¤ë´Ø¿ô¶èʬ
      locale   : ¥í¥±¡¼¥ë̾ 
    
    

    category ¤Ë LC_CTYPE ¤ò»ØÄꤷ¤Æ¡¢locale ¤Ë¥í¥±¡¼¥ë̾¤ò»ØÄꤹ¤ë¤È¡¢Ê¸»ú¼ïÊÌȽÄꤪ¤è¤Óʸ »úÊÑ´¹¤ò¹Ô¤¦¥ë¡¼¥Á¥ó¤¬¤½¤Î¥í¥±¡¼¥ë¤Ë½¾¤Ã¤ÆÆ°ºî¤¹¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£¤È¤ê¤¢¤¨¤º¤³¤ì¤òÀßÄê ¤·¤Æ¤ª¤±¤ÐÆüËܸì¤òɽ¼¨¤Ç¤­¤Þ¤¹( ¤½¤Î¾¤Î category ¤Ë¤Ä¤¤¤Æ¤Ï¤è¤¯Ä´¤Ù¤Æ¤¤¤Þ¤»¤óm(__)m )¡£ ¤Ê¤ª¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Î¤è¤¦¤Ë locale ¤Ë "" ¤ò»ØÄꤹ¤ë¤È¡¢LANG ´Ä¶­ÊÑ¿ô¤ËÀßÄꤵ¤ì¤Æ ¤¤¤ëÃͤ¬»ÈÍѤµ¤ì¤Þ¤¹¡£

  • 40 ¡Á 44 ¹ÔÌÜ

    setlocale() ¤ò¼Â¹Ô¤·¤¿Ä¾¸å¤Ë¡¢ÀßÄꤵ¤ì¤¿¥í¥±¡¼¥ë¤ò Xlib ¤¬°·¤¨¤ë¤«¤É¤¦¤«¤òȽÃǤ·¤Ê¤±¤ì ¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤½¤ì¤Ë¤Ï XSupportsLocale() ¤ò»È¤¤¤Þ¤¹¡£

      Bool XSupportsLocale();
    
    

    ¸½ºßÀßÄꤵ¤ì¤Æ¤¤¤ë¥í¥±¡¼¥ë¤¬°·¤¨¤ë¤Ê¤é¤Ð True ¤ò¡¢°·¤¦¤³¤È¤¬¤Ç¤­¤Ê¤¤¤Ê¤é¤Ð False ¤òÊÖ ¤·¤Þ¤¹¡£

  • 64 ¡Á 73 ¹ÔÌÜ

    ÆüËܸìʸ»úÎó(°Ê³°¤Î¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤âƱÍÍ)¤òÉÁ²è¤¹¤ë¤¿¤á¤Ë¤Ï¡¢¤Þ¤º X ¥µ¡¼¥Ð¤ËɬÍ×¤Ê ¥Õ¥©¥ó¥È¥»¥Ã¥È¤ò¥í¡¼¥É¤·¤Ê¤±¤ì¤Ð¤¤¤±¤Þ¤»¤ó¡£¥Õ¥©¥ó¥È¥»¥Ã¥È¤È¤Ï¡¢Á°½Ò¤Î¤è¤¦¤Ëʸ»úÎó¤òÉÁ ²è¤¹¤ë¤Î¤ËɬÍפÊÊ£¿ô¤Î¥Õ¥©¥ó¥È¤ò¤Þ¤È¤á¤Æ°·¤¦¤¿¤á¤Î»ÅÁȤߤǤ¹¡£

    ¸½ºß¤Î¥í¥±¡¼¥ë¤¬É¬ÍפȤ¹¤ë¥Õ¥©¥ó¥È¤«¤é¥Õ¥©¥ó¥È¥»¥Ã¥È¤òºîÀ®¤¹¤ë¤Ë¤Ï¡¢XCreateFontSet() ¤ò»ÈÍѤ·¤Þ¤¹¡£

      XFontSet XCreateFontSet( Display* display,
                               char*    base_font_name_list,
                               char***  missing_charset_list, 
                               int*     missing_charset_count, 
                               char**   def_string 
                             );
    
      base_font_name_list   : ¥Ù¡¼¥¹¥Õ¥©¥ó¥È̾¤Î¥ê¥¹¥È 
      missing_charset_list  : ¸«ÉÕ¤«¤é¤Ê¤«¤Ã¤¿Ê¸»ú¥»¥Ã¥È
      missing_charset_count : missing_charset_list¤Î¸Ä¿ô
      def_string            : ¸«ÉÕ¤«¤é¤Ê¤«¤Ã¤¿Ê¸»ú¤ÎÉÁ²è¤ËÍѤ¤¤ëʸ»úÎó
    
    

    base_font_name_list ¤Ç»ØÄꤷ¤¿¥Õ¥©¥ó¥È̾¤ò¥Ù¡¼¥¹¤È¤·¤Æ¡¢¸½ºß¤Î¥í¥±¡¼¥ë¤Ë´ð¤Å¤¤¤¿¥Õ¥©¥ó ¥È¥»¥Ã¥È¤òºîÀ®¤·¤ÆÊÖ¤·¤Þ¤¹¡£¥Õ¥©¥ó¥È¥»¥Ã¥È¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤¿¾ì¹ç¤Ï NULL ¤òÊÖ¤·¤Þ¤¹¡£¥Ù¡¼ ¥¹¥Õ¥©¥ó¥È̾¤Î¥ê¥¹¥È¤È¤Ï¡¢¥Õ¥©¥ó¥È¥µ¥¤¥º¤Ê¤É¤Î¥Õ¥©¥ó¥È¼ïÊ̤òÆÃÄꤷ¤Ê¤¤Éôʬ¤Î¤ß¤ò»ØÄꤷ ¤Æ¾¤Ï¥¢¥¹¥¿¥ê¥¹¥¯¤Ç»ØÄꤷ¤¿ 1 ¤Ä¤Î¥Õ¥©¥ó¥È̾¡¢¤â¤·¤¯¤Ï°ìÉô¤ò¥¢¥¹¥¿¥ê¥¹¥¯»ØÄꤷ¤¿¥Õ¥© ¥ó¥È̾¤Î¥ê¥¹¥È¡¢¤¢¤ë¤¤¤Ï´°Á´¤Ë¥Õ¥©¥ó¥È¤ò»ØÄꤷ¤¿¥Õ¥©¥ó¥È̾¤Î¥ê¥¹¥È¤Ç¤¹¡£

    missing_charset_list ¤Ë¤Ï¡¢Âбþ¤¹¤ë¥Õ¥©¥ó¥È¤òȯ¸«¤Ç¤­¤Ê¤«¤Ã¤¿Ê¸»ú¤Î½¸¹ç¤¬³ÊǼ¤µ¤ì¤Æ¤¤ ¤Þ¤¹¡£Æä˻ÈÍѤ·¤Ê¤¤¾ì¹ç¤Ï¡¢XFreeStringList() ¤ò»È¤Ã¤Æ²òÊü¤·¤Æ¤ª¤­¤Þ¤¹¡£»ÈÍѤ¹¤ë¾ì¹ç¤Ç ¤â¡¢¥×¥í¥°¥é¥à½ªÎ»»þ¤Ë¤Ï²òÊü¤·¤Æ¤¯¤À¤µ¤¤¡£

      XFreeStringList( char** list );
      list : ʸ»úÎó¤Î½¸¹ç
    
    

  • 83 ¡Á 88 ¹ÔÌÜ

    Expose ¥¤¥Ù¥ó¥È¤ò¼õ¤±¼è¤Ã¤¿»þ¤Ë¡¢ºîÀ®¤·¤¿¥Õ¥©¥ó¥È¥»¥Ã¥È¤ò»È¤Ã¤¿ÆüËܸìʸ»úÎó¤òÉÁ²è¤·¤Æ ¤¤¤Þ¤¹¡£¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ò¼ÂºÝ¤ËÉÁ²è¤¹¤ë¤Ë¤Ï XmbDrawString() ¤â¤·¤¯¤Ï XmbDrawImageString() ¤ò»È¤¤¤Þ¤¹( xmbcs.c ¤Ç¤ÏÁ°¼Ô¤ò»ÈÍÑ)¡£

      void XmbDrawString( Display* display,
                          Drawable d, 
                          XFontSet font_set, 
                          GC       gc, 
                          int      x, 
                          int      y, 
                          char*    string, 
                          int      num_bytes 
                        );
    
      font_set  : ¥Õ¥©¥ó¥È¥»¥Ã¥È
      gc        : GC 
      x, y      : ʸ»úÎó¤Î¥Ù¡¼¥¹ºÂɸ
      string    : ʸ»úÎó
      num_bytes : string¤Î¥Ð¥¤¥È¿ô
    
    
      void XmbDrawImageString( display, d, font_set, gc, x, y, string, num_bytes );
    
    

    XmbDrawString() ¤¬ GC ¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤òÍѤ¤¤Æʸ»úÎó¤òÉÁ²è¤¹¤ë¤Î¤ß¤Ç¤¢¤ë¤Î¤ËÂÐ ¤·¤Æ¡¢XmbDrawImageString() ¤Ï¡¢¤Þ¤º GC ¤Î¥Ð¥Ã¥¯¥°¥é¥¦¥ó¥É¥«¥é¡¼¤òÍѤ¤¤Æʸ»úÎó¤ËÂФ¹¤ë ¥Ð¥¦¥ó¥Ç¥£¥ó¥°¥Ü¥Ã¥¯¥¹¤òÉÁ²è¤·¤¿¸å¤Ë¡¢¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥«¥é¡¼¤òÍѤ¤¤Æʸ»úÎó¤òÉÁ²è¤¹¤ëÅÀ ¤¬°Û¤Ê¤ê¤Þ¤¹¡£

  • 92 ¹ÔÌÜ

    ¥ê¥½¡¼¥¹¤Î²òÊü½èÍý¤È¤·¤Æ¡¢¿·¤¿¤Ë¥Õ¥©¥ó¥È¥»¥Ã¥È¤Î²òÊü½èÍý¤¬²Ã¤ï¤Ã¤Æ¤¤¤Þ¤¹¡£À¸À®¤·¤¿¥Õ¥© ¥ó¥È¥»¥Ã¥È¤¬ÉÔɬÍפˤʤ俾ì¹ç¤Ï¡¢XFreeFontSet() ¤ò»È¤Ã¤Æ¥ê¥½¡¼¥¹¤ò²òÊü¤·¤Þ¤¹¡£

      XFreeFontSet( Display* dpy, XFontSet font_set );
    
    

°Ê¾å¤Ç xmbcs.c ¤ÎÀâÌÀ¤Ï½ª¤ê¤Ç¤¹¡£ÆüËܸìʸ»úÎó(¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó)¤ÎÉÁ²è¤Î»ÅÊý¤¬Ê¬¤«¤Ã¤¿¤Ç¤·¤ç¤¦¤«? ¤Ê¤ª¡¢xmbcs.c ¤Ç¤Ï»ÈÍѤ·¤Þ¤»¤ó¤Ç¤·¤¿¤¬¡¢»ØÄꤷ¤¿¥Õ¥©¥ó¥È¤Çʸ»úÎó¤òÉÁ²è¤¹¤ëºÝ¤Ë¤½¤Îʸ»úÎ󤬤ɤ줯¤é¤¤¤ÎÎΰè¤òÀê¤á¤ë¤Î¤«¤Ë¤Ä¤¤¤ÆÃΤꤿ¤¤¾ì¹ç¤¬¤è¤¯¤¢¤ê¤Þ¤¹(¥¨¥Ç¥£¥¿¤Ê¤ó¤«¤òºî¤ë¾ì¹ç¤Ë¤Ïɬ¿Ü¤Ç¤¹¤è¤Í)¡£¤³¤ÎÊýË¡¤Ë¤Ä¤¤¤Æ°Ê²¼¤Ë¾Ò²ð¤·¤Æ¤ª¤­¤Þ¤¹¡£

¡û ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ÎÉÁ²èÎΰè¾ðÊó¤Î¼èÆÀ

»ØÄꤷ¤¿¥Õ¥©¥ó¥È¤Çʸ»úÎó¤òÉÁ²è¤¹¤ëºÝ¤Ë¡¢¤½¤Îʸ»úÎ󤬤ɤ줯¤é¤¤¤ÎÉÁ²èÎΰè¤òÀê¤á¤ë¤«¤òÃΤꤿ¤¤¾ì¹ç¤¬Îɤ¯¤¢¤ê¤Þ¤¹¡£¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤òÀßÄꤵ¤ì¤Æ¤¤¤ë¥Õ¥©¥ó¥È¤ÇÉÁ²è¤·¤¿¾ì¹ç¤Ë¡¢Àê¤á¤ë¤Ç¤¢¤í¤¦ÉÁ²èÎΰè¾ðÊó¤ò¼èÆÀ¤¹¤ë¤Ë¤Ï XmbTextExtents() ¤ò»È¤¤¤Þ¤¹¡£

int XmbTextExtents( XFontSet    font_set, 
                    char*       string, 
                    int         num_bytes, 
                    XRectangle* overall_ink_return, 
                    XRectangle* overall_logical_return 
                  );

font_set               : ¥Õ¥©¥ó¥È¥»¥Ã¥È
string                 : ʸ»úÎó 
num_bytes              : °ú¿ôstring¤Î¥Ð¥¤¥È¿ô¤ò»ØÄê 
overall_ink_return     : ÉÁ²è¤µ¤ì¤ëÎΰè¤Î¥Ç¥£¥á¥ó¥¸¥ç¥ó¤òÊÖ¤¹
overall_logical_return : ÏÀÍýŪ¤Ê¥Ç¥£¥á¥ó¥¸¥ç¥ó¤òÊÖ¤¹

string ¤Ç»ØÄꤷ¤¿Ê¸»úÎó¤ò font_set ¤Î¥Õ¥©¥ó¥È¥»¥Ã¥È¤ÇÉÁ²è¤·¤¿¾ì¹ç¤Ë¡¢ÉÁ²è¤µ¤ì¤¿Ê¸»úÎó¤Î¥µ¥¤¥º¤Ë´Ø¤¹¤ë¾ðÊó¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£³Æ¾ðÊó¤Ï¡¢°ú¿ô¤ÇÍ¿¤¨¤¿ overall_ink_return¡¢overall_logical_return ¤Ë³ÊǼ¤µ¤ì¤Þ¤¹¡£overall_ink_return ¤Ë¤Ïʸ»úÎó¤Î²èÁü¥¤¥á¡¼¥¸¤Î¥Ð¥¦¥ó¥Ç¥£¥ó¥°¥Ü¥Ã¥¯¥¹¤¬¡¢overall_logical_return ¤Ë¤ÏÏÀÍýŪ¤Ê¥Ð¥¦¥ó¥Ç¥£¥ó¥°¥Ü¥Ã¥¯¥¹¤ÎÂ礭¤µ¤¬¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£

¤È½ñ¤¤¤Æ¤ß¤Æ¤â¤è¤¯Ê¬¤«¤ê¤Þ¤»¤ó¤¬(¥Þ¥Ë¥å¥¢¥ë¤ÎľÌõ¤À¤«¤é?)¡¢overall_logical_return ¤ÎÊý¤ÏÍפ¹¤ë¤Ë¡¢ÉÁ²è¤·¤¿Ê¸»úÎ󤬴°Á´¤Ë°Ï¤Þ¤ì¤ëĹÊý·Á¤ÎÉý¤È¹â¤µ¤¬³ÊǼ¤µ¤ì¤Þ¤¹¡£¤Ê¤ª¡¢over_all_logical_return ¤Î x ¤È y ¤Ë¤Ï¡¢ÉÁ²è¤¹¤ëʸ»úÎó¤ÎÉÁ²è¸¶ÅÀ¤«¤é¤ß¤¿¥Ð¥¦¥ó¥Ç¥£¥ó¥°¥Ü¥Ã¥¯¥¹¤Îº¸¾å³Ñ¤Î°ÌÃÖ¤¬³ÊǼ¤µ¤ì¤Þ¤¹¡£