/* * CDE - Common Desktop Environment * * Copyright (c) 1993-2012, The Open Group. All rights reserved. * * These libraries and programs are free software; you can * redistribute them and/or modify them under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any later version. * * These libraries and programs are distributed in the hope that * they will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public * License along with these libraries and programs; if not, write * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301 USA */ /* $XConsortium: xlfdutil.c /main/2 1996/10/14 14:45:50 barstow $ */ /* * All Rights Reserved, Copyright (c) FUJITSU LIMITED 1995 * * This is unpublished proprietary source code of FUJITSU LIMITED * * Authors: Seiya Miyazaki FUJITSU LIMITED * Hiroyuki Chiba Fujitsu Basic Software Corporation * */ #include #include #include #include
#include #include #include #include #include #include #include #include #include #include #include "FaLib.h" #include "falxlfd.h" #include "selectxlfd.h" #ifdef DEBUG #undef Dprintf #define Dprintf fprintf #else #define Dprintf #endif /* DEBUG */ /* * parameters */ static char* skipSpace() ; extern FalFontDataList *font_L ; extern FalxFontDataBuff KeyBuff ; extern FalxCodeList *CodeList ; extern FalxStyleList *StyleList ; extern FalxSizeList *SizeList ; extern int SelectedOffset ; extern int getmask ; extern char *fullPathName ; extern Widget toplevel ; extern Widget xlfdWform, cpyWform, slctBLabel[BUTTONITEMS],slctBText[BUTTONITEMS], slctButton[BUTTONITEMS], listPop[BUTTONITEMS], listW[BUTTONITEMS], errorMD, msgBox ; /**************************************************************** * functions for get font infomation ****************************************************************/ int GetXLFDInfomations() { Dprintf( stdout, "GetXLFDInfomations()\n" ) ; /* initialize */ getmask = 0 ; SelectedOffset = 0 ; fullPathName = NULL ; FalxInitDataBuff( &KeyBuff ) ; /* get UDC informations */ if( FalxGetFontList( &font_L, XtDisplayOfObject( toplevel ) ) ){ Dprintf( stderr, "GetXLFDInfomations() : FalxGetFontList() error.\n" ) ; return(-1); } /* create code area list */ if( FalxCreateCodeList( &CodeList, font_L ) ){ Dprintf( stderr, "\nGetXLFDInfomations() : FalxCreateCodeList() error.\n" ) ; return(-1); } /* create style list */ if( FalxCreateStyleList( &StyleList, font_L ) ){ Dprintf( stderr, "\nGetXLFDInfomations() : FalxCreateStyleList() error.\n" ) ; return(-1); } /* create size list */ if( FalxCreateSizeList( &SizeList, font_L ) ){ Dprintf( stderr, "\nGetXLFDInfomations() : FalxCreateSizeList() error.\n" ) ; return(-1); } return(0) ; } int GetItemsToDisplay( int num, int *itemcnt, XmString **xms_list ) { int i, j, cnt ; char *sp ,string[256], buf[256] ; Arg args[1]; int length, maxlength ; FalxXlfdList *xlist ; int tmp_cnt ; char **tmp_dlist, *str ; XmString *xms ; int rlen ; int rtn ; switch( num ){ case 0 : /* XLFD */ /* set key data */ for( i=1; inum ; tmp_dlist = xlist->list ; break ; case 1 : /* code area */ tmp_cnt = CodeList->num ; tmp_dlist = (char **)malloc( sizeof(char *) * tmp_cnt ) ; if( tmp_dlist == NULL ) return(-1) ; for( i=0; idlist[i]->fontset) ) ; sp += rlen ; for( j=0; jdlist[i]->code_area_num; j++ ){ rlen = sprintf( sp, "%x - %x ", CodeList->dlist[i]->alist[j]->udc_start, CodeList->dlist[i]->alist[j]->udc_end ) ; sp += rlen ; } if( (tmp_dlist[i] = strdup( string )) == NULL ){ return(-1) ; } } break ; case 2 : /* style */ tmp_cnt = StyleList->num ; tmp_dlist = (char **)malloc( sizeof(char *) * tmp_cnt ) ; for( i=0; ilist[i] )) == NULL ){ return(-1) ; } } break ; case 3 : /* size */ tmp_cnt = SizeList->num ; tmp_dlist = (char **)malloc( sizeof(char *) * tmp_cnt ) ; for( i=0; ilist[i] ) ; if( (tmp_dlist[i] = strdup( string )) == NULL ){ return(-1) ; } } break ; default : /* error */ return(-1) ; } if( (xms = (XmString *)calloc( tmp_cnt, sizeof(XmString) )) == NULL ){ return( -1 ) ; } /* * set list for display */ maxlength = 0 ; for ( i=0; i