Discussion:
How do I change the size and font of text output by textout?
(too old to reply)
David Ogilvie
2015-12-19 20:25:59 UTC
Permalink
This might be a dumb question, but I can't see an
obvious way of changing the text size output by
textout. I would think that the solution should
be simple, but somehow ie eludes me! <grin>

Thanks in advance!

David O
Johann Klammer
2015-12-21 02:44:51 UTC
Permalink
This might be a dumb question, but I can't see an obvious way of changing the text size output by textout. I would think that the solution should be simple, but somehow ie eludes me! <grin>
Thanks in advance!
David O
I'm not sure it's meant to be changeable.
Here's what I tried
(to get 16 pix high chars in XRES16COLOR a 1024x768 mode, I think)

8<------------------------------------------------------------
#define FONT_H 16
#define FONT_W 8


//in gdefn.h
struct clip_region {
short xmin;
short xmax;
short ymin;
short ymax;
};

struct videoinfo {
struct videoconfig vc;
// not sure if pointer is the right size...
void *deviceptr;//not sure where gr_device is
struct clip_region clip;
struct clip_region clip_def;
unsigned short screen_seg;
unsigned int screen_off;
unsigned short screen_seg_base;
unsigned int screen_off_base;
unsigned short page_size;
unsigned short misc_info;
unsigned short stride;
};

extern short _Tx_Row_Min; // upper left and lower right
extern short _Tx_Col_Min; // corners of text window
extern short _Tx_Row_Max;
extern short _Tx_Col_Max;

//in globals.h and curstate.h
extern struct videoinfo _ConfigBuffer; // video state

void evil_hack(void)
{
_ConfigBuffer.vc.numtextrows=48;
_Tx_Row_Max=48;
}

8<-----------------------------------------------------------------------
It's all internal structures and variables...
I don't think there's a public interface...

init looks sthg like this:
[...]
int rows,i;
struct videoconfig vc;
short old_wrapmode;
rows=_setvideomode( _XRES16COLOR );
old_wrapmode = _wrapon( _GWRAPOFF );
evil_hack();
_getvideoconfig(&vc);
[...]
Johann Klammer
2015-12-21 17:25:13 UTC
Permalink
On 12/21/2015 03:44 AM, Johann Klammer wrote:
[...]

Sorry wrong API... Ignore the post...
Hans-Bernhard Bröker
2015-12-21 17:33:18 UTC
Permalink
This might be a dumb question, but I can't see an obvious way of
changing the text size output by textout. I would think that the
solution should be simple, but somehow ie eludes me! <grin>
It would be important to know which textout function you're talking
about, for starters. There is none in OW C or OW C++ under that exact
same name.

There's the windows API function TextOut. To understand how that works,
you will have to look up Windows API documentation. OW doesn't supply
that; Microsoft does.
David Ogilvie
2015-12-22 22:47:00 UTC
Permalink
It's the Windows API one that I was trying to use,
and was looking at the M$ documentation. I'm sure
there must be a way to output text of different
sizes, but they sure don't make it obvious how to
do it! <grin>
Post by Hans-Bernhard Bröker
Post by David Ogilvie
This might be a dumb question, but I can't see
an obvious way of
changing the text size output by textout. I
would think that the
solution should be simple, but somehow ie eludes
me! <grin>
It would be important to know which textout
function you're talking about, for starters.
There is none in OW C or OW C++ under that exact
same name.
There's the windows API function TextOut. To
understand how that works, you will have to look
up Windows API documentation. OW doesn't supply
that; Microsoft does.
Hans-Bernhard Bröker
2015-12-23 12:05:27 UTC
Permalink
It's the Windows API one that I was trying to use, and was looking at
the M$ documentation. I'm sure there must be a way to output text of
different sizes, but they sure don't make it obvious how to do it! <grin>
The API documentation is really meant more for reference, not as
learning material for newbies. Windows programming is complex enough
that you really need some coherent explanation of it all. Generations
of budding Windows programmers have all learned from various updated
versions of the same book: "Programming Windows" by Charles Petzold.

As to the problem at hand: TextOut() has five arguments. Four of them
are pretty self-explanatory. The clue must thus be in the remaining
one: the HDC, or "handle to a device context". You'll want to find out
where to get that from, and what other functions use this kind of
argument, particular those that deal with fonts.
David Ogilvie
2015-12-23 23:35:29 UTC
Permalink
My profession was DOS programming for about 15
years, and I have Petzold's book "Programming
Windows 95", so agree with you completely.
Petzold's website had downloads of the examples
from some of his books, which I've been looking
at, but a lot of stuff now seems to be in C++ or
C#, (which I really never got a handle with
<groan>), while most of my programming was in C,
Pascal, Cobol, Fortran, et al. <grin>

I admit that this is probably not strictly
on-topic for this list, but at least I can say
that the only compiler tools I've used since I
attended Waterloo have been the Waterloo-based
compilers (starting with WATIAC, WATMAP, WATFOR
and WATFIV). Yeah, that was a looong time ago! :)

David O
Post by Hans-Bernhard Bröker
Post by David Ogilvie
It's the Windows API one that I was trying to
use, and was looking at
the M$ documentation. I'm sure there must be a
way to output text of
different sizes, but they sure don't make it
obvious how to do it! <grin>
The API documentation is really meant more for
reference, not as learning material for newbies.
Windows programming is complex enough that you
really need some coherent explanation of it all.
Generations of budding Windows programmers have
all learned from various updated versions of the
same book: "Programming Windows" by Charles Petzold.
As to the problem at hand: TextOut() has five
arguments. Four of them are pretty
self-explanatory. The clue must thus be in the
remaining one: the HDC, or "handle to a device
context". You'll want to find out where to get
that from, and what other functions use this kind
of argument, particular those that deal with fonts.
David Ogilvie
2016-01-02 16:12:03 UTC
Permalink
I found what I needed in chapter 17 of Petzold's
"programming Windows, 5th edition". I had an
earlier version of the book which did not include
the EZTest/EZFont demo of chapter 17. This shows
that TextOut will react to font changes passed to
the current Window.
Post by David Ogilvie
My profession was DOS programming for about 15
years, and I have Petzold's book "Programming
Windows 95", so agree with you completely.
Petzold's website had downloads of the examples
from some of his books, which I've been looking
at, but a lot of stuff now seems to be in C++ or
C#, (which I really never got a handle with
<groan>), while most of my programming was in C,
Pascal, Cobol, Fortran, et al. <grin>
I admit that this is probably not strictly
on-topic for this list, but at least I can say
that the only compiler tools I've used since I
attended Waterloo have been the Waterloo-based
compilers (starting with WATIAC, WATMAP, WATFOR
and WATFIV). Yeah, that was a looong time ago! :)
David O
Post by Hans-Bernhard Bröker
Post by David Ogilvie
It's the Windows API one that I was trying to
use, and was looking at
the M$ documentation. I'm sure there must be a
way to output text of
different sizes, but they sure don't make it
obvious how to do it! <grin>
The API documentation is really meant more for
reference, not as learning material for newbies.
Windows programming is complex enough that you
really need some coherent explanation of it all.
Generations of budding Windows programmers have
all learned from various updated versions of the
same book: "Programming Windows" by Charles
Petzold.
As to the problem at hand: TextOut() has five
arguments. Four of them are pretty
self-explanatory. The clue must thus be in the
remaining one: the HDC, or "handle to a device
context". You'll want to find out where to get
that from, and what other functions use this kind
of argument, particular those that deal with fonts.
Loading...