When using outtextxy() in graphic.h, I can only use limited number of font. How can I display the very basic font above? It is just the normal window console raster font.
Asked
Active
Viewed 850 times
0
-
Note for those who (like me) didn't already know: `graphic.h` is a [non-standard header used by Borland](http://stackoverflow.com/q/4574201/4200092). – GoBusto Apr 01 '15 at 07:57
-
What do you mean by "display the very basic font"? Did you mean "use the very basic font"? – abRao Apr 01 '15 at 08:03
-
i mean printing text with that font – JSCB Apr 01 '15 at 08:09
1 Answers
1
If Console Raster is not in the list enumerated below - you may want to use installuserfont
and then use the installed font in settextstyle
.
You have to make .CHR file that contains the console raster font -
enum font_names
{
DEFAULT_FONT,
TRIPLEX_FONT,
SMALL_FONT,
SANS_SERIF_FONT,
GOTHIC_FONT,
SCRIPT_FONT,
SIMPLEX_FONT,
TRIPLEX_SCR_FONT,
COMPLEX_FONT,
EUROPEAN_FONT,
BOLD_FONT
};
userfont = installuserfont("CONSOLE_RASTER.CHR"); /* install font file with console raster */
settextstyle(userfont, HORIZ_DIR, 4); /* select the user font */
outtextxy(x, y, "Hello World!"); /* output some text */
Those .CHR file store Stroked fonts - where each stem of the glyph is represented by one line down the center of the stem, and the line is later drawn with a certain width. You have to make available the console Raster in .CHR format.
BTW, it has been almost 20 years since I looked at these BGI functions!
Though I hope you have considered modern graphics libraries.

abRao
- 2,787
- 1
- 25
- 37
-
can you plz suggest some modern libaries, which is not really complex to learn? – JSCB Apr 01 '15 at 08:21
-
I have used OpenGL for 2D and Qt for GUI - other options are discussed here http://stackoverflow.com/questions/1701728/graphics-library-in-c – abRao Apr 01 '15 at 08:26
-
Also check SDL at http://www.libsdl.org/ - you should also consider Win32 GDI - https://msdn.microsoft.com/en-us/library/windows/desktop/dd145203%28v=vs.85%29.aspx . If it was me I will start with Win32 GDI . – abRao Apr 01 '15 at 08:28
-
I thought Win32 GDI is complicated, as it need to be work in "Win32 GUI Project" but not the usual "console application", and each function have millions of parameters... – JSCB Apr 01 '15 at 12:01
-
Check this http://stackoverflow.com/questions/1937163/drawing-in-a-win32-console-on-c those additional parameters are usually for the device context and message - once you understand them it becomes easy. Or try OpenGL - in the long run using either of them will benefit you the most. – abRao Apr 01 '15 at 15:24