예제 #1
0
Instrument *load_instrument_font(struct Renderer *song, const char *font, int drum, int bank, int instr)
{
	FontFile *fontfile = font_find(font);
	if (fontfile != NULL)
	{
		return fontfile->LoadInstrument(song, drum, bank, instr);
	}
	return NULL;
}
예제 #2
0
void font_remove(const char *filename)
{
	FontFile *font;

	font = font_find(filename);
	if (font != NULL)
	{
		// Don't actually remove the font from the list, because instruments
		// from it might be loaded using the %font extension.
		font->SetAllOrders(255);
	}
}
예제 #3
0
/** Command to select a font. */
static int cmd_fontsel(struct cli *cli, int argc, const char *const *argv)
{
    int c;
    int size = 10;
    char *type = NULL;

    optind = 0;
    opterr = 0;
    while ((c = getopt(argc, (char *const *)argv, "s:t:")) != EOF) {
        switch (c) {
        case 's':     // set font size
            size = atoi(optarg);
            break;

        case 't':     // set font weight/style/type
            type = optarg;
            break;

        case ':':
            fprintf(cli->out, "Option \"%s\" requires a parameter." EOL,
                    argv[optind - 1]);
            return 1;

        default:
            fprintf(cli->out, "Unknown option \"%s\"." EOL, argv[optind - 1]);
            return 1;
        }
    }

    if (argv[optind] != NULL) {
        const struct font *f = font_find(argv[optind], type, size);

        if (f == NULL) {
            fprintf(cli->out, "Unable to find a font named \"%s\" of type " \
                              "\"%s\" and size %d." EOL,
                    argv[optind], type ? type : "<any>", size);
            return 1;
        }

        current_font = f;
    }

    fprintf(cli->out, "%s, %s, %d." EOL,
            current_font->name,
            current_font->style,
            current_font->size);

    return 0;
}
예제 #4
0
파일: Hptools.c 프로젝트: ferrasrl/easyHand
SINT HPDispf(SINT CoType,LONG x1,LONG y1,CHAR *font,SINT nfi,CHAR *str)
{
 SINT bmp;
 SINT hdl,maxnfi;
 SINT col1,col2;
 SINT car,y;

 CHAR *p;
 CHAR serv[80];
 struct BMP_HD *BmpHead;

 col1=15;col2=0;

 car=font_find(font,&maxnfi,&hdl); // Cerca il font
 if (car<0) {return -200;}
// Tapullo
#ifndef _WIN32
 bmp=font_bmp(str,RAM_HEAP,hdl,nfi,col1,col2,ON);
#endif
 if (bmp==-4) //bmp=font_bmp(str,RAM_ALTA,hdl,nfi,col1,col2,status);
	 {efx2(); return -100;}

 if (bmp<0) return bmp;
 p=memo_heap(bmp);
 BmpHead=(struct BMP_HD *) p;
 p+=sizeof(struct BMP_HD);

 for (y=0;y<BmpHead->alt;y++)
	{
	 HPCursor(CoType,x1,y1+y);
	 HPEsc("*r1A"); // start raster
	 HPEsc("*b0M"); // metodo di compressione
//	 HPesc("*b80W"); // Inizio trasferimento dati
	 sprintf(serv,"%c*b%dW",ESC,BmpHead->riga);
	 lprintn(serv);
	 lpt_send(p,BmpHead->riga);
	 p+=BmpHead->riga;
	}


 memo_libera(bmp,"disp_lpt");
 return 0;
}
예제 #5
0
void font_add(const char *filename, int load_order)
{
	FontFile *font;

	font = font_find(filename);
	if (font != NULL)
	{
		font->SetAllOrders(load_order);
	}
	else
	{
		FileReader *fp = open_filereader(filename, openmode, NULL);

		if (fp != NULL)
		{
			if ((font = ReadSF2(filename, fp)) || (font = ReadDLS(filename, fp)))
			{
				font->SetAllOrders(load_order);
			}
			delete fp;
		}
	}
}