• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

How to generate .FON files

Started by jmbw, 2010.02.26, 10:31:25

Previous topic - Next topic

jmbw

This should be an easy one, after all there's a recipe right in GPI4.INF, but it doesn't work for me.  How do you build .FON files out of bitmapped fonts?  I wrote a utility to convert my font into the OS/2 .FNT format (as defined in GPI4.INF) and got it to the point that FONTEDIT.EXE likes it OK.  Then I built a null executable as a LX .DLL as described in the doc.  But when I try to add a font resource to it I get an error -- both under Watcom (WRC 1.9Beta1 says unexpected EOF on my .FNT file and then gives internal error 3) and under older IBM utilities (RC says it can't add resource type 7 to my .EXE file but doesn't say why -- type 7 is RT_FONT, obviously).

What's the right way to do this?

The weird thing is that this is eerily familiar -- I previously ported my program to Windows and found that its similar-but-different bitmapped .FNT files were a pain to generate and its similar-but-different .FON libraries couldn't be correctly generated by most of the utilities that claim to do the job.  So I ended up writing my own utility to generate a null NE .EXE file from scratch and stick font resources on it.  I'm not familiar with the OS/2 .EXE formats though so I'd really like to avoid having to do all that again (although the existing .FON files I've looked at seem to start suddenly resembling the documentation at file address 0404h so if everything before that can be canned, maybe it's not so bad).  Is it just that no one uses bitmapped fonts so none of this stuff ever gets exercised?  Or is it trivially easy and I'm just an idiot?

In case it makes any difference, this is for the part of my program that's supposed to do a hauntingly perfect emulation of a particular model of 30-year-old video terminal.  So I'm not just looking for some nice font, I need this exact one.

Thanks!

John Wilson
D Bit

warpcafe

Hi John,

not sure if this helps ...I must admit I don't understand THAT much on how OS/2 handles screen fonts or what the requirements are. However, there are some tools around at hobbes for dealing with fonts. Perhaps any one of them can provide you some input?

Here's font-related software (and also an info document):
http://hobbes2.nmsu.edu/h-browse.php?dir=/pub/os2/util/font

An OS/2 font FAQ (from '95..., INF format):
http://hobbes2.nmsu.edu/h-viewer.php?dir=/pub/os2/info/faq&file=os2fnfaq.zip&backto=%2Fh-search.php%3Fsh%3D1%26button%3DSearch%26key%3Dfont%26stype%3Dall%26sort%3Dtype_name%26dir%3D%252F

And IIRC, the old CorelDraw for OS/2 was able to create fonts as well. Perhaps there's also still some software around that creates "valid and working" font files for OS/2... but I don't have any info at hand right now... sorry if all of the above is already known or doesn't help.

Regards,
Thomas
"It is not worth an intelligent man's time to be in the majority.
By definition, there are already enough people to do that"
- G.H. Hardy

Radek

It should pass. IIRC, I did the tollowing when I created a font.

(1) Create a .FNT file using the Font Editor
(2) Create a .RC file with a FONT statement referencing my font.
(3) Create a dummy source file (to satisfy the linker)
(4) Create a Watcom project: DLL, add the dummy source and the .RC file to it, and make the target.
(5) Rename the resulting .DLL to a .FON file, put it to a LIBPATH, enjoy.

I am using Open Watcom but you should pass with original Watcom, too.

jmbw

OK I admit I hadn't tried using the IDE (I'm allergic to them) but the results are the same.  Interesting that OW1.9Beta1 chooses to use IBM's RC instead of its own (WRC) but anyway it says:

... well OK I was going to cut and paste the error code but apparently if you click on the mouse the wrong way, the OW IDE crashes and loses the project file.  Don't get me started on IDEs!!!  Anyway I believe the first error from RC was #2034 (I don't know where to look that up) and it was the same one I got by hand.  All the message says is that it failed to do what I said, no mention of why.  I tried it with my .FNT file as well as the one you get by saving the default one (as monospace) that FONTEDIT starts up with.  Doesn't seem to matter whether I tell it to make a 16-bit or 32-bit DLL (I don't know which is right -- I think the ones I looked at were LXes which are mixed, right?  Obviously the code isn't what matters but I don't know what OS/2 expects here).

I've skimmed some of the Hobbes stuff but the descriptions make it sound like it's mostly stuff for maintaining collections and/or changing defaults, it doesn't seem like it's for programmers.  But I'll keep looking.

Thanks!

John Wilson
D Bit

Radek

Strange. I've just created a font which works. Here is a complete Open Watcom project (OW 1.8). The project contains:

- myfnt.fnt - the system proportional font which Font Editor starts with. I simply opened Font Editor and saved the font.
- myfnt.c - the dummy source
- myfnt.rc - the resource file for the font
- other files - created by Open Watcom.

I copied all the files above to the (future) project directory - keep all files in the project directory because resource compiler is a bit silly and has problems with finding its source files if they are elsewhere. I created a new project, myfnt.wpj in the directory, selected 32-bit DLL and added myfnt.c and myfnt.rc to the project. Then I make the target and renamed myfnt.dll to myfnt.fon. I was able to add myfnt.fon to the font palette. The font works.

I also noticed that I made what I didn't want to do  ;D  Rename the font before saving it in the Font Editor. Otherwise, you replace System Proportional font with your one when you install it. Well, doesn't matter too much because it's the same font.

Therefore, creating fonts seems to work. The guilty one can be the Font Editor.

jmbw

Holy crap!  THANK YOU!  That was really nice of you to take the trouble, and I'm sorry it messed up your font situation.

I'm starting to think I must be an idiot though, or else there's something wrong with my computer.  If I try to make all, WMAKE fires up WCC386 which dies (compiling an empty program?!) with a stack overflow.  I deleted OW1.9Beta1 and installed OW1.8 in case that's the problem, but it still does the same thing.  This is on a Cyrix 300 MHz with 32 MB that I had lying around with Warp 4 installed on it (no fixpaks).  Yes it's old, this is my first foray into OS/2 in ages, but it worked fine to write a VDD 10 years ago.

If I try to run RC using your files and the switches from the Makefile, I still get the same set of errors (with IBM RC V5.00.001) that I got with mine:
RC:(MYFNT.RC:5:25):2034:RC cannot create resource item type '7' and id '100'.
RC:(MYFNT.RC:5:25):2037:RC failed to add a resource. The return code is '7'.
RC:(MYFNT.RC:5:25):1009:RC detected errors during compilation.
Compile ending.

So once again I'm too stupid to do basic things which are known to work.
What version of RC.EXE do you use?  I wonder if I just have a broken version.

Meanwhile I dug into the source code to WRC.EXE to see why it's claiming an unexpected EOF on my .FNT file and I think I have it -- WRC doesn't really work with OS/2 fonts.  It looks like it *thinks* it does, but it tries to read from my .FNT file directly into a struct FontInfo (in readFontInfo() in bld\sdk\rc\rc\c\sem2sngl.c), and struct FontInfo seems to be the *Windows* form of .FNT header (the kind that starts with dfVersion, dfSize, dfCopyright), not the OS/2 form (which has the tagged/sized records).  Sure enough, if I tell WRC to attach a Windows .FNT file to an OS/2 LX DLL, it does it happily, producing a crazy mixed-OS .FON file which I imagine is no use anywhere.  So maybe the answer is to hack proper OS/2 FONT/FONTDIR support into sem2sngl.c.

Anyway, thanks!

John Wilson
D Bit

Radek

Something must be wrong. First, wcc386 should not fail on empty files - in a bigger project, lot of files can contain only "todo" lists and no code. I haven't seen Watcom failing on source files which contain only comments. How come? I don't think it relates to your Cyrix or to 32 MB RAM. Both must suffice. Maybe the fixpack? When I run W4, I always had fixpack 5 installed because of GRADD but fixpack 5 at least was also recommended from other reasons.

Therefore, I suggest starting with fixpack 5. I have the fixpack on my CDs so that I can send it to you. Leave me a PM where to send it and how (it's a lot of MB, attaching it to a post isn't possible) if you are interested.

I am posting the wmake log generated by my IDE when compiling the font. I also attached rc.exe, rcpp.exe used by my IDE (both are parts of the IBM toolkit, ver. 4.52, and not of Open Watcom) and rcpp.err (error list for rcpp.exe, the errors you are getting can come from it).