VOGONS


First post, by doomlazer

User metadata
Rank Newbie
Rank
Newbie

Edit: this issue has been solved. Most of the problems were due to issues with the AGI interpreter, not DOSBox itself. Some of the information may still be helpful for DOSBox users who would like to create custom codepages and/or AGI fan translations, so I will leave it up to the moderators if it needs to be moved or deleted for not being on topic.

Ok this is a bit convoluted, but I'm assisting with a French translation of SQ1 and we are trying to fine tune the font in graphics mode.

Normally in AGI there is no extended character support in graphics mode, only text mode, but thanks to a string hack by the creator of WinAGI, we are able to display accented letters in both graphics and text mode. With the default DOSBox settings the accent marks are flat and dull looking.

AWZ0GcX.png

Changing the DOSBox config to:

keyboardlayout=fr

which most French users will likely do, makes the accents look objectively better.

nw8EyVK.png

The problem is that graphics mode appears to use a different font than text mode. The text mode 'fr' font squashed several characters and moves everything down one pixel to maintain a consistent level. The graphics mode font has all accented letters positioned one pixel lower than the other characters to allow for the slanted accents, but does not adjust the standard characters. This creates an undesirable wavy effect to accented text in graphics mode.

Edit: this turns out to be caused by AGI interpreter using two different sources for graphics mode text glyphs depending if the it's an extended character or not.

GOLVyeS.png

With ScummVM we can include a custom font used with both modes that matches the "squashed/slanted accents" of the French layout text mode font. It's not perfect, but looks better than the wavy text in our opinion .

Edit: The problem was partially solved a few posts down. It may be possible to adjust the AGI string hack to do a full custom font replacement, but currently there are still some issues. Thank you _Rob for pointing out DOSBox-X which helped in researching how codepages are used.

We'd like to be able to do the same in DOSBox. It doesn't seem possible to supply a user font file in our game folder for DOSBox, so I'm researching the possibility of compiling a custom version of DOSBox with an edited graphics mode font. As I'm looking through the source code it appears that the fonts are stored in dos_codepages.h in .CPI / .CPX format.

I'm really just a hobby programmer, so this is a bit outside my comfort zone. If I can figure out which of the codepages the french keyboard layout is using for graphics mode, then modify the font with CPIadd (which is mentioned in the source code, but I haven't tried yet), I can potentially compile a custom version to include with the SQ1 translation patch installer so everything is the way we want.

My questions are first, I'm assuming there is no problem with distributing a modified version of DOSBox with our translation patcher, right?

Second, is it obvious to anyone which codepage the French layout is using for graphics mode?

Finally, is there an easier way to force DOSBox to use the same "French font", that text mode is already using, for graphics mode as well?

If anyone has any general recommendations on a different approach to accomplish this, I'm open to researching/implementing alternative solutions as well, but the goal here is to get a consistent look between both text/graphics mode in DOSBox and SVM.

I hope that all this is clear and this is the most appropriate place to pose this question. I looked at creating a ticket on the DOSBox Sourceforge, but this seemed better. Thank you.

Last edited by doomlazer on 2022-04-27, 05:34. Edited 10 times in total.

Reply 1 of 4, by doomlazer

User metadata
Rank Newbie
Rank
Newbie

I discovered the KEYB command which allows for selecting both a keyboard layout and code page which can be set under the [autoexe] in config. You can even load a user supplied .cpi file, so that could be a possible solution to adjusting the graphics mode font the way we want it.

Last edited by doomlazer on 2022-04-25, 20:31. Edited 1 time in total.

Reply 2 of 4, by _Rob

User metadata
Rank Member
Rank
Member

You may want to try DOSBox-X 0r -staging (the later compiled from git). Both have better support for codepage switching and support loading CPI or CPX files. In fact, both of them now include the FreeDOS EGA*.CPX files.

Reply 3 of 4, by doomlazer

User metadata
Rank Newbie
Rank
Newbie

I believe I've mostly solved the technical details of a custom user supplied font for AGI graphics mode text in DOSBox. It requires a custom EGA.CPI file and adding a KEYB command to the config. Here are the steps:

Find a copy of EGA.CPI. FreeDOS uses EGA.CPX which isn't compatible with the tool I used, CPI 120. Maybe it's trivial to convert from CPX? edit: it is easy. CPX files are just .CPI compressed with UPX. To uncompress a CPX, download https://github.com/upx/upx/releases/download/ … px-3.96-dos.zip, rename EGA.CPX to EGA.COM, then use the command:

upx -d EGA.COM

When the decompression finishes, rename EGA.COM to EGA.CPI and it can be used with the CPI120 tools.

Download cpi120.zip from: http://www.kostis.net/freeware/.

Use the CPI 120 commands through DOSBox to extract the codepage, then convert to a cp0.F08 font file that can be edited. I used https://github.com/viler-int10h/Fontraption to edit the .F08 font.

Once the .f08 font has been edited, reverse the steps in CPI 120 to create a custom EGA.CPI that includes your new font in codepage 0. Remove any copyrighted codepage numbers 437 , 850, etc. with the cpidel command.

Finally, include the custom myEGA.CPI in the game folder and add the following to your DOSBox config:

[autoexec]
KEYB us 0 myEGA.CPI

In our case we use fr for the French keyboard layout. The AGI interpreter uses the custom font for both text mode and graphics mode!

Last edited by doomlazer on 2022-04-27, 05:37. Edited 7 times in total.

Reply 4 of 4, by doomlazer

User metadata
Rank Newbie
Rank
Newbie

Edit: The issues below have been solved by an updated version of AGKorson's AGI extended character string hack. I'll link the hack when the updated version is publicly released. Thank you, AGK!

There are still issues with this method. The AGI interpreter is using the user supplied custom font for extended characters and text mode, but continues to use a different glyph source for standard characters when printing black text on a non-black background - this is the source of the weird font mixing.

As a demonstration I've created a custom font with a distinctive lowercase "e" and "é".
ohMsalD.png

Using this font in DOSBox as a custom .CPI the game will show my custom "e" only in text mode. In this screenshot notice that the altered "e" only appears in highlighted text (which is white on black), and the glyphs change as you move the menu selector around.
vjhKcSV.png

It always uses our custom codepage for extended characters, i.e. "é", but because of a quirk in the AGI interpreter we still don't see a full font replacement for standard characters in graphics mode text.
kJaFMWF.png

It may still be possible to adapt this workaround for our translation needs, but this currently isn't the full custom AGI font replacement it initially appeared to be 🙁