EDITOR PLUGIN: WFN-FontEditor

Started by Rulaman, Thu 27/06/2013 19:19:12

Previous topic - Next topic

Rulaman

So, finally the new version with bugfixes and new features is out.

http://www.file-upload.net/download-8888240/WFN-FontEditor-V1.2.1.0.zip.html
(Use the download button with the could and enable scripts if you block these.)
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Scavenger

I just tried this out, it handles much better! I'll be able to do any kind of font now that the index is displayed! Thanks, Rulaman, this is excellent.

Monsieur OUXX

 

Crimson Wizard

#43
LATER EDIT: it appears this post was a result of misunderstanding and using older version.
Spoiler

Rulaman, unfortunately your plugin still saves extended fonts in wrong format. This is the error I reported before.
When you click "Extend to 256 characters" button all newly created characters have incorrect length of data. They got fixed only after user edits something. This means that if user leaves at least one symbol unedited (leaves default empty square) the format will be saved in a broken way.
AGS does not tells anything, because older engine simply does not check for such errors - accepting even incorrect format!
This won't cause problems so far as these characters are not displayed, but this is dangerous, because may cause program to access wrong memory address. Please fix this before more people used your plugin to create their fonts!

For the new version of AGS I have specifically added extra checks into font loading code to detect and autocorrect such errors.

How to fix: the mistake is in FontEditorPane.cs
Code: csharp

private void BtnExtend256_Click(object sender, EventArgs e)
{
<...>
FontInfo.Character[counter + len] = new CCharInfo();
FontInfo.Character[counter + len].Height = 4;
FontInfo.Character[counter + len].HeightOriginal = 4;
FontInfo.Character[counter + len].Width = 4;
FontInfo.Character[counter + len].WidthOriginal = 4;
FontInfo.Character[counter + len].Index = counter + len;

FontInfo.Character[counter + len].ByteLines = new byte[2]; <---------------- INCORRECT
FontInfo.Character[counter + len].ByteLinesOriginal = new byte[2]; <---------------- INCORRECT
<...>
}


The lines I marked have a mistake: the WFN format requires at least 1 byte per line (height unit), regardless of width. You are creating 4x4 empty char, but assign only 2 bytes to data buffer. You need to assign 4 bytes.

You may also add these two helper functions to CCharInfo class, so that you won't depend on hard-coded constants:
Code: csharp

int GetRowByteCount()
{
    return (Width + 7) / 8;
}

int GetRequiredPixelSize()
{
    return GetRowByteCount() * Height;
}

[close]

Rulaman

AGAIN! This problem is solved with the newest Version 1.2.1.0 as mentioned in a few posts above.
I updated my first post to reflect this change.

I have a look about it in a few days anyway, when I am on my windows pc.

Are you sure you use the latest version? I am sure about the solved problem?
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

#45
Oh. I apologize, I used the link from the first post. I probably did not notice a difference between 1.2.1.0 and 1.2.0.1.

EDIT: Yes, I can confirm, the 1.2.1.0 is saving correctly. Sorry again. :)

Rulaman

Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Monsieur OUXX

Sorry for digging up the thread, but I'd like to suggest two rather simple enhancements.
I've thought of them while practically using the tool :

(by order of importance)
1) I suggest that when the user extends an existing font to 256 characters, then the 128 new chars get automatically filled with the missing characters (taken from the default AGS font -- can be found here : topic 48798 ). Because the font being currently open doesn't necessarily have the same size as the default AGS font, then maybe a popup box could ask for the coordinates of the characters base line before filling the characters.
2) Implement Ctrl+S to save
3) There are buttons to move an individual character up/down/left/right but maybe 4 additional buttons to move the whole font up/down/left/right?


Another possibility (variation on suggestion #1) is a button "copy this character from character open in next tab"
 

Rulaman

Mi Monsieur OUXX,

and sorry for the late response.

1b) You can copy a character to another position by using the context menu in the character table. Use 'Copy' and over the second character 'Paste'.
(It copies the image in the clipboard so you can make an bw image in any other paint program.)

1a) I take a look on copying the whole new char set from another font.

2) Do you mean Ctrl+S in the stand alone editor?

3) I implemented this feature today and if you want you can test it. (And the other functions when implemented.)


Greetings and a happy new year
Rulaman
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Rulaman

So, I have the new version ready.

http://www.filedropper.com/wfn-fonteditor
(Sources with binaries)


Greetings
Rulaman
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Monsieur OUXX

 

Crimson Wizard

#51
I tried using this plugin with the recent editor, and there are two problems:
1) I have no idea how to save the work, or when it is saved (when I save the whole game? close the font editor tab?  whenever when I put a pixel in a letter?)
2) I noticed that AGS does not have the font preview updated after font is edited, only closing and reopening whole game fixes this. Was it always like that? Might be a problem of communication between AGS and the plugin.

Also, Rulaman, if you are still around and have time, could you put the source code on a more suitable hosting, like github or bitbucket? The above link on "filedropper" is dead.

Rulaman

Hi

@Crimson Wizard,

I can put it on github. Don't know why I didn't think of that. (Wait a few days and it will be online)

The new font is saved, when you save the game. And yes, the problem with the font update is since the first version I think.
Don't know if I can give AGS a hint to update the font preview.

@Monsieur Ouxx,

all the feature requests you did.

- using standard characters from default font on extend to 256
- ability to move all characters with the UDLR buttons
- copy characters are already implementent as i described somewhere (right click on the character (in the list) and choose copy/paste
  (btw. if you have an s/w image in the clipboard it paste it)
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Rulaman

Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

Quote from: Rulaman on Mon 24/09/2018 20:25:50
Time is off.
The sources are online.

https://bitbucket.org/rulaman/wfn-fonteditor

Thank you! I am sure this will be quite helpful :).


Quote from: Rulaman on Sat 22/09/2018 16:51:20And yes, the problem with the font update is since the first version I think.
Don't know if I can give AGS a hint to update the font preview.

Hmm, I have no idea either. Maybe will check that out at some point later.

Crimson Wizard

I have a bug report: if you had a game opened in the editor already, and then try to do load another game with File->Open, then the FontEditor.dll throws exception in "AGS.Plugin.FontEditor.Component.AGS.Types.IEditorComponent.RefreshDataFromGame()" saying that element with same key is already in the dictionary.

I suspect it is trying to add Font Editor's pane for the second time.

Rulaman

So, the new version is online (1.2.2.0)

and the plugin is available as an download.

http://www.filedropper.com/agspluginfonteditor (only the dll)

Greetings and Happy Holidays
Rulaman
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

franzrogar

Here's a compiled version of the latest release (as all the links are dead). It's hosted on Google Drive and will be online always. The link is a direct download and includes both the plugin and the stand-alone.


IMPORTANT NOTE: I've edited a bit the README, including information about the program, version, etc. and a basic copyright info that is mandatory in some countries to be attached to software. I tried my best being simple and so on, including to exonerate the author of any problem related with the program.

@rulaman , if you don't like it I will roll-back to the original.

Rulaman

Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

pippo calogero

#59
Quote from: franzrogar on Tue 19/02/2019 15:23:26
Here's a compiled version of the latest release (as all the links are dead). It's hosted on Google Drive and will be online always. The link is a direct download and includes both the plugin and the stand-alone.


IMPORTANT NOTE: I've edited a bit the README, including information about the program, version, etc. and a basic copyright info that is mandatory in some countries to be attached to software. I tried my best being simple and so on, including to exonerate the author of any problem related with the program.

@rulaman , if you don't like it I will roll-back to the original.
The link doesn't work
could someone upload it again?

SMF spam blocked by CleanTalk