Jibble

Author Topic: EDITOR PLUGIN: WFN-FontEditor  (Read 14712 times)

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #40 on: 05 May 2014, 17:40 »
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

  • Cavefish
  • Posts: 956
  • In Four Glorious Colours!
    • I can help with animation
    • I can help with backgrounds
    • I can help with characters
    • I can help with scripting
    • Scavenger worked on a game that was nominated for an AGS Award!
      Scavenger worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #41 on: 05 May 2014, 20:44 »
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

  • Posts: 3,545
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #42 on: 07 May 2014, 14:13 »
Excellent.
 

Crimson Wizard

  • Posts: 8,747
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #43 on: 16 Sep 2014, 14:27 »
LATER EDIT: it appears this post was a result of misunderstanding and using older version.
Spoiler: ShowHide

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: C#
  1. private void BtnExtend256_Click(object sender, EventArgs e)
  2. {
  3. <...>
  4. FontInfo.Character[counter + len] = new CCharInfo();
  5. FontInfo.Character[counter + len].Height = 4;
  6. FontInfo.Character[counter + len].HeightOriginal = 4;
  7. FontInfo.Character[counter + len].Width = 4;
  8. FontInfo.Character[counter + len].WidthOriginal = 4;
  9. FontInfo.Character[counter + len].Index = counter + len;
  10.  
  11. FontInfo.Character[counter + len].ByteLines = new byte[2]; <---------------- INCORRECT
  12. FontInfo.Character[counter + len].ByteLinesOriginal = new byte[2]; <---------------- INCORRECT
  13. <...>
  14. }
  15.  

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: C#
  1. int GetRowByteCount()
  2. {
  3.     return (Width + 7) / 8;
  4. }
  5.  
  6. int GetRequiredPixelSize()
  7. {
  8.     return GetRowByteCount() * Height;
  9. }
  10.  
« Last Edit: 19 Sep 2014, 22:56 by Crimson Wizard »

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #44 on: 19 Sep 2014, 22:22 »
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

  • Posts: 8,747
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #45 on: 19 Sep 2014, 22:38 »
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. :)
« Last Edit: 19 Sep 2014, 22:56 by Crimson Wizard »

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #46 on: 22 Sep 2014, 17:45 »
No problem!
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Monsieur OUXX

  • Posts: 3,545
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #47 on: 18 Jul 2017, 13:38 »
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

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #48 on: 03 Jan 2018, 18:57 »
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

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #49 on: 02 May 2018, 20:05 »
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

  • Posts: 3,545
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #50 on: 03 May 2018, 10:12 »
What are the novelties? ;-D
 

Crimson Wizard

  • Posts: 8,747
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #51 on: 19 Sep 2018, 18:06 »
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.
« Last Edit: 19 Sep 2018, 18:09 by Crimson Wizard »

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #52 on: 22 Sep 2018, 16:51 »
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

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #53 on: 24 Sep 2018, 20:25 »
Time is off.
The sources are online.

https://bitbucket.org/rulaman/wfn-fonteditor
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

  • Posts: 8,747
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #54 on: 24 Sep 2018, 21:18 »
Time is off.
The sources are online.

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

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


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.

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

Crimson Wizard

  • Posts: 8,747
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #55 on: 03 Dec 2018, 15:40 »
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.Typ es.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.