📄 mwfont.c
字号:
/* %kw # %v %n %d %t # */
/* Version # 4 MWFONT.C 26-May-94 15:38:20 # */
/**********************************************************/
/* METAGRAPHICS SOFTWARE CORPORATION (c) 1987-1992 */
/* */
/* Description: This program is an example of how to */
/* manually load a font and make it active. */
/* */
/* Functions used: */
/* FileLoad, SetFont, TextSize */
/**********************************************************/
#define byte unsigned char
#define word unsigned short
#include <stdlib.h>
#include <stdio.h>
#include "metawndo.h" /* master MetaWINDOW include file */
#include "CRTOON16.h"
#include "HELVM15.h"
#include "chicam15.h"
#include "ROMANSIM.h"
/* special stack size declaration if using Turbo or Borland C++ */
#ifdef TurboC
extern unsigned _stklen = 14336U; /* stack size 14K */
#endif
void Waiting(int a);
void mwfont( )
{
void quit(void);
rect scrnR;
// int i,loadErr;
fontRcd *original, *font1Ptr, *font2Ptr, *font3Ptr, *font4Ptr;
grafPort *screenPort;
// int GrafixCard;
mwEvent waitEvent;
/* init the system */
// i = InitGraphics( 2 );
/* save original font buffer pointer */
GetPort( &screenPort );
original = screenPort->txFont;
/* load a file */
// if(strstr(crtoon16,"CRTOON16") || strstr(crtoon16,"crtoon16"))
font1Ptr = (fontRcd *) CRTOON16;
/* load another file */
// if(strstr(helvm15,"HELVM15") || strstr(helvm15,"helvm15"))
font2Ptr = (fontRcd *) HELVM15;
/* load yet another file */
// if(strstr(chicam15,"CHICAM15") || strstr(chicam15,"chicam15"))
font3Ptr = (fontRcd *) CHICAM15;
font4Ptr = (fontRcd *) ROMANSIM;
ScreenRect(&scrnR);
// SetDisplay(GrafPg0);
EraseRect(&scrnR);
RasterOp(xREPx);
TextSize(14,14); /* Set text size for stroked font, ROMANSIM.FNT */
/* Set font 1 active */
SetFont( font1Ptr );
MoveTo(10,10);
DrawString("CRTOON16.FNT");
/* Set font 2 active */
SetFont( font2Ptr );
MoveTo(10,30);
DrawString("HELVM15.FNT");
/* Set font 3 active */
SetFont( font3Ptr );
MoveTo(10,50);
DrawString("CHICAM15.FNT");
/* Set font 4 active */
SetFont( font4Ptr );
MoveTo(10,70);
DrawString("Stroked ROMANSIM.FNT");
/* Set original font active */
SetFont( original );
MoveTo(10,90);
DrawString("System font");
RasterOp(xREPx);
#ifndef CYCLE
MoveTo( 0,scrnR.Ymax - 20 );
DrawString( "Press 'x' to exit" );
MoveTo( 0,scrnR.Ymax - 10 );
DrawString( "any other key to continue" );
while(!KeyEvent(1, &waitEvent));
if((waitEvent.eventChar == 'x') || (waitEvent.eventChar == 'X')) quit();
#else
#ifdef _MNT_
KeyEvent(0, &waitEvent);
if((waitEvent.eventChar == 'x') || (waitEvent.eventChar == 'X')) quit();
#endif
Waiting(150);
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -