GUI changes and new fonts

Everything about development and the OpenMW source code.
Locked
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Github profile: https://github.com/lgromanowski
Contact:

GUI changes and new fonts

Post by lgromanowski » 13 Aug 2011, 17:54

Star-Demon wrote: http://openmw.org/wiki/index.php?title= ... ermined.29

Thought I'd start thread on something comparatively easy.

Morrrowind uses:
-2 variations of Century Gothic
-Deadric lettering
-"Magic Cards"

Now, each font has its own texture file, and the format is .fnt. Can we use those?
Anything specific we are looking for? Any conversions needed?

Seems like an easy task, but in general, it looks like Morrowind's fonts have a style, and it should be preserved if we have to get a few more styles of fonts depending on resolution, size needed and place in the GUI.

((Actually, if I could get everything set up, and provided there's enough progress on the GUI, I wonder if I could also make new components? One thing at a time...))
ap0 wrote: Those font are not free.
So, unless Bethesda give us the right to use them, we can't.
Zini wrote:
Those font are not free.
So, unless Bethesda give us the right to use them, we can't.
That is not fully correct. We can use them in the same way as we can use the .esm files.

IIRC there are technical problems with the original fonts. No idea about the details. The font currently used is incomplete, i.e. it is missing glyphs required for the international version of Morrowind.
Star-Demon wrote:
ap0 wrote:Those font are not free.
So, unless Bethesda give us the right to use them, we can't.
Okay, that answers that. :(

They won't do it, since if they give us rights, we have to give those rights away as CopyLeft demands...They won't like that.


We'll have to google some fonts up that we can properly use.

I wonder...what does it take to make a font file for the library and type we're using? We could make something similar...although what are we gonna do about deadric...we have the alphabet easily enough, but how do we actually implement it if the alphabet itself is property? :|
ap0 wrote: I have found those fonts (cf. attached).

here is the readme :
Oblivion - A Daedric Letter Font
by dongle

VERSION 1.1 NOTES:
This is a font based on the Daedric lettering system found the Elder Scrolls RPG series by Bethesda Softworks. The third edition, Morrowind, comes with one such font on the CD, created by Adam Pyle, that the game uses to display Daedric letters in books and scrolls on-screen.

I found this font lacking and set out to create my own. Look around at the banners on the island of Vvardenfell and you'll see several letters are a different style than the game-font. Most important is the letter "Y", which is not in the game-font, yet is used extensively on banners. A good example of the Y is in the upper-right-hand corner of the banner outside Tel Fyr. You'll also see quite a few on the inspirational banners around Vivec. Other significant differences are seen in the letters "D", "H", "J", and "U". Minor differences are found in most every other letter.

None of my letter vector outlines are taken directly from Adam Pyle's font on the game CD. They are all hand-traced in Adobe Illustrator.

I've also included some basic punctuation, which is missing in the game-font.

The game-font has sort of a rough-edged look, trying to mimic an old worn printing press. I've provided two versions of my font, one with smooth edged outlines, and one with the "worn" look.


VERSION 1.1 NOTES:
I've come across a graphic of a complete Daedric alphabet, including the letter "X", which is not found in the game. This alphabet has a hand-written look to it and is quite different from the banner style. I've adapted this "X" to the style of the other Oblivion letters. Another font, Oblivion Script, is based on this hand-written look.

There is also a different style of the letter "Y" in this graphic. It looks, in part, similar to the "E". I've kept the "Y" from the v1.0 Oblivion and put the alternate "Y" at positions 159 and 255. To type an alternate "Y"; hold down the "alt" key, on the number-pad type 159 (or 255), and release the "alt" key.

DAEDRIC LORE:
The Daedric letters first appeared the game Battlespire in 1997. It was a cipher, or code. It is not a different language, but merely alternatives to our well-known Roman letters. I have included a chart with the font packs to make decoding easier. Words on banners in Vvardenfell are generally spelled vertically, but also somewhat haphazardly.

COPYRIGHT INFO:
This was done entirely as a personal project. Bethesda Softworks graciously granted me the permission for it. I am not connected with them in any way.

You may freely use these fonts to create anything you'd like.
You may re-distribute the fonts freely, over the Internet, or by any other means. Always keep the .zip file intact, and this read me included.

Please do not modify and redistribute the fonts without my permission.

You may NOT sell any of these fonts under any circumstances. This includes putting them on compilation font CDs for sale, putting them in a "members only" pay-area of a website, or any other means of financial gain connected in ANY way with the redistribution of any of these fonts.

You have my permission to create and sell any artwork made with these fonts, however you may need to contact Bethesda Softworks before doing so.

INSTALLATION:
True-Type fonts are compatible with any Windows OS. Un-zip and use the Control Panel link to the Fonts folder to install them. You can then type Daedric letters in any word processor, paint, or drawing program.

WARNING:
If you have Oblivion version 1.0 installed in Windows you will not be able to preview version 1.1. When you click on the v1.1 file you will be shown v1.0. Uninstall v1.0 before taking a look at v1.1.

Comments, suggestions, & flames:
deffeyes (AT) yahoo (dot) com

More Info:
http://www.deffeyes.com/morrowind/

Direct Download:
http://www.deffeyes.com/morrowind/Oblivion.zip
http://www.deffeyes.com/morrowind/Oblivion_Script.zip

Steve Deffeyes (aka dongle) April 2, 2003
Should we contact this guy for obtaining a GPL version of this font ?

==================================================

And I have found a "Magic Card" font here : http://www.dafont.com/fr/magic-cards.font.
I think it's a fanboy's work, but he don't give his email adress, but it can probably be found on the internet.
Star-Demon wrote: Awesome - since it's truetype it should work with the Freetype library, correct? If it's free, throw it in and I think we just got a task out of the way. :)
EmbraceUnity wrote: Since this issue is listed on the roadmap, I wanted to bump it up to the top.

We should be able to just grab the fonts from the Morrowind directory with no problems, as Zini mentioned.

Though it still might be useful to contact the authors for higher quality fonts, so we can have greater flexibility.

According to this mod description for a derivative of the the Daedric "Oblivion" font, we can use and redistribute it for non-commercial purposes.

"Dongle has given me the permission to release the russified font under the same conditions as in the original release (the original readme is included). Especially the part that says not to sell the font for money, or re-distribute it without the rules attached. The author did receive special permission from Pete Hines at Bethesda to make the font for non-commercial purposes, and has passed that along to me."

That "russified" version might actually be better since it will have greater international support, which Zini brought up as an issue.

I opened up the Magic Cards font in FontForge, and it told me it was made in 1998 by Neale Davidson.

I looked it up and he has tons of fonts on multiple "free font" websites. The link at dafont is the highest quality I've found. So the good news is that we can probably already use this font, and in a higher quality format than vanilla Morrowind.

I have a feeling this is Neale, if anyone wants to double check with him:

http://www.facebook.com/TFVanguard
Chris wrote:
EmbraceUnity wrote:According to this mod description for a derivative of the the Daedric "Oblivion" font, we can use and redistribute it for non-commercial purposes.
Then it's not compatible with the GPL, unfortunately, which allows commercial use.

Best thing to do would be to just use Morrowind's fonts, if possible. A user can always replace them like any other Morrowind mod (though Morrowind.ini does contain the [Fonts] section to define which internal font number uses which font file; OpenMW would likely need similar INI settings).
Zini wrote: That would be the best solution, yes. But unfortunately there seems to be a problem with adapting the original font. IIRC Nico did some work on it and then gave up.
Wouldn't hurt, if someone wants to have a look at it again,
Haplo wrote: In the US, typeface designs aren't copyrightable, so you can trace and redraw any font you like. It's not a good way to make friends, but many companies have done just that. The workaround in the US is just to call fonts "software", but again, the shape of the letters isn't what's being protected, just the particular software that generates them.

You could use Futura. It was released in 1927, and is a cousin to Century Gothic. Variants are used by Volkswagen, Shell, and HP in advertisements, as well as being the font used in V for Vendetta.

So you could, for example, take a screenshot of the entire alphabet of a given font and convert it into an actual font file, and just name it something else, and then release it under copyleft or GNU public licenses. Of course, it wouldn't hurt to make a few modifications.
Haplo wrote: I forgot to mention: Futura is also public domain.

http://www.sanskritweb.net/forgers/publicdomain2.pdf
nicolay wrote: Is this the font you mean? http://en.wikipedia.org/wiki/Futura_%28typeface%29

The font we really need to replace is magic cards, which looks something like this: http://www.dafont.com/magic-cards.font.

Actually I haven't tried the font on that page, and google seems to get quite a few other results one could try too. I don't know if "magic cards" is just one font file or if it's specific face with several implementations, anyone know? Maybe a stupid question but does it have anything to do with Magic the Gathering cards?
Haplo wrote: That's the one I'm referring to, yes. As far as Magic Cards goes, it does have some variants, I'm sure, but Bethesda only used a single version of it throughout the game.

The original (pre-8th edition) font for Magic the Gathering used a font called Goudy Medieval which is very similar to "Magic Cards". My guess is that someone (maybe even Bethesda) took Goudy Medieval and modified it like all font artists do, and called it "Magic Cards".

You can download a font very close to the one used in Magic the Gathering here:
http://www.mtgontario.com/index.php?nam ... load&cid=1
Greendogo wrote: What font are we using as a place-holder right now?
Star-Demon wrote: Looked like Comic sans last I saw.
BlackStar wrote: You could use Gentium as a replacement font for the magic cards. It's a high quality serif with an open license.

It's certainly not as fancy as the original font but it has a pretty evocative style.
BlackStar wrote: Link to Gentium.

This is the italic version:

Image

Pretty stylish, don't you think?
sir_herrbatka wrote: I think that this font is good enough. Just leave the option to replace this font with magic cards on your own (download from bethesda or copy from CS cd).
Pretty stylish, don't you think?
Yeah, this is pretty font. I prefer simpler fonts though.
Greendogo wrote: Is the reason we won't use the "Magic Cards" font provided with Morrowind in the same fashion as all the other resources because we can't figure out how to open it, or because it is not compatible with international versions of the game? Or for some other reason?

I would assume, for the English version of the game, we could just open the font file in the Morrowind install and use that in OpenMW as the font without further issue, right?
Zini wrote:
Is the reason we won't use the "Magic Cards" font provided with Morrowind in the same fashion as all the other resources because we can't figure out how to open it
That kinda describes the problem IIRC. Nico was about to investigate the situation again, but we all know what happened. Someone else will have to have a look at it sooner or later.
Greendogo wrote: I was chatting with Hrnchamd from the official Beth forums (of Morrowind Code Patch fame) about the font format and he had this to say about it:
Hrnchamd wrote:The font files are simple in structure, really. It's easy to open hex editor and see a general pattern. Still, here is what I can tell.

.fnt:
at offset 0: struct header {
float pointsize; int width, height; string texturename;
}
at offset 0x128: struct body {
float something;
float2 texture_coords[4];
float height, width, something; // measured in pixels
float kernleft, kernright; // measured in pixels. best guess (see kern on space character)
} [256]

.tex:
int width, height;
byte rgba[4*width*height]; // texture data in alpha channel
I hope that helps; if not, he implied that he seemed to think reverse engineering the file format wouldn't be an impossible task for someone on our team.
blah wrote: Here's a thread that describes the format and has a tool to view/edit them but you have to use archive.org to download it.
Star-Demon wrote: Just a thought - since we can pick up items we should implement the small label box that appears when you are in range of an item or activator.
Zini wrote: Completely forgot about it. Thanks for reminding me.
pvdk wrote: Little update: I mailed the author of the MakeMWFont utility, Mac Reiter. This program lets you create custom Morrowind .fnt files from system installed (truetype) fonts. you can find it here: http://planetelderscrolls.gamespy.com/V ... tail&id=69

I politely asked him to provide us with the source code of this utility, as it is a working implementation of the .fnt format. He immediately replied with the source and full permission to use and redistribute his code under a GPL licence or even public domain! Here's a link to the source:
http://pastebin.com/wi6isKWi

This application uses GDI+ for bitmap manipulation, so I haven't been able to compile it on Linux. The roadmap states Morrowind font support is stalled, but I'm sure someone with the knowledge can figure out how to get this working with MyGUI.

Regards,
pvdk.
Zini wrote: That would be the inverse direction of what we need, right? Anyway, if you think you can get it working, I am fine with that.
Just make sure that using the original font is optional. Let me know if you need help with setting up another command line option for this feature.
pvdk wrote: Heh yeah I know creating .fnt files is not exactly what we need, but the code demonstrates how the format works :)

I'm not going to take this task, it's too complicated for me. I don't know how bitmap manipulation works with standard libraries and I don't have enough knowledge of MyGUI.

Oh and btw: The use of the original .fnt files would fix our problems with different charsets.
raevol wrote:
pvdk wrote:He immediately replied with the source and full permission to use and redistribute his code under a GPL licence or even public domain
:shock: That's awesome. Thank you Mac Reiter!
Greendogo wrote: Great job!
Greendogo wrote: I know this doesn't solve the problem of opening the fnt files, but Hrnchamd released a higher resolution of the fnt file to make them easier to read and not so blurry. I think this means that the new files (the ones that he's created by altering the original fnt files) are his, and not Bethesda's IP. So if we want to include Hrnchamd's fnt files in OpenMW for some reason, we can.

Here's a link to the forum page

They look exactly like the original MW font but better. The only problem, like I said in the first sentence up above, is that they are still in the fnt file format, so we would still have to figure out how to open it. One thing we could do would be to ask Hrnchamd to release his updated font in TTF format so that it would be easier to open. This doesn't solve localization problems (with the Cyrillic versions of the game, for instance).
pvdk wrote: The original .fnt files look pretty horrible if opened with a image editor. Looks like they just scanned it or something. Also, Morrowind applies some kind of font blurring, the author of the MakeMWFont tool figured out a fix for that problem.

Our best option imho still is to read .fnt files, as the Better Dialog Font mod author probably used the Magic Cards font. MyGUI has something called ManualFont. It's defined in core_font.xml and looks like this:

Code: Select all

  <Font name="ManualFont" default_height="50" source="core.png">
    <Code index="48" coord="0 203 50 50"/>
    <Code index="49" coord="50 203 50 50"/>
    <Code index="50" coord="100 203 50 50"/>
    <Code index="51" coord="150 203 50 50"/>
  </Font>
Maybe we can make a .fnt to .png converter and then define the coords of the different characters in the .xml file. That should't be too difficult. I don't know if that would provide compatibility with different charsets but at least we will have support for .fnt files. Mods like the one you posted would work too as .fnt files would get converted at runtime.

Regards,
pvdk.
Peppe wrote: I haven't looked much at the MyGUI part but just reading the data is not a problem. I Did a small test reading the fnt file to get the coordinates and the tex file to get the bitmap data and then using libpng to save the bitmap data as a png.

So I guess the question is how well ManualFont works, seems it will need some work to make it load data from memory instead of from file. There is also the question of font sizes and colors.
pvdk wrote:
Peppe wrote:So I guess the question is how well ManualFont works, seems it will need some work to make it load data from memory instead of from file. There is also the question of font sizes and colors.
Awesome. One question: Why read from memory. Why not convert the .tex to .png at runtime and generate a .xml with the correct coords from the .fnt file. I believe ManualFont is an example name, but I'm not sure. If you can specify your own name you could even use the .fnt filename as name.

Have a nice weekend.
Peppe wrote:
pvdk wrote:Why read from memory. Why not convert the .tex to .png at runtime and generate a .xml with the correct coords from the .fnt file.
To avoid all the fun of having to figure out where to store it, if we have permissions to do that, if it needs to be updated etc.
pvdk wrote: Well we could do some testing first with a converted .png. Would be awesome to see if we can get ManualFont to work. Anyone here who feels like messing around with MyGUI? :)
pvdk wrote: I've got ManualFont working (sort of) with the original Morrowind font file. It works, but with some issues. The biggest issue is MyGUI stretching characters which are shorter than font_height. I tried to modify MyGUI but to no avail. The fact that the code is commented in Russian doesn't help either.

Here's a screenshot: http://img135.imageshack.us/img135/2451/menufont1.png

And here's how the openmw.font.xml looks:

Code: Select all

<Font name="Magic_Cards_Regular" type="ManualFont" default_height="16" source="magic_cards_regular.png">
<!--A-Z-->
   <Code index="65" coord="1 87 12 16"/>
   <Code index="66" coord="73 27 12 16"/>
   <Code index="67" coord="59 42 12 16"/>
   <Code index="68" coord="13 87 12 16"/>
   <Code index="69" coord="48 14 12 16"/>
etc...
The stretching is most obvious with the letter 'w.' The bitmap file is a real mess, the characters are all over the place and the 'w' has its "whitespace" at the bottom instead of above the character.

I thought some more about getting .fnt support in OpenMW. Here's how I think we should do it:
  • 1. Get a bitmap version of all three default fonts in place as default MyGUI resources. As other people said in this thread: typefaces are not copyrighted, vector files are. Look here: http://www.copyright.gov/title37/202.html

    2. At runtime let OpenMW parse the default fonts, for example with a command-line argument such as --createfonts. Read the .fnt files and put the coordinates etc. in openmw.font.xml, replacing the default values. Same goes for the .tex files: convert them to .pngs and replace the default bitmaps from (1).[/list:u]
    Regards,
    pvdk.
Peppe wrote:
pvdk wrote:It works, but with some issues. The biggest issue is MyGUI stretching characters which are shorter than font_height. I tried to modify MyGUI but to no avail. The fact that the code is commented in Russian doesn't help either.
So if we have one char 13 pixels high and one 15 they will both be stretched to be the same height?

Patching MyGUI (unless we can get the change accepted upstream) is a slippery slope, we probably want to avoid having to maintain our own patches on top if possible.
pvdk wrote:And here's how the openmw.font.xml looks:
Those values do not match the ones I read in the fnt file, are they picked manually?
My values can be found at http://projects.pappkartong.se/openmw/M ... egular.xml
pvdk wrote:The stretching is most obvious with the letter 'w.' The bitmap file is a real mess, the characters are all over the place and the 'w' has its "whitespace" at the bottom instead of above the character.
The differences I can see seems ok to me.
If we compare for example p and w, the box for p is empty in the top and the box for w is empty in the bottom, but that is due to where charters are supposed to be. If you consider writing on a line, the lower part of the p will be below the line while w will rest on it.
pvdk wrote: Indeed they will be stretched to 16px. Modifying MyGUI is not the best solution but I'm sure we can get it into mainstream if the code is sensible and if we ask nicely ;)

The values are indeed picked manually, as this is a proof of concept and I didn't quite get the .fnt format. I got them using a VB app I found in the old ElderSrolls forum topic linked here some pages back, but I had to modify them as the offset wasn't correct. Thanks for your values. Could you show me the code you use to read it?

Could you look into the MyGUI code and see if you can make sense of it?
Peppe wrote:
pvdk wrote:Could you show me the code you use to read it?
test.c
pvdk wrote:Could you look into the MyGUI code and see if you can make sense of it?
Maybe during the weekend, we'll see.
Zini wrote:
Patching MyGUI (unless we can get the change accepted upstream) is a slippery slope, we probably want to avoid having to maintain our own patches on top if possible.
We are already using a modified version of MyGUI that is embedded into our code base (see extern directory).
Peppe wrote:
Zini wrote:We are already using a modified version of MyGUI that is embedded into our code base (see extern directory).
The source code of the parts we use (MyGUIEngine and OgrePlatform) is not modified only the CMakeLists.txt files.

Introducing changes in MyGUI will make switching to a newer version harder and may force us to maintain our own port, port over bug fixes etc ourselves. We probably do not want that.
Zini wrote: I wasn't aware of the nature of these modifications. If we don't use a modified MyGUI library yet, we certainly don't want to start doing that now.
Greendogo wrote: I was all in favor of supporting the old format, provided with the game, however, if you don't want to do what is necessary in order to do that we could just do something else. The original magic cards font is available on the internet in TTF format and while that file is presumably copyrighted, we can provide a link to it in the read me or something. I also highly doubt we'd get into trouble by providing it with OpenMW.

I don't know what kind of problems we'd run into with international languages MW installs, however, which is something I'm hoping we are taking into account with the primary approach of getting the original font format to work, as well.
pvdk wrote:
Greendogo wrote:The original magic cards font is available on the internet in TTF format and while that file is presumably copyrighted, we can provide a link to it in the read me or something.
We could also generate a bitmap font based on the TTF, that way it's completely legal. An application like Font Studio does this.
Greendogo wrote:I don't know what kind of problems we'd run into with international languages MW installs, however, which is something I'm hoping we are taking into account with the primary approach of getting the original font format to work, as well.
Supporting the .fnt format would also mean full support for other languages. I'll ask the MyGUI developers on the Ogre forums how to get ManualFont to work with variable glyph heights.
Greendogo wrote:
pvdk wrote:Supporting the .fnt format would also mean full support for other languages. I'll ask the MyGUI developers on the Ogre forums how to get ManualFont to work with variable glyph heights.
If we can do that, it seems like the best approach to begin with. Getting more advanced options like custom fonts is something that GUI skinners might like to play around with, but it doesn't need to be there 100% for version 1.0.
ap0 wrote: A nice guy made a clean version of the morrowind font : http://www.tesnexus.com/downloads/file.php?id=36873

lovely <3
best regards,
Lukasz

Locked

Who is online

Users browsing this forum: No registered users and 3 guests