OS2World OLD-STATIC-BACKUP Forum

OS/2 - Technical => Programming => Topic started by: demetrioussharpe on 2010.11.23, 04:19:09

Title: Does anyone know how to copy a PM Font into a bitmap?
Post by: demetrioussharpe on 2010.11.23, 04:19:09
I'm trying to implement pglUseFont() & the GPI API seems to be sparse when it comes to manipulating the actual font data. Also, I don't want to use any algorithms from IBM's OpenGL implementation.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: warpcafe on 2010.11.23, 10:43:23
Hi,

...you mean creating a bitmap FONT from a PM Font? Then I have no clue (but will search around...)
I suppose this (see below) is not exactly what you meant, is it?
http://hobbes.nmsu.edu/h-viewer.php?dir=/pub/os2/dev/rexx&file=rxttf.zip&backto=%2Fh-browse.php%3Fdir%3D%2Fpub%2Fos2%2Fdev%2Frexx

Cheers,
Thomas
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: warpcafe on 2010.11.23, 11:00:41
Heyda,

does that help? Somehow? ...:
http://fontforge.sourceforge.net/

...and then perhaps check the suggestions from others here:
http://gamedev.stackexchange.com/questions/2717/tool-to-create-a-bitmap-font-from-a-true-type-font

HTH,
Thomas
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: demetrioussharpe on 2010.11.23, 11:44:02
Thanks, Thomas, I'll give those a look tomorrow after work.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: RobertM on 2010.11.24, 17:55:29
Quote from: warpcafe on 2010.11.23, 11:00:41
Heyda,

does that help? Somehow? ...:
http://fontforge.sourceforge.net/

...and then perhaps check the suggestions from others here:
http://gamedev.stackexchange.com/questions/2717/tool-to-create-a-bitmap-font-from-a-true-type-font

HTH,
Thomas


demetrioussharpe,

Just keep in mind that OS/2 uses three different types of fonts, Truetype (like the newer Times New Roman, etc), Adobe and bitmapped (System VIO and others).

Some of the apps I use do not distinguish between them in any way, such as Embellish. How that may affect what you plan, I do not know, but I suspect you might either have to take into consideration all those formats, or figure out how to select only Truetype or only TT and PS. That much is possible, and is done by a variety of OS/2 apps, so it shouldn't be difficult to do if you need to.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: demetrioussharpe on 2010.11.25, 01:03:57
The goal is to load a font using the GPI API, which is pretty standard. Here's the not so obvious part:

How to copy a font character from it's PS space into a bitmap of unsigned chars.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: RobertM on 2010.11.25, 01:08:20
Quote from: demetrioussharpe on 2010.11.25, 01:03:57
The goal is to load a font using the GPI API, which is pretty standard. Here's the not so obvious part:

How to copy a font character from it's PS space into a bitmap of unsigned chars.

Ah... I'll see if I can dig info up on that. It's not too difficult.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: RobertM on 2010.11.25, 01:09:14
Quote from: RobertM on 2010.11.25, 01:08:20
Quote from: demetrioussharpe on 2010.11.25, 01:03:57
The goal is to load a font using the GPI API, which is pretty standard. Here's the not so obvious part:

How to copy a font character from it's PS space into a bitmap of unsigned chars.

Ah... I'll see if I can dig info up on that. It's not too difficult.

I think registering a special dc might work... I'll let you know if I find anything helpful.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: RobertM on 2010.11.25, 01:19:14
Ugh, this is hazy, but I am pretty sure you can set up a DC to a memory area, link the PS, and then draw to (through) the PS. That should create a bitmapped version of the output. Another possibility is to use a metafile as a dc, but that would require a few extra steps afterwards to get it into a bitmapped format.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: demetrioussharpe on 2010.11.25, 01:30:57
Quote from: RobertM on 2010.11.25, 01:08:20

Ah... I'll see if I can dig info up on that. It's not too difficult.

I think registering a special dc might work... I'll let you know if I find anything helpful.

Ugh, this is hazy, but I am pretty sure you can set up a DC to a memory area, link the PS, and then draw to (through) the PS. That should create a bitmapped version of the output. Another possibility is to use a metafile as a dc, but that would require a few extra steps afterwards to get it into a bitmapped format.

Thanks. I stumbled into GpiQueryBitmapBits(). I think I'll try to use that by passing the PS of the loaded font. This has to be implemented in a reasonably quick way, since it's part of the OpenGL interface.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: RobertM on 2010.11.25, 01:36:28
Quote from: demetrioussharpe on 2010.11.25, 01:30:57
Quote from: RobertM on 2010.11.25, 01:08:20

Ah... I'll see if I can dig info up on that. It's not too difficult.

I think registering a special dc might work... I'll let you know if I find anything helpful.

Ugh, this is hazy, but I am pretty sure you can set up a DC to a memory area, link the PS, and then draw to (through) the PS. That should create a bitmapped version of the output. Another possibility is to use a metafile as a dc, but that would require a few extra steps afterwards to get it into a bitmapped format.

Thanks. I stumbled into GpiQueryBitmapBits(). I think I'll try to use that by passing the PS of the loaded font. This has to be implemented in a reasonably quick way, since it's part of the OpenGL interface.

That sounds like it will work, and using a DC of OD_MEMORY, should allow you to process things BTS on it.

Here's a bit of code that uses GpiQueryBitmapBits()
OpenMoko (http://openmoko.truebox.co.uk/repos/mazikeen/fso-testing/sources/cvs/minimo/mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp)
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: demetrioussharpe on 2010.11.25, 02:15:04
Quote from: RobertM on 2010.11.25, 01:36:28
Quote from: demetrioussharpe on 2010.11.25, 01:30:57
Quote from: RobertM on 2010.11.25, 01:08:20

Ah... I'll see if I can dig info up on that. It's not too difficult.

I think registering a special dc might work... I'll let you know if I find anything helpful.

Ugh, this is hazy, but I am pretty sure you can set up a DC to a memory area, link the PS, and then draw to (through) the PS. That should create a bitmapped version of the output. Another possibility is to use a metafile as a dc, but that would require a few extra steps afterwards to get it into a bitmapped format.

Thanks. I stumbled into GpiQueryBitmapBits(). I think I'll try to use that by passing the PS of the loaded font. This has to be implemented in a reasonably quick way, since it's part of the OpenGL interface.

That sounds like it will work, and using a DC of OD_MEMORY, should allow you to process things BTS on it.

Here's a bit of code that uses GpiQueryBitmapBits()
OpenMoko (http://openmoko.truebox.co.uk/repos/mazikeen/fso-testing/sources/cvs/minimo/mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp)

Thanks, that's just what I needed! I'll start working on the code as soon as I get everything situated with Netlabs.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: RobertM on 2010.11.25, 02:59:40
Quote from: demetrioussharpe on 2010.11.25, 02:15:04
Quote from: RobertM on 2010.11.25, 01:36:28
Quote from: demetrioussharpe on 2010.11.25, 01:30:57
Quote from: RobertM on 2010.11.25, 01:08:20

Ah... I'll see if I can dig info up on that. It's not too difficult.

I think registering a special dc might work... I'll let you know if I find anything helpful.

Ugh, this is hazy, but I am pretty sure you can set up a DC to a memory area, link the PS, and then draw to (through) the PS. That should create a bitmapped version of the output. Another possibility is to use a metafile as a dc, but that would require a few extra steps afterwards to get it into a bitmapped format.

Thanks. I stumbled into GpiQueryBitmapBits(). I think I'll try to use that by passing the PS of the loaded font. This has to be implemented in a reasonably quick way, since it's part of the OpenGL interface.

That sounds like it will work, and using a DC of OD_MEMORY, should allow you to process things BTS on it.

Here's a bit of code that uses GpiQueryBitmapBits()
OpenMoko (http://openmoko.truebox.co.uk/repos/mazikeen/fso-testing/sources/cvs/minimo/mozilla/gfx/src/os2/nsDrawingSurfaceOS2.cpp)

Thanks, that's just what I needed! I'll start working on the code as soon as I get everything situated with Netlabs.

Heh... don't thank me... there's been a lot of projects I've been wanting to jump into, but, my C++ is so rusty that I wouldn't even waste anyone's time making an offer to help.

So.... what little I can do to help find information out there, or dig up from some remembrances buried in my rather rusty memory is my way of saying Thank You! to all of you who are actually doing the real work.

On a side note, someplace I had a bunch of GPI programming books, and some personally typed references from IBM (relative to the new print subsystem). If I find them, I will let you know. I sure as heck haven't had much use for them in the last 10+ years... (a combination of "discovering" REXX and moving on to lots of web scripting work made me become very lazy when it came to keeping up my programming skills in other languages).

In total, I should have a few hundred dollars in OS/2 programming books (PM, GPI, and a buncha others). I'll gladly "sell" them to you (or anyone else who has an active project going) for nothing more than the cost of shipping. And that shouldn't be much, since I think I can fit them in a Flat Rate Priority Mail box.

Best,
Rob
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: demetrioussharpe on 2010.11.25, 03:23:04
Quote from: RobertM on 2010.11.25, 02:59:40
On a side note, someplace I had a bunch of GPI programming books, and some personally typed references from IBM (relative to the new print subsystem). If I find them, I will let you know. I sure as heck haven't had much use for them in the last 10+ years... (a combination of "discovering" REXX and moving on to lots of web scripting work made me become very lazy when it came to keeping up my programming skills in other languages).

In total, I should have a few hundred dollars in OS/2 programming books (PM, GPI, and a buncha others). I'll gladly "sell" them to you (or anyone else who has an active project going) for nothing more than the cost of shipping. And that shouldn't be much, since I think I can fit them in a Flat Rate Priority Mail box.

Sounds good, because the OS/2 part of my library needs some beefing up. I mostly have *nix, hardware & a few win & dos books, with a splash of mac! lol When you find them, let me know what you have & what the prices are.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: RobertM on 2010.11.25, 03:52:36
Quote from: demetrioussharpe on 2010.11.25, 03:23:04
Quote from: RobertM on 2010.11.25, 02:59:40
On a side note, someplace I had a bunch of GPI programming books, and some personally typed references from IBM (relative to the new print subsystem). If I find them, I will let you know. I sure as heck haven't had much use for them in the last 10+ years... (a combination of "discovering" REXX and moving on to lots of web scripting work made me become very lazy when it came to keeping up my programming skills in other languages).

In total, I should have a few hundred dollars in OS/2 programming books (PM, GPI, and a buncha others). I'll gladly "sell" them to you (or anyone else who has an active project going) for nothing more than the cost of shipping. And that shouldn't be much, since I think I can fit them in a Flat Rate Priority Mail box.

Sounds good, because the OS/2 part of my library needs some beefing up. I mostly have *nix, hardware & a few win & dos books, with a splash of mac! lol When you find them, let me know what you have & what the prices are.

No prices... just shipping. Via priority mail (assuming you live in the US) $14.95 a box - which is simply the current USPS rate for a LFRB via Priority Mail. If they all fit, that's what you pay. If it takes two boxes, then twice that. Etc.

And if you decide you don't mind waiting on USPS Media Mail or USPS Parcel Post, I can ship it that way and make it cheaper. And if work picks up here at the office this Holiday Season (some years it dies to nothing, some years we are swamped), then I'll split the shipping cost.
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: warpcafe on 2010.11.25, 11:59:37
Hi,

well I had bought a bunch of OS/2 development books some months ago... and it included such dealing with GPI/PM programming that I actually am unable to use since I don't "speak" C (+,++,#,...). However I'm afraid the shipping cost to the US (from Germany) will most likely make it unreasonable to send them over... let me know if you think it's worth it once you have your shelves filled with Rob's stuff. Perhaps I have some of those you'll be lacking... of course you'll get them for free if you cover the shipping. Sigh. ;)

Cheers,
Thomas
Title: Re: Does anyone know how to copy a PM Font into a bitmap?
Post by: demetrioussharpe on 2010.11.25, 12:12:12
Quote from: warpcafe on 2010.11.25, 11:59:37
Hi,

well I had bought a bunch of OS/2 development books some months ago... and it included such dealing with GPI/PM programming that I actually am unable to use since I don't "speak" C (+,++,#,...). However I'm afraid the shipping cost to the US (from Germany) will most likely make it unreasonable to send them over... let me know if you think it's worth it once you have your shelves filled with Rob's stuff. Perhaps I have some of those you'll be lacking... of course you'll get them for free if you cover the shipping. Sigh. ;)

Cheers,
Thomas

I guess there must be tons of OS/2 book everywhere except the US.