/t1lib-5.1.2/xglyph/xglyph.c
C | 4739 lines | 3747 code | 568 blank | 424 comment | 463 complexity | 5a060dab692f5ed2fd7058f32eef3ba4 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-2.0, GPL-2.0
Large files files are truncated, but you can click here to view the full file
- /*--------------------------------------------------------------------------
- ----- File: xglyph.c
- ----- Author: Rainer Menzner (Rainer.Menzner@web.de)
- ----- Date: 2003-01-02
- ----- Description: This file is part of the t1-library. The program xglyph
- allows viewing of character- and string-glyphs. Diverse
- parameters may be interactively configured.
- ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2003.
- As of version 0.5, t1lib is distributed under the
- GNU General Public Library Lincense. The
- conditions can be found in the files LICENSE and
- LGPL, which should reside in the toplevel
- directory of the distribution. Please note that
- there are parts of t1lib that are subject to
- other licenses:
- The parseAFM-package is copyrighted by Adobe Systems
- Inc.
- The type1 rasterizer is copyrighted by IBM and the
- X11-consortium.
- ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-)
- ----- Credits: I want to thank IBM and the X11-consortium for making
- their rasterizer freely available.
- Also thanks to Piet Tutelaers for his ps2pk, from
- which I took the rasterizer sources in a format
- independent from X11.
- Thanks to all people who make free software living!
- --------------------------------------------------------------------------*/
-
- /* definitions for activating special tests for features of t1lib
- via commandline arguments: */
- #define CHECK_PERFORMANCE 0x0001
- #define CHECK_T1_COPYFONT_T1_ADDFONT 0x0002
- #define CHECK_CONCATGLYPHS 0x0004
- #define CHECK_CONCATOUTLINES 0x0008
- #define CHECK_FOR_BAD_CHARS 0x0010
- #define CHECK_DEFAULT_ENCODING 0x0020
- #define CHECK_SMART_AA 0x0040
- #define NO_GRID 0x0080
- #define CHECK_AA_CACHING 0x0100
- #define CHECK_CACHE_STROKED 0x0200
- #define CHECK_SET_RECT 0x0400
- /* #define SHOW_MANIPULATE_PATHS */
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include <X11/Xaw/Label.h>
- #include <X11/Xaw/Command.h>
- #include <X11/Xaw/Form.h>
- #include <X11/Xaw/Dialog.h>
- #include <X11/Xaw/Box.h>
- #include <X11/Xaw/Toggle.h>
- #include <X11/Shell.h>
- #include <X11/Xaw/AsciiText.h>
- #include <X11/Xaw/SimpleMenu.h>
- #include <X11/Xaw/SmeBSB.h>
- #include <X11/Xaw/List.h>
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/uio.h>
- #include <unistd.h>
- #include <sys/time.h>
- /* The following stuff is necessary for compiling and running
- xglyph on VMS. Submitted by John Hasstedt (John.Hasstedt@sunysb.edu),
- who did the VMS-port of t1lib. */
- #if defined(__VMS) && __CRTL_VER < 70000000
- # define putenv(p) \
- printf("You must define T1LIB_CONFIG before running this program\n"); \
- exit;
- # define gettimeofday(p1,p2)
- #endif
- /* Note: We include t1lib.h and t1libx.h from lib/t1lib. That way the
- objectfile does only need to be rebuild when the header itself
- changes and not each time the library has been recompiled */
- #include "../lib/t1lib/t1lib.h"
- #include "../lib/t1lib/t1libx.h"
- #ifndef PI
- #define PI 3.1415927
- #endif
- /* utility functions */
- BBox ComputeRotBBox( BBox, float);
- long time_diff(struct timeval *, struct timeval *);
- /* fallback-function */
- void exitprog( Widget, XtPointer, XtPointer);
- void togglekerning( Widget, XtPointer, XtPointer);
- void toggleligatur( Widget, XtPointer, XtPointer);
- void toggler2l( Widget, XtPointer, XtPointer);
- void toggleunderline( Widget, XtPointer, XtPointer);
- void toggleoverline( Widget, XtPointer, XtPointer);
- void toggleoverstrike( Widget, XtPointer, XtPointer);
- void showchar( Widget , XtPointer , XtPointer );
- void showstring( Widget , XtPointer , XtPointer );
- void aashowchar( Widget , XtPointer , XtPointer );
- void aashowstring( Widget , XtPointer , XtPointer );
- void showcharX( Widget , XtPointer , XtPointer );
- void showstringX( Widget , XtPointer , XtPointer );
- void aashowcharX( Widget , XtPointer , XtPointer );
- void aashowstringX( Widget , XtPointer , XtPointer );
- void showabout( Widget , XtPointer , XtPointer );
- void toggleopacity( Widget, XtPointer, XtPointer);
- void setcolor( Widget, XtPointer, XtPointer);
- void fonttable( Widget, XtPointer, XtPointer);
- void toggleaalevel( Widget, XtPointer, XtPointer);
- int ComputeAAColorsX( unsigned long fg, unsigned long bg, int nolevels);
- void printusage( int max);
- int CheckTransform( void);
- #define DOUBLEMARGIN 10
- #define SIMPLEMARGIN 5
- #define XOUTPUT_HALFVSIZE 200
- #define XOUTPUT_HALFHSIZE 300
- #define XGLYPH_PAD 16
- #define T1LIBENCFILE "IsoLatin1.enc"
- #define MAXENCODINGS 10
- #define TESTFONTFILE "eufm10.pfb"
- #define SHOWGRID
- #define CROSS_SIZE 6
- #define PAD(bits, pad) (((bits)+(pad)-1)&-(pad))
- #define DIALOGWIDTH 170
- #define DIALOGHEIGHT 20
- #define ACTIONBUTTONHEIGHT 20
- #define APPLICATIONHEIGHT 690
- #define EDITABLE_COLOR "red"
- #define MESSAGEBOXHEIGHT 180
- #define AAMAXPLANES 17
- #define GRAY0 WhitePixel(display, screen_number)
- #define GRAY1 gray1.pixel
- #define GRAY2 gray2.pixel
- #define GRAY3 gray3.pixel
- #define GRAY4 BlackPixel(display, screen_number)
- #define min(a,b) (a < b ? a : b)
- #define max(a,b) (a > b ? a : b)
- #define DEFAULT_SIZE "100.0"
- #define DEFAULT_CHAR "65"
- /* Global variables for rasterizer parameters */
- float Size=400.0, Slant=0.0, Extent=1.0, Angle=0.0;
- int Modflag=0;
- int FontID=0, Caching=1, DeviceResolution=72;
- int StrokeWidth;
- int nofonts;
- long Space=0;
- int Opacity=0;
- int aalevel;
- char TestString[1024]="Test";
- int TestChar=70;
- char EncodingFile[128]="";
- char LastEncodingFile[128]="";
- struct
- {
- char *encfilename;
- char **encoding;
- }
- encstruct[MAXENCODINGS];
- int *last_resolution;
- float *lastExtent;
- float *lastSlant;
- int LigDetect=0;
- unsigned long fg, bg, outbg;
- Pixmap tmp_pixmap=0;
- Pixmap white_pixmap=0;
- Pixmap perf_pixmap;
- Pixmap pixmap;
- XImage *ximage;
- XColor edit_color, gray0, gray1, gray2, gray3, gray4;
- XColor white, black, gray, red, green, blue, pink4, yellow,
- gridcolor1, gridcolor2,wozu;
- XColor aacolors[AAMAXPLANES];
- unsigned long aapixels[AAMAXPLANES];
- XGCValues xgcvalues;
-
- unsigned short dummy;
- char input;
- int overallwidth;
- char commandline[256];
- GLYPH *glyph;
- GLYPH *glyph1, *glyph2;
- char **Encoding=NULL;
- unsigned int height, width;
- char statusstring[1024];
- T1_TMATRIX matrix;
- T1_TMATRIX *matrixP;
- static char msg_buf[256];
- /* How t1lib pads lines: */
- int t1_pad=0;
- /* When to swap bytes in aa-pixels? */
- int xglyph_byte_order;
- /* The following is for time measurements: */
- struct timeval time_start, time_stop;
- struct timeval *time_ptr_start, *time_ptr_stop;
- void *void_ptr;
- /* Global X(t)-stuff */
- Display *display;
- Screen *screen;
- int screennumber;
- int depth;
- Widget TopLevel;
- Widget OutputWindow;
- Widget Output;
- Widget OutputWindow2;
- Widget Output2;
- Widget dialogfontid;
- Widget dialogsize;
- Widget dialogslant;
- Widget dialogextent;
- Widget dialogangle;
- Widget dialogteststring;
- Widget dialogtestcharacter;
- Widget dialogdevres;
- Widget dialogstroke;
- Widget dialogencfile;
- Widget dialogspace;
- Widget dialogtmatrix;
- Widget labelstatus;
- Widget fgcolorbutton;
- Widget bgcolorbutton;
- /* color setting widgets */
- Widget fgwhitebutton;
- Widget fgblackbutton;
- Widget fggraybutton;
- Widget fgredbutton;
- Widget fggreenbutton;
- Widget fgbluebutton;
- Widget bgwhitebutton;
- Widget bgblackbutton;
- Widget bggraybutton;
- Widget bgredbutton;
- Widget bggreenbutton;
- Widget bgbluebutton;
- Widget fglabel;
- Widget bglabel;
- Widget colorbox;
- Widget fgstatus;
- Widget bgstatus;
- Widget optionsbox;
- /* Commandline handling */
- char *xglyphoptions[]={"--help", /* 0 */
- "--Help", /* 1 */
- "--noGrid", /* 2 */
- "--setPad", /* 3 */
- "--logError", /* 4 */
- "--logWarning", /* 5 */
- "--logStatistic", /* 6 */
- "--logDebug", /* 7 */
- "--ignoreForceBold", /* 8 */
- "--ignoreFamilyAlignment", /* 9 */
- "--ignoreHinting", /* 10 */
- "--ignoreAFM", /* 11 */
- "--debugLine", /* 12 */
- "--debugRegion", /* 13 */
- "--debugPath", /* 14 */
- "--debugFont", /* 15 */
- "--debugHint", /* 16 */
- "--checkPerformance", /* 17 */
- "--checkCopyFont", /* 18 */
- "--checkConcatGlyphs", /* 19 */
- "--checkConcatOutlines", /* 20 */
- "--checkBadCharHandling", /* 21 */
- "--checkDefaultEncoding", /* 22 */
- "--checkSmartAntialiasing", /* 23 */
- "--checkAACaching", /* 24 */
- "--checkSetRect", /* 25 */
- "--cacheStrokedGlyphs", /* 26 */
- NULL};
- int extraflags=0;
- /* #define SHOW_MANIPULATE_PATHS */
- #ifdef SHOW_MANIPULATE_PATHS
- void mymanipulate( long *x, long *y, int type)
- {
- double corr;
- double dx, dy;
- dx=(double)*x;
- dy=(double)*y;
-
- /* we have to scale down because we deal with fractional pels */
- /*
- corr=0.000000000000004*dx*dx;
- dy *=1.0+corr;
- */
- /*
- #define PERIOD 500.0
- corr=65536.0*0.5*sin(2*PI/PERIOD/65536.0*dx);
- dy +=corr*30.0;
- */
- *y=(long)dy;
-
- }
- #endif
-
-
- int main( int argc, char **argv)
- {
-
- XtAppContext TopLevelApp;
- Arg args[10];
-
-
- int i, j, numopts=0;
-
- Widget kerningbutton;
- Widget ligaturbutton;
- Widget r2lbutton;
- Widget showcharbutton;
- Widget showstringbutton;
- Widget aashowcharbutton;
- Widget aashowstringbutton;
- Widget showcharbuttonX;
- Widget showstringbuttonX;
- Widget aashowcharbuttonX;
- Widget aashowstringbuttonX;
- Widget stringlabel;
- Widget aboutbutton;
- Widget opacitybutton;
- Widget underlinebutton;
- Widget overstrikebutton;
- Widget overlinebutton;
- Widget transbox;
- Widget fonttablebutton;
- Widget aalevelbutton;
-
-
- Widget exitbutton;
-
- Widget box;
-
-
- int rasterflags=0, initflags=0, optfound;
- int loglevel=0;
-
- i=0;
- j=0;
-
- while (xglyphoptions[i++]!=NULL)
- numopts++;
-
- for ( i=1; i<argc; i++){
- if (strncmp(&(argv[i][0]), "--", 2)==0){
- j=0;
- optfound=0;
- while ( (j<numopts) && optfound==0){
- if (strcmp(argv[i],xglyphoptions[j])==0){
- switch (j){
- case 0:
- printusage( 8); /* Show 8 options */
- exit(0);
- case 1:
- printusage( 0); /* Show all options */
- exit(0);
- case 2:
- extraflags |= NO_GRID;
- optfound=1;
- break;
- case 3:
- /* We have to examine one further argument */
- i++;
- if (strcmp( argv[i], "8")==0)
- t1_pad=8;
- else if (strcmp( argv[i], "16")==0)
- t1_pad=16;
- else if (strcmp( argv[i], "32")==0)
- t1_pad=32;
- else{
- fprintf( stderr, "xglyph: Invalid padding specification %s\n",
- argv[i]);
- exit(-1);
- }
- optfound=1;
- break;
- case 4:
- loglevel = T1LOG_ERROR;
- loglevel |= (0x01 << 8);
- optfound=1;
- break;
- case 5:
- loglevel = T1LOG_WARNING;
- loglevel |= (0x01 << 8);
- optfound=1;
- break;
- case 6:
- loglevel = T1LOG_STATISTIC;
- loglevel |= (0x01 << 8);
- optfound=1;
- break;
- case 7:
- loglevel = T1LOG_DEBUG;
- loglevel |= (0x01 << 8);
- optfound=1;
- break;
- case 8:
- rasterflags |= T1_IGNORE_FORCEBOLD;
- optfound=1;
- break;
- case 9:
- rasterflags |= T1_IGNORE_FAMILYALIGNMENT;
- optfound=1;
- break;
- case 10:
- rasterflags |= T1_IGNORE_HINTING;
- optfound=1;
- break;
- case 11:
- initflags |= T1_NO_AFM;
- optfound=1;
- break;
- case 12:
- rasterflags |= T1_DEBUG_LINE;
- optfound=1;
- break;
- case 13:
- rasterflags |= T1_DEBUG_REGION;
- optfound=1;
- break;
- case 14:
- rasterflags |= T1_DEBUG_PATH;
- optfound=1;
- break;
- case 15:
- rasterflags |= T1_DEBUG_FONT;
- optfound=1;
- break;
- case 16:
- rasterflags |= T1_DEBUG_HINT;
- optfound=1;
- break;
- case 17:
- extraflags |= CHECK_PERFORMANCE;
- optfound=1;
- break;
- case 18:
- extraflags |= CHECK_T1_COPYFONT_T1_ADDFONT;
- optfound=1;
- break;
- case 19:
- extraflags |= CHECK_CONCATGLYPHS;
- optfound=1;
- break;
- case 20:
- extraflags |= CHECK_CONCATOUTLINES;
- optfound=1;
- break;
- case 21:
- extraflags |= CHECK_FOR_BAD_CHARS;
- optfound=1;
- break;
- case 22:
- extraflags |= CHECK_DEFAULT_ENCODING;
- optfound=1;
- break;
- case 23:
- extraflags |= CHECK_SMART_AA;
- optfound=1;
- break;
- case 24:
- extraflags |= CHECK_AA_CACHING;
- optfound=1;
- break;
- case 25:
- extraflags |= CHECK_SET_RECT;
- optfound = 1;
- break;
- case 26:
- extraflags |= CHECK_CACHE_STROKED;
- optfound = 1;
- break;
- default: /* should not be reached */
- break;
- }
- } /* end of "if (strcmp.." */
- j++;
- }
- if (optfound==0){
- fprintf( stderr, "xglyph: Unknown option %s\n",
- argv[i]);
- exit(-1);
- }
- }
- else /* string doesn't start with "--" -> no option */
- break;
- }
-
-
- /* Assign address of time parameter */
- time_ptr_start=&time_start;
- time_ptr_stop=&time_stop;
-
- /* Check for environment entry. If not set, set it to current
- directory so that configuration file is found there */
- /* It violates the Debian Policy */
- #if 0
- if (getenv("T1LIB_CONFIG")==NULL){
- putenv( "T1LIB_CONFIG=./t1lib.config");
- }
- #endif
-
- /* Set log-level: */
- T1_SetLogLevel( loglevel & (~(0x01<<8)));
-
- /* Get padding value if not set from commandline. For 32 bit architectures
- like Intel, 16 might be the best padding default value: */
- if (t1_pad==0)
- t1_pad=16;
- if (T1_SetBitmapPad( t1_pad)!=0){
- t1_pad=T1_GetBitmapPad();
- }
-
-
- /* Initialize t1-library. If xglyph is called with arguments
- that are no options, we assume that the arguments are font
- files and ignore the fontdata base file. At this point the value of
- "i" is the number of commandline arg that is supposed to contain a
- fontfile name (or it is argc, if no files where specified).
- Note further that "loglevel" contains (1) info whether to create a log
- file in the first bit of the higher byte of the lower word and
- (2) info which loglevel to set. (3) It further may contain more
- initialization flags.
- */
- if ((extraflags & CHECK_AA_CACHING)){
- loglevel |= (T1_AA_CACHING<<8);
- }
-
- if (i==argc){
- if (T1_InitLib( (loglevel>>8) | initflags )==NULL){
- fprintf(stderr,"Initialization of t1lib failed (T1_errno=%d)!\n",
- T1_errno);
- return(-1);
- }
- }
- else{ /* There are still arguments which we interprete as fontfile names */
- if (T1_InitLib( (loglevel>>8) | initflags | IGNORE_FONTDATABASE )==NULL){
- fprintf(stderr,"Initialization of t1lib failed (T1_errno=%d)!\n",
- T1_errno);
- return(-1);
- }
- /* We start adding fonts as the i-th commandline arguments */
- for ( j=i; j<argc; j++){
- T1_AddFont( argv[j]);
- }
- }
- /* We return if no fonts could be installed */
- if ((j=T1_GetNoFonts())<=0){
- fprintf(stderr,"xglyph: No fonts in database (T1_errno=%d)!\n", T1_errno);
- return(-1);
- }
-
- /* Set the raster parameters */
- T1_SetRasterFlags( rasterflags);
- /* Load alternate encoding and associate it with filename: */
- encstruct[0].encoding=T1_LoadEncoding(T1LIBENCFILE);
- encstruct[0].encfilename=(char *)malloc(strlen(T1LIBENCFILE)+1);
- strcpy( encstruct[0].encfilename, T1LIBENCFILE);
- for ( i=1; i<MAXENCODINGS; i++){
- encstruct[i].encoding=NULL;
- encstruct[i].encfilename=NULL;
- }
-
-
- /* If requested, set a default encoding vector */
- if (extraflags & CHECK_DEFAULT_ENCODING){
- T1_SetDefaultEncoding( encstruct[0].encoding);
- }
-
-
- if( extraflags & CHECK_T1_COPYFONT_T1_ADDFONT){
- {
- int k;
-
- /* The following code is to test the T1_CopyFont()-function. It
- generates logical fonts with IDs twice the ID of the original
- font which are then slanted by 0.3. */
- nofonts=T1_GetNoFonts();
- printf("Initial number of fonts: %d\n", nofonts);
-
- for (i=0; i< nofonts; i++){
- T1_LoadFont(i);
- if ((k=T1_CopyFont(i))<0){
- fprintf(stderr,"T1_CopyFont() unsuccessful (k=%d), for FontID=%d\n", k, i);
- }else{
- T1_SlantFont(k,0.3);
- fprintf(stderr,"Slanted Font under FontID %d generated\n", k);
- }
- }
- fprintf( stderr, "T1_AddFont() returned newID %d for fontfile %s!\n",
- T1_AddFont( TESTFONTFILE), TESTFONTFILE);
-
- nofonts=T1_GetNoFonts();
- printf("Final number of fonts: %d\n", nofonts);
- }
- }
- /* Setup arrays for the last... values */
- nofonts=T1_GetNoFonts();
- if ( (last_resolution=(int *) malloc ( nofonts * sizeof(int)))==NULL){
- fprintf( stderr, "xglyph: memory allocation error\n");
- exit(1);
- }
- else
- for (i=0; i<nofonts; i++)
- last_resolution[i]=72;
- if ( (lastSlant=(float *) malloc ( nofonts * sizeof(float)))==NULL){
- fprintf( stderr, "xglyph: memory allocation error\n");
- exit(1);
- }
- else
- for (i=0; i<nofonts; i++)
- lastSlant[i]=0.0;
- if ( (lastExtent=(float *) malloc ( nofonts * sizeof(float)))==NULL){
- fprintf( stderr, "xglyph: memory allocation error\n");
- exit(1);
- }
- else
- for (i=0; i<nofonts; i++)
- lastExtent[i]=1.0;
- if (extraflags & CHECK_SMART_AA)
- T1_AASetSmartMode( T1_YES);
-
- /* If checking caching of stroked characters is enabled via command line,
- we call T1_StrokeFont() on each font in the database. This is valid
- here since we do not already have glyph data. */
- if ( extraflags & CHECK_CACHE_STROKED ) {
- for ( i=0; i<nofonts; i++) {
- T1_LoadFont(i);
- T1_StrokeFont( i, 1);
- }
- }
- /* Initialize application */
- TopLevel = XtAppInitialize(&TopLevelApp, (String) "Xglyph", (XrmOptionDescList) NULL,
- (Cardinal) 0,
- &argc,
- argv,
- (String *) NULL,
- (ArgList) NULL,
- (Cardinal) 0);
- i=0;
- XtSetArg(args[i], XtNheight, APPLICATIONHEIGHT); i++;
- XtSetValues(TopLevel,args,i);
- /* Create window for graphics output */
- Output = XtCreatePopupShell( "Xglyph-Output", topLevelShellWidgetClass,
- TopLevel, NULL,0);
- OutputWindow = XtCreateManagedWidget("xglyph-Output",labelWidgetClass, Output,
- NULL, 0);
-
- /* Get display/screen pointer and screennumber */
- display = XtDisplay(OutputWindow);
- screen = XtScreen(OutputWindow);
- screennumber = DefaultScreen(display);
- depth = DefaultDepth(display,screennumber);
- /* In case client and server have different endian architecture,
- we have to care for the 16 and 32 bit aa-pixels to have the
- correct byte order */
- if (T1_CheckEndian()==0)
- xglyph_byte_order=0;
- else
- xglyph_byte_order=1;
-
- if( extraflags & CHECK_PERFORMANCE){
- perf_pixmap=0;
- /* The following is for testing only */
- Output2 = XtCreatePopupShell( "Xglyph-Output2", topLevelShellWidgetClass,
- TopLevel, NULL,0);
-
- OutputWindow2 = XtCreateManagedWidget("xglyph-Output2",labelWidgetClass, Output2,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 800 ); i++;
- XtSetArg( args[i], XtNheight, 600 ); i++;
- XtSetValues(OutputWindow2,args,i);
- }
-
- /* Get colors and assign pixel values: */
- XAllocNamedColor(display, DefaultColormap(display,screennumber), EDITABLE_COLOR,
- &edit_color, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "green",
- &green, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "blue",
- &blue, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "black",
- &gray4, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "gray25",
- &gray3, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "gray50",
- &gray2, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "gray75",
- &gray1, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "white",
- &gray0, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "yellow",
- &yellow, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "pink4",
- &pink4, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "cyan",
- &gridcolor1, &wozu);
- XAllocNamedColor(display, DefaultColormap(display,screennumber), "magenta",
- &gridcolor2, &wozu);
- white=gray0;
- black=gray4;
- gray=gray1;
- red=edit_color;
- /* Fill the aacolors and aapixels-array */
- ComputeAAColorsX( black.pixel, white.pixel, AAMAXPLANES);
-
- /* Set default colors for X11 rastering functions */
- fg=black.pixel;
- bg=white.pixel;
-
-
- T1_AASetBitsPerPixel(DefaultDepth(display,screennumber));
- /* T1_LogicalPositionX( 0); */
-
-
- /* The box-widget for all the buttons */
- box=XtCreateManagedWidget("xglyph", boxWidgetClass, TopLevel, NULL, 0);
- i=0;
- XtSetArg(args[i], XtNheight,400); i++;
- XtSetValues(box,args,i);
-
-
- /* A dialogbox for the fontID-specification */
- dialogfontid=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "FontID:"); i++;
- XtSetArg(args[i], XtNvalue, "0"); i++;
- XtSetValues(dialogfontid,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogfontid,"value"),args,i);
-
-
- /* A dialogbox for the font-Size */
- dialogsize=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Font-Size [bp]:"); i++;
- XtSetArg(args[i], XtNvalue, DEFAULT_SIZE); i++;
- XtSetValues(dialogsize,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogsize,"value"),args,i);
-
-
- /* A dialogbox for the font slant specification */
- dialogslant=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Slant:"); i++;
- XtSetArg(args[i], XtNvalue, "0.0"); i++;
- XtSetValues(dialogslant,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH / 2 - 8); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogslant,"value"),args,i);
-
-
- /* A dialogbox for the font-extension */
- dialogextent=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Extension:"); i++;
- XtSetArg(args[i], XtNvalue, "1.0"); i++;
- XtSetValues(dialogextent,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH / 2 - 8); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogextent,"value"),args,i);
-
-
- /* transformation matrix dialog widget */
- dialogtmatrix = XtCreateManagedWidget( "dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Transformation-Matrix:"); i++;
- XtSetArg(args[i], XtNvalue, "1.0, 0.0, 0.0, 1.0"); i++;
- XtSetValues(dialogtmatrix,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogtmatrix,"value"),args,i);
-
- /* A dialogbox for the device resolution */
- dialogdevres=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Res [DPI]"); i++;
- XtSetArg(args[i], XtNvalue, "72"); i++;
- XtSetValues(dialogdevres,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH / 2 - 8); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogdevres,"value"),args,i);
-
-
- /* A dialogbox for the strokewidth */
- dialogstroke=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "S-Width"); i++;
- if ( extraflags & CHECK_CACHE_STROKED ) {
- XtSetArg(args[i], XtNvalue, "10");
- i++;
- }
- else {
- XtSetArg(args[i], XtNvalue, "0");
- i++;
- }
- XtSetValues(dialogstroke,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH / 2 - 8); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogstroke,"value"),args,i);
-
-
- /* A dialogbox for the encoding filename */
- dialogencfile=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Encoding-File:"); i++;
- XtSetArg(args[i], XtNvalue, ""); i++;
- XtSetValues(dialogencfile,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogencfile,"value"),args,i);
-
-
- /* A dialogbox for the angle */
- dialogangle=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Angle [deg]:"); i++;
- XtSetArg(args[i], XtNvalue, "0.0"); i++;
- XtSetValues(dialogangle,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogangle,"value"),args,i);
-
-
- /* A dialogbox for the space-offset in strings */
- dialogspace=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Space-Off [1/1000 bp]:"); i++;
- XtSetArg(args[i], XtNvalue, "0"); i++;
- XtSetValues(dialogspace,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogspace,"value"),args,i);
-
-
- /* A dialogbox for the character */
- dialogtestcharacter=XtCreateManagedWidget("dialog1", dialogWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNlabel, "Character (decimal):"); i++;
- XtSetArg(args[i], XtNvalue, DEFAULT_CHAR); i++;
- XtSetValues(dialogtestcharacter,args,i);
- i=0;
- XtSetArg(args[i], XtNwidth,DIALOGWIDTH); i++;
- XtSetArg(args[i], XtNheight,DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNresize, FALSE); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(XtNameToWidget(dialogtestcharacter,"value"),args,i);
-
-
- /* The box for color selecting buttons for the
- X11-rastering functions */
- optionsbox=XtCreateManagedWidget("box", boxWidgetClass, box, NULL, 0);
- i=0;
- XtSetArg(args[i], XtNheight, DIALOGHEIGHT); i++;
- XtSetArg(args[i], XtNwidth, DIALOGWIDTH + 30); i++;
- XtSetValues(optionsbox,args,i);
- /* The toggle widget for kerning (un-)setting */
- kerningbutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "Kerning" ); i++;
- XtSetValues(kerningbutton,args,i);
- XtAddCallback( kerningbutton, XtNcallback,
- (XtCallbackProc) togglekerning, (XtPointer) 0 );
- /* The toggle widget for ligatur-detection (un-)setting */
- ligaturbutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "Ligature" ); i++;
- XtSetValues(ligaturbutton,args,i);
- XtAddCallback( ligaturbutton, XtNcallback,
- (XtCallbackProc) toggleligatur, (XtPointer) 0 );
- /* The toggle widget for the typesetting direction switch message */
- r2lbutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "|-->" ); i++;
- XtSetValues(r2lbutton,args,i);
- XtAddCallback( r2lbutton, XtNcallback,
- (XtCallbackProc) toggler2l, (XtPointer) 0 );
- /* The toggle widget for underlining (un-)setting */
- underlinebutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "Underline" ); i++;
- XtSetValues(underlinebutton,args,i);
- XtAddCallback( underlinebutton, XtNcallback,
- (XtCallbackProc) toggleunderline, (XtPointer) 0 );
- /* The toggle widget for underlining (un-)setting */
- overlinebutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "Overline" ); i++;
- XtSetValues(overlinebutton,args,i);
- XtAddCallback( overlinebutton, XtNcallback,
- (XtCallbackProc) toggleoverline, (XtPointer) 0 );
- /* The toggle widget for underlining (un-)setting */
- overstrikebutton = XtCreateManagedWidget("toggle", toggleWidgetClass, optionsbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "Overstrike" ); i++;
- XtSetValues(overstrikebutton,args,i);
- XtAddCallback( overstrikebutton, XtNcallback,
- (XtCallbackProc) toggleoverstrike, (XtPointer) 0 );
- /* The button to raster and display the current character using
- the current settings */
- showcharbutton = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 60 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "Char"); i++;
- XtSetValues(showcharbutton,args,i);
- XtAddCallback( showcharbutton, XtNcallback,
- (XtCallbackProc) showchar, (XtPointer) 0 );
- /* The button to raster and display the current string using
- the current settings */
- showstringbutton = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 60 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "String"); i++;
- XtSetValues(showstringbutton,args,i);
- XtAddCallback( showstringbutton, XtNcallback,
- (XtCallbackProc) showstring, (XtPointer) 0 );
- /* The button to raster and display the current character using
- the current settings and antialiasing */
- aashowcharbutton = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 120 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "AAChar"); i++;
- XtSetValues(aashowcharbutton,args,i);
- XtAddCallback( aashowcharbutton, XtNcallback,
- (XtCallbackProc) aashowchar, (XtPointer) 0 );
- /* The button to raster and display the current string using
- the current settings and antialiasing */
- aashowstringbutton = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 120 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "AAString"); i++;
- XtSetValues(aashowstringbutton,args,i);
- XtAddCallback( aashowstringbutton, XtNcallback,
- (XtCallbackProc) aashowstring, (XtPointer) 0 );
- /* The button to raster and display the current character using
- the current settings */
- showcharbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 60 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "CharX"); i++;
- XtSetValues(showcharbuttonX,args,i);
- XtAddCallback( showcharbuttonX, XtNcallback,
- (XtCallbackProc) showcharX, (XtPointer) 0 );
-
- /* The button to raster and display the current string using
- the current settings */
- showstringbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 60 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "StringX"); i++;
- XtSetValues(showstringbuttonX,args,i);
- XtAddCallback( showstringbuttonX, XtNcallback,
- (XtCallbackProc) showstringX, (XtPointer) 0 );
- /* The button to raster and display the current character using
- the current settings and antialiasing */
- aashowcharbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 120 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "AACharX"); i++;
- XtSetValues(aashowcharbuttonX,args,i);
- XtAddCallback( aashowcharbuttonX, XtNcallback,
- (XtCallbackProc) aashowcharX, (XtPointer) 0 );
- /* The button to raster and display the current string using
- the current settings and antialiasing */
- aashowstringbuttonX = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 120 ); i++;
- XtSetArg( args[i], XtNheight, ACTIONBUTTONHEIGHT ); i++;
- XtSetArg( args[i], XtNlabel, "AAStringX"); i++;
- XtSetValues(aashowstringbuttonX,args,i);
- XtAddCallback( aashowstringbuttonX, XtNcallback,
- (XtCallbackProc) aashowstringX, (XtPointer) 0 );
-
- /* The box for color trasp/op and fonttable button */
- transbox=XtCreateManagedWidget("box", boxWidgetClass, box, NULL, 0);
- i=0;
- XtSetArg(args[i], XtNheight,20); i++;
- XtSetArg(args[i], XtNwidth,90); i++;
- XtSetValues(transbox,args,i);
-
- /* The button to display an AA font table */
- fonttablebutton = XtCreateManagedWidget("Com", commandWidgetClass, transbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 80 ); i++;
- XtSetArg( args[i], XtNheight, 15 ); i++;
- XtSetArg( args[i], XtNlabel, "Font Table"); i++;
- XtSetValues(fonttablebutton,args,i);
- XtAddCallback( fonttablebutton, XtNcallback,
- (XtCallbackProc) fonttable, (XtPointer) 0 );
-
- /* The toggle widget for opacity/transparency */
- opacitybutton = XtCreateManagedWidget("toggle", toggleWidgetClass, transbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 80 ); i++;
- XtSetArg( args[i], XtNheight, 15 ); i++;
- XtSetArg( args[i], XtNlabel, "Transparent" ); i++;
- XtSetValues(opacitybutton,args,i);
- XtAddCallback( opacitybutton, XtNcallback,
- (XtCallbackProc) toggleopacity, (XtPointer) 0 );
- outbg=pink4.pixel; /* the initial bgcolor for transparent mode */
-
- /* The toggle widget for opacity/transparency */
- aalevelbutton = XtCreateManagedWidget("toggle", toggleWidgetClass, transbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 80 ); i++;
- XtSetArg( args[i], XtNheight, 15 ); i++;
- XtSetArg( args[i], XtNlabel, "AA-Low" ); i++;
- XtSetValues(aalevelbutton,args,i);
- XtAddCallback( aalevelbutton, XtNcallback,
- (XtCallbackProc) toggleaalevel, (XtPointer) 0 );
- aalevel=T1_AA_LOW; /* the initial bgcolor for transparent mode */
- /* The box for color selecting buttons for the
- X11-rastering functions */
- colorbox=XtCreateManagedWidget("box", boxWidgetClass, box, NULL, 0);
- i=0;
- XtSetArg(args[i], XtNheight,20); i++;
- XtSetArg(args[i], XtNwidth,280); i++;
- XtSetValues(colorbox,args,i);
- /* FG-label */
- fgstatus = XtCreateManagedWidget("label", labelWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, fg); i++;
- XtSetValues(fgstatus,args,i);
-
- fglabel = XtCreateManagedWidget("label", labelWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 80 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "Foreground"); i++;
- XtSetValues(fglabel,args,i);
-
- fgwhitebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, white.pixel); i++;
- XtSetValues(fgwhitebutton,args,i);
- XtAddCallback( fgwhitebutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- fgblackbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, black.pixel); i++;
- XtSetValues(fgblackbutton,args,i);
- XtAddCallback( fgblackbutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- fggraybutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, gray.pixel); i++;
- XtSetValues(fggraybutton,args,i);
- XtAddCallback( fggraybutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- fgredbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, red.pixel); i++;
- XtSetValues(fgredbutton,args,i);
- XtAddCallback( fgredbutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- fggreenbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, green.pixel); i++;
- XtSetValues(fggreenbutton,args,i);
- XtAddCallback( fggreenbutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- fgbluebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, blue.pixel); i++;
- XtSetValues(fgbluebutton,args,i);
- XtAddCallback( fgbluebutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- /* BG-label */
- bgstatus = XtCreateManagedWidget("label", labelWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, bg); i++;
- XtSetValues(bgstatus,args,i);
-
- bglabel = XtCreateManagedWidget("label", labelWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 80 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "Background"); i++;
- XtSetValues(bglabel,args,i);
-
- bgwhitebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, white.pixel); i++;
- XtSetValues(bgwhitebutton,args,i);
- XtAddCallback( bgwhitebutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- bgblackbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, black.pixel); i++;
- XtSetValues(bgblackbutton,args,i);
- XtAddCallback( bgblackbutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- bggraybutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, gray.pixel); i++;
- XtSetValues(bggraybutton,args,i);
- XtAddCallback( bggraybutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- bgredbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, red.pixel); i++;
- XtSetValues(bgredbutton,args,i);
- XtAddCallback( bgredbutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- bggreenbutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, green.pixel); i++;
- XtSetValues(bggreenbutton,args,i);
- XtAddCallback( bggreenbutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
- bgbluebutton = XtCreateManagedWidget("Com", commandWidgetClass, colorbox,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 20 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, ""); i++;
- XtSetArg( args[i], XtNbackground, blue.pixel); i++;
- XtSetValues(bgbluebutton,args,i);
- XtAddCallback( bgbluebutton, XtNcallback,
- (XtCallbackProc) setcolor, (XtPointer) 0 );
-
- /* Label for the next box */
- stringlabel=XtCreateManagedWidget("Label", labelWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNwidth,380); i++;
- XtSetArg(args[i], XtNlabel, "Test-String:"); i++;
- XtSetValues(stringlabel,args,i);
-
-
- /* An input-box for the test-string */
- dialogteststring=XtCreateManagedWidget("dialog1", asciiTextWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNwidth,380); i++;
- XtSetArg(args[i], XtNheight,30); i++;
- XtSetArg(args[i], XtNwrap, XawtextWrapLine); i++;
- XtSetArg(args[i], XtNeditType, XawtextEdit ); i++;
- XtSetArg(args[i], XtNforeground, edit_color.pixel); i++;
- XtSetValues(dialogteststring,args,i);
-
- /* Label for the next box */
- labelstatus=XtCreateManagedWidget("Label", labelWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg(args[i], XtNwidth,380); i++;
- XtSetArg(args[i], XtNheight, MESSAGEBOXHEIGHT); i++;
- XtSetArg(args[i], XtNlabel, "No Messages!"); i++;
- XtSetValues(labelstatus,args,i);
-
- /* The button to exit the program */
- exitbutton = XtCreateManagedWidget("Com2", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 100 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNx, 0 ); i++;
- XtSetArg( args[i], XtNy, 0 ); i++;
- XtSetArg( args[i], XtNlabel, " Exit Program"); i++;
- XtSetValues(exitbutton,args,i);
- XtAddCallback( exitbutton, XtNcallback,
- (XtCallbackProc) exitprog, (XtPointer) 0 );
- /* The About widget for the about message */
- aboutbutton = XtCreateManagedWidget("Com", commandWidgetClass, box,
- NULL, 0);
- i=0;
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "About" ); i++;
- XtSetValues(aboutbutton,args,i);
- XtAddCallback( aboutbutton, XtNcallback,
- (XtCallbackProc) showabout, (XtPointer) 0 );
- XtRealizeWidget(TopLevel);
- XtPopup(Output,XtGrabNone);
- if( extraflags & CHECK_PERFORMANCE){
- XtPopup(Output2,XtGrabNone);
- }
-
- /* Set parameters for X11-support */
- T1_SetX11Params( display, DefaultVisual(display, screennumber),
- DefaultDepth( display, screennumber),
- DefaultColormap(display, screennumber));
-
- /* Create a dummy-pixmap because we need one to destroy before
- the next is created! */
- pixmap = XCreatePixmap(display,
- XtWindow(OutputWindow),
- 200,
- 200,
- DefaultDepth(display,screennumber)
- );
-
-
-
- XtAppMainLoop(TopLevelApp);
-
- return(0);
-
- }
- /* Compute the BBox of a rotated box: */
- BBox ComputeRotBBox( BBox inbox, float angle)
- {
- int i;
- BBox resultbox={ 0, 0, 0, 0};
- struct point
- {
- double x;
- double y;
- } p[4], P[4];
-
- double sinalpha, cosalpha;
-
- sinalpha=sin((double)angle*PI/180);
- cosalpha=cos((double)angle*PI/180);
- /* initialize points */
- p[0].x=(double) inbox.llx;
- p[0].y=(double) inbox.lly;
- p[1].x=(double) inbox.urx;
- p[1].y=(double) inbox.lly;
- p[2].x=(double) inbox.urx;
- p[2].y=(double) inbox.ury;
- p[3].x=(double) inbox.llx;
- p[3].y=(double) inbox.ury;
- /*
- fprintf( stderr, "InBox: (%f,%f), (%f,%f), (%f,%f), (%f,%f)\n",
- p[0].x, p[0].y, p[1].x, p[1].y, p[2].x, p[2].y,
- p[3].x, p[3].y);
- */
- /* Compute tranformed points */
- P[0].x=p[0].x*cosalpha-p[0].y*sinalpha;
- P[0].y=p[0].x*sinalpha+p[0].y*cosalpha;
- P[1].x=p[1].x*cosalpha-p[1].y*sinalpha;
- P[1].y=p[1].x*sinalpha+p[1].y*cosalpha;
- P[2].x=p[2].x*cosalpha-p[2].y*sinalpha;
- P[2].y=p[2].x*sinalpha+p[2].y*cosalpha;
- P[3].x=p[3].x*cosalpha-p[3].y*sinalpha;
- P[3].y=p[3].x*sinalpha+p[3].y*cosalpha;
- /*
- fprintf( stderr, "RotPoints: (%f,%f), (%f,%f), (%f,%f), (%f,%f)\n",
- P[0].x, P[0].y, P[1].x, P[1].y, P[2].x, P[2].y,
- P[3].x, P[3].y);
- */
- /* Get BBox: */
- for (i=0; i<4; i++){
- if (P[i].x < (float) resultbox.llx)
- resultbox.llx=(int) floor(P[i].x +0.5);
- if (P[i].x > (float) resultbox.urx)
- resultbox.urx=(int) floor(P[i].x +0.5);
- if (P[i].y < (float) resultbox.lly)
- resultbox.lly=(int) floor(P[i].y +0.5);
- if (P[i].y > (float) resultbox.ury)
- resultbox.ury=(int) floor(P[i].y +0.5);
- }
- return(resultbox);
-
- }
- void exitprog(Widget exitbutton, XtPointer client_data , XtPointer call_data)
- {
- int i;
-
- for (i=0; i< T1_GetNoFonts(); i++){
- /* printf("Enc-Scheme=%s\n", T1_GetEncodingScheme( i));*/
- ;
- }
- T1_CloseLib();
-
- exit(0);
- }
- void togglekerning( Widget kerningbutton, XtPointer client_data, XtPointer call_data)
- {
- int i;
- char state=0;
- Arg args[10];
- /* Get state of toggle Button: */
- i=0;
- XtSetArg(args[i], XtNstate, &state); i++;
- XtGetValues(kerningbutton,args,1);
- if ((state))
- Modflag |= T1_KERNING;
- else
- Modflag &= ~T1_KERNING;
-
- }
- void toggleligatur( Widget ligaturbutton, XtPointer client_data, XtPointer call_data)
- {
- int i;
- char state=0;
- Arg args[10];
- /* Get state of toggle Button: */
- i=0;
- XtSetArg(args[i], XtNstate, &state); i++;
- XtGetValues(ligaturbutton,args,1);
- LigDetect=state;
- }
- void toggler2l( Widget r2lbutton, XtPointer client_data, XtPointer call_data)
- {
- int i;
- char state=0;
- Arg args[10];
- /* Get state of toggle Button: */
- i=0;
- XtSetArg(args[i], XtNstate, &state); i++;
- XtGetValues(r2lbutton,args,1);
- if ((state))
- Modflag |= T1_RIGHT_TO_LEFT;
- else
- Modflag &= ~T1_RIGHT_TO_LEFT;
-
- /* Invert state */
- i=0;
- if (state){
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "<--|" ); i++;
- }
- else{
- XtSetArg( args[i], XtNwidth, 55 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- XtSetArg( args[i], XtNlabel, "|-->" ); i++;
- }
- XtSetValues(r2lbutton,args,i);
- }
- void toggleunderline( Widget underlinebutton, XtPointer client_data, XtPointer call_data)
- {
- int i;
- char state=0;
- Arg args[10];
- /* Get state of toggle Button: */
- i=0;
- XtSetArg(args[i], XtNstate, &state); i++;
- XtGetValues(underlinebutton,args,1);
- if ((state))
- Modflag |= T1_UNDERLINE;
- else
- Modflag &= ~T1_UNDERLINE;
-
- }
- void toggleoverline( Widget overlinebutton, XtPointer client_data, XtPointer call_data)
- {
- int i;
- char state=0;
- Arg args[10];
- /* Get state of toggle Button: */
- i=0;
- XtSetArg(args[i], XtNstate, &state); i++;
- XtGetValues( overlinebutton,args,1);
- if ((state))
- Modflag |= T1_OVERLINE;
- else
- Modflag &= ~T1_OVERLINE;
-
- }
- void toggleoverstrike( Widget overstrikebutton, XtPointer client_data, XtPointer call_data)
- {
- int i;
- char state=0;
- Arg args[10];
- /* Get state of toggle Button: */
- i=0;
- XtSetArg(args[i], XtNstate, &state); i++;
- XtGetValues( overstrikebutton,args,1);
- if ((state))
- Modflag |= T1_OVERSTRIKE;
- else
- Modflag &= ~T1_OVERSTRIKE;
-
- }
- void toggleopacity( Widget opacitybutton, XtPointer client_data, XtPointer call_data)
- {
- int i;
- char state=0;
- Arg args[10];
- /* Get state of toggle Button: */
- i=0;
- XtSetArg(args[i], XtNstate, &state); i++;
- XtGetValues(opacitybutton,args,1);
- i=0;
- XtSetArg( args[i], XtNstate, state); i++;
- XtSetArg( args[i], XtNwidth, 80 ); i++;
- XtSetArg( args[i], XtNheight, 20 ); i++;
- Opacity=state;
-
- /* Invert state */
- if (state){
- XtSetArg( args[i], XtNlabel, "Opaque" ); i++;
- XtSetValues(opacitybutton,args,i);
- outbg=bg;
- }
- else{
- XtSetArg…
Large files files are truncated, but you can click here to view the full file