Skip to main content

How to Change Font Size and Font Family in C++ [NEW]

This is the Programme for Changing Font Size and  Font Family via default fonts in C++

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

/* the names of the text styles supported */
char *fname[] = { "THIS IS A EXAMPLE OF DEFAULT font",
  "THIS IS A EXAMPLE OF TRIPLEX font",
  "SMALL font",
  "SANS SERIF font",
  "GOTHIC font"
};

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int style, midx, midy;
   int size = 1;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "C:/TC/BGI");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
  printf("Graphics error: %s\n", grapherrormsg(errorcode));
  printf("Press any key to halt:");
  getch();
  exit(1); /* terminate with an error code */
   }

   midx = getmaxx() / 2;
   midy = getmaxy() / 2;

   settextjustify(RIGHT_TEXT, CENTER_TEXT);

   /* loop through the available text styles */
   for (style=GOTHIC_FONT; style<=GOTHIC_FONT; style++)
   {
  cleardevice();

  if (style == GOTHIC_FONT)
  size = 4;

  /* select the text style */
  settextstyle(style, HORIZ_DIR, size);

  /* output a message */
  outtextxy(midx, midy, fname[style]);
  getch();
   }

   /* clean up */
   closegraph();
   getch();
}

Comments

Popular posts from this blog

install oracle 11g on windows 7,8,8.1,10

1. Select installation method Following two installation methods are available: Basic Installation  – Choose this to perform the full Oracle Database 11g installation with standard configuration options. You can use only filesystem for storage in this option. Advanced Installation  – This gives your full control over the installation, including the ability to choose Automatic Storage Management. Select this option as shown below. Fig  - Select Installation Method 2. Specify Inventory directory and credentials Enter the following information: Enter the inventory directory:  /u01/app/oraInventory Specify operating system group name:  oinstall Fig  - Specify Inventory directory and credentials 3. Select Installation Type Following three installation types are available: Enterprise Edition – Select this option. Standard Edition Custom Fig  - Select Installation Type 4. Specify Install Location Enter ...