EDITOR PLUGIN: WFN-FontEditor

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

Previous topic - Next topic

Rulaman

Hi,

here is the brand new WFN-FontEditor.

It comes in two versions:
1. A standalone version like Radiants FontEditor
2. As a plugin to AGS

Now it is available the Version 1.2.1.0

Download Version 1.2.0.0
Download Version 1.2.0.0 sources
Download Version 1.2.0.1
Download: Download Version 1.2.1.0

A bugfix release is out.

Additional features:

Since 1.2.0.1:
- save the selection field background color                                (p/s)
- save the state of the grid option                                             (p/s)
- save the render text                                                                (p/s)
- render the font in an example text                                          (p/s)
- change the color of the selection field with right click on it      (p/s)
- extend the font to 256 character                                             (p/s)
- show, if a font is 128 or 256 characters                                   (p/s)

Since 1.2.1.0:
- correct a mistake, that saves a corrupted file

Edit 2018-09-25
https://bitbucket.org/rulaman/wfn-fonteditor
Edit 2021-09-09
https://github.com/Rulaman/WFN-FontEditor


By the way, it was a nice practice to code.
Rulaman


PS: I updated this post to reflect the new changes
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

#1
Very nice.
Does it allow 256 characters? Alan v.Drake's Draconian Edition supports 256-chars WFN, also he added this support into development branch of AGS.
Will a source code be released? Simply being curious.

I'll be trying it out for certain.

E: It works in the new editor version with floating panels, but obviously not really fit for resizable window. I don't know if it will be easy to add size constraints to a floating panel. Currently font editor looks tad ugly on it.

Rulaman

#2
At the moment only 128 charachters. I can add the rest. (Didn't know there are more chars to support.)
About the floating-problem: I have to download the newest version and check against ist. (tested it with 3.2.1)

The sourcecode will be released, after the first tests will be made. At the moment i have a mercurial repository on my hard disk. Maybe I uploaded it to bitbucket. (But beware. The revision-comments are all in German. The comment in the program are english, because I plan to release the source.)


Edit: Can you explain me, what is ugly?
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

#3
Quote from: Rulaman on Thu 27/06/2013 20:46:24
Edit: Can you explain me, what is ugly?
In the new editor the panes could be docked to any place and also made into floating windows, which means they could be resized.
This does not look good with panes that do not set any contraint on their size (like minimal window size) or do not re-arrange controls to better fit the resized client area.

Well, to illustrate what's going on:
http://img18.imageshack.us/img18/2222/0r9r.png

That's a problem of editor rather than your plugin; some other panes behave the same. Or maybe it is not a problem at all, because people may minimize those windows on purpose.
So, on second thought, do not mind this.


Regarding testing, I found two serious problems:
1. When I open font editor in either stand-alone or plugin form, and the font list is empty, interacting with almost any control results in "NullReferenceException".
2. When in the AGS, I can't figure out how to populate font list, or load any font, at all. Therefore, I can't select a font to edit. :-\.

SpeechCenter

First, I think it's a good idea to have this and it does the basic functionality it is supposed to do.
The plugin does need work

  • The font list should be in the tree view, probably similar to AGS font viewer
  • Consequently, each font should have its own editing window
  • If a font changed, it should indicate that with an asterisk at the title
  • It's better to be consistent and save when the user saves the project, even scripts which are separate files act this way and don't have a save button

As CW wrote, there are other more general improvements that should be done aside from some bugs like the exception thing.
Zoom in and out would be also helpful since the text is extremely small on any reasonable resolution, I think the size displayed now is not that useful, should be similar to AGS own font view.
I would also consider here usability features like copy-paste, undo, create new font, duplicate font and view original compared to the one being edited.

Other minor details, it's not trivial to know that left click draws and right click erases, so at least some text should say this. Also, could be useful to change the mouse cursor to pencil when the cursor is over the edit region. In addition, try to see if placing the editable region on the right would be more aesthetic, at the very least I would place it and the size editing in a group box. You'll need to play around with it, unfortunately, these things take time and trial and error.

Rulaman

#5
Hi,

I have modified my plugin. Now with tabs and better integration in AGS.

WFN-FontEditor V1.0.7.0

Features:

- Character overview has zoomfactor 2 (fixed); editable char has now zoomfactor 15 (1 to 40)
- show tabs in stand alone mode when click on the font in the loaded selection
- load font in plugin only when selected
- stand-alone version shows asterisk, when font is modified (plugin-variant ??? how to do)
- Right click option in Menu Fonts added (only for wfn-fonts)
- undo/redo actions per character (right click on character; not on the edit field)
- supports 256-character wfn-fonts (font not yet available, since not all chars are designed)

What's left:

- fill character with white or black
- move character position (one or all)
- copy and paste
- (request a feature)

Edit: Images removed
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Rulaman

#6
A new version of the WFN-FontEditor is in BETA state.

additional features to 1.0.7.0:
- character move up, down, left, right
- clear or fill the entire character
- copy and paste of characters (over clipboard; so you can invert your char in another picture editing program)
- Show Grid-option for better editing
- swap the colors (left-black, right-white or vice versa)
- swap the character (horizontally or vertically)
- invert the character

If you wanna test, please let me know.

Edit: Image deleted
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Meystari F

It would be so cool if this has icelandic fonts too. I can then finally make icelandic AGS games in future.

That's why I want to try this out.

Meystari F

Is it possible to convert wfn fonts into sci fonts? How can I use wfn fonts into my game? It can only use sci fonts.

Rulaman

I had a quick look over an sci-font and the spec. I think it is possible. But there are several tool for editing sci-fonts like SCI Studio.
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Rulaman

#10
Now it is available the Version 1.1.0.0

Download Version 1.0.9.0
Download Version 1.1.0.0

additional features to 1.0.7.0:
- character move up, down, left, right
- clear or fill the entire character
- copy and paste of characters (over clipboard; so you can invert your char in another picture editing program)
- Show Grid-option for better editing
- swap the colors (left-black, right-white or vice versa)
- swap the character (horizontally or vertically)
- invert the character
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Giocherellone

Hi Rulaman!

May you re-upload the Version 1.1.0.0, please?

The download does not work...

Ciao :wink:

Rulaman

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

Rulaman

So, it comes to an end.
I have the version 1.2.0.0 at the start and I will include a readme.
Please tell me, if it is ok so and correct my spelling mistakes. (Will you?)

----------------------------------------------

Manual
======


1. Explaination
---------------
This is an editor for wfn fonts, as well ad for sci fonts.
The functions depends on the usage as a plugin for AGS (AdventureGameStudio)
or as a stand alone version.


2. Terms and Definitions
------------------------
p = plugin
s = stand alone


3. Features
-----------
- Edit wfn fonts                                                                (p/s)
- Edit sci fonts                                                                (  s)
- The fonts can outlined [Button 'Outline']                                     (p/s)
- Convert between sci and wfn fonts [Button 'Convert selected']                 (  s)
  the field text height is only for sci fonts interesting.
  It set the space between two text lines and not
  the textheight itself
- Shift the characters to up, down, left, right [Buttons 'U', 'L', 'D', 'R']    (p/s)
- Invert an character [Button 'Invert']                                         (p/s)
- Clear an character (with black) [Button 'Clear']                              (p/s)
- Fill an character (with white) [Button 'Fill']                                (p/s)
- Swap an character horizontally or vertically [Buttons 'Swap H', 'Swap V']     (p/s)
- Outline the complete font [Button 'Outline Font']                             (p/s)
- Show a grid for better font designing                                         (p/s)
- Multiple Redo/Undo [Right click on the character selection field]             (p/s)
- Copy to and paste from the clipboard                                          (p/s)
  [Right click on the character selection field]
- Zoomable edit field (2â€"40)                                                    (p/s)
- Swap the left color and the right color (click on the connected arrows)       (p/s)

4. Start
--------
Start the program, or copy the plugin to your AGS path and start AGS.

4.1 Stand alone
---------------
After you have started the program stand alone, you have to click open and select a path.
In the list on the left side, it shows you all the fonts, you can edit
(wfn and sci [version 1.2.0.0 and higher]).

4.2 Plugin
----------
Start AGS and load a game. On the pane you found an entry named 'FontEditor'. Open it and
it will show all editable fonts. Under 'Fonts' you found all fonts, used by your game.
It is possible, that you find more than just the ones under 'FontEditor', because AGS is able
to handle ttf fonts as well, but not this editor.
Double click on an entry under 'FontEditor' to edit the selected wfn font, or right click under 'Fonts'
and select 'Edit font (with WFN-FontEditor)'.

5. Workflow (usage)
-------------------
After you have selected a font, you have to click on an character on the left side (selection field) to show it
zoomed. You can select the check box 'Show grid' for a better editing feeling. Now yo can click in the (zoomed)
field to edit the selected character. It updates the character in the left selection field. By dragging your mouse
while holding the mouse button down, you can edit more pixel in a row.

6. Tips
-------
If you want to make a font and a outline font too, it yould be good you have a border around your characters. That
means, one pixel on every side of the character is black. After you designed your font (or converted it from ttf
by using the TtfToWfnSci converter), save it and make a copy (with a file manager). Name the copy correct (file convention)
with a number higher and reopen the WFN-FontEditor. Than select the correct font and click 'Outline Font'.
Check the characters an you will be done.


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


Rulaman

So it's out, the new version

Download Version 1.2.0.0
Download Version 1.2.0.0 sources

I will no more work on this software, unless a feature is requested for good reason.

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

Meystari F

You did a great work. Thanks to you I can do icelandic games with AGS. :)

Adeel

Great Job, Rulaman! Finally, the latest font editing program. Radiant's program has gotten 9 years old 8-0!

I can't download it :(. No matter how many times, I click the download button. Counter increases, new page is loaded saying "Not Allowed" and then it redirects to the link you provided :(.

I'll be sure to give it a try to create a new font for my game, once you sort out the link's problem. Needless to say, you'll credit too. :)

I took the time to proofread your manual. I may not not be the best proofread although I've picked and corrected some mistakes. I've highlighted them so that you may compare my version to yours and notice what I did.

----------------------------------------------

Manual
======


1. Explanation (fixed by CW)
---------------
This is an editor for wfn fonts, as well as for sci fonts.
The functions depends on the usage as a plugin for AGS (AdventureGameStudio)
or as a stand alone version.


2. Terms and Definitions
------------------------
p = Plugin
s = Stand Alone


3. Features
-----------
- Edit wfn fonts                                                                (p/s)
- Edit sci fonts                                                                (  s)
- The fonts can be outlined [Button 'Outline']                                     (p/s)
- Convert between sci and wfn fonts [Button 'Convert selected']                 (  s)
  the field text height is only for sci fonts interesting.
  It set the space between two text lines and not
  the textheight itself
- Shift the characters to up, down, left, right [Buttons 'U', 'L', 'D', 'R']    (p/s)
- Invert a character [Button 'Invert']                                         (p/s)
- Clear a character (with black) [Button 'Clear']                              (p/s)
- Fill a character (with white) [Button 'Fill']                                (p/s)
- Swap a character horizontally or vertically [Buttons 'Swap H', 'Swap V']     (p/s)
- Outline the complete font [Button 'Outline Font']                             (p/s)
- Show a grid for better font designing                                         (p/s)
- Multiple Redo/Undo [Right click on the character selection field]             (p/s)
- Copy to and Paste from the clipboard                                          (p/s)
  [Right click on the character selection field]
- Zoomable edit field (2â€"40)                                                    (p/s)
- Swap the left color and the right color (click on the connected arrows)       (p/s)

4. Start
--------
Start the program, or copy the plugin to your AGS path and start AGS.

4.1 Stand alone
---------------
After you have started the program stand alone, you have to click open and select a path.
In the list on the left side, it shows you all the fonts, you can edit
(wfn and sci [version 1.2.0.0 and higher]).

4.2 Plugin
----------
Start AGS and load a game. On the pane you found an entry named 'FontEditor'. Open it and
it will show all editable fonts. Under 'Fonts' you found all fonts, used by your game.
It is possible, that you find more than just the ones under 'FontEditor', because AGS is able
to handle .ttf fonts as well, but not this editor.
Double click on an entry under 'FontEditor' to edit the selected .wfn font, or right click under 'Fonts'
and select 'Edit font (with WFN-FontEditor)'.

5. Workflow (usage)
-------------------
After you have selected a font, you have to click on an character on the left side (selection field) to show it
zoomed. You can select the check box 'Show grid' for a better editing feel. Now you can click in the (zoomed)
field to edit the selected character. It updates the character in the left selection field. By dragging your mouse,
while holding the mouse button down, you can edit more pixels in a row.

6. Tips
-------
If you want to make a font as well as an outline font too, it would be better if you have a border around your characters. That
means, one pixel on every side of the character is black. After you've designed your font (or converted it from ttf
by using the TtfToWfnSci converter), save it and make a copy (with a file manager). Name the copy correct (file convention)
with a number higher and reopen the WFN-FontEditor. Than select the correct font and click 'Outline Font'.
Check the characters and you will be done.


Greetings
Rulaman

Rulaman

Curious!
Did you block any Scripts?
It works for me.

Thanks for the corrections.
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Adeel

Quote from: Rulaman on Sun 08/09/2013 09:51:29
Curious!
Did you block any Scripts?
It works for me. [...]

Sorry for the late reply. I had missed it.

No, I didn't block any script. No matter how many times I download it, I'm always redirected to the link you sent to me (without any file) but the counter increases!

Quote from: Rulaman on Sun 08/09/2013 09:51:29
[...] Thanks for the corrections.

You're welcome. :)

EDIT:
Whilst typing, I tried to download the files again. This time I enable Send Referrer Information. To my surprise, the download worked ;-D! I'm curious why this website requires referrer information even though other websites work perfectly fine with it being disabled. :

Thanks for the program once again. :)

Monsieur OUXX

#20
It's a bit cheeky but I have a few requests, I'll just post the list, from easier to harder:
- Bounding box : that each character has a rectangle around it. So that the end-user is sure if there is an actual character to click at that location (possibly entirely black) or if there is nothing
- Click detection: that the click on the characters is not pixel-perfect, but instead the whole rectangle can be clicked anywhere.
- Unsupported formats: that there is a clearer error message when one tries to open an unsupported font format (e.g. 256-characters SCI format)
- Silent "save": that the software's visual feedback is better when the user clicks on "save". For example, when no font is open, if you click on "save", nothing happens. Other example: As it is now, you can open one format, edit it, and then save it (in the same format). You can't save cross-format. When you click on "Save" you'd hope there would be something happening. For example, a popup telling you that you overwrote the actual file. Or an asterisk that was in front of the currently modified file's name (like in any text editor), and the asterisk would disappear. Any visual feedback.
- Non-obvious conversion options : The usual practice in other apps, when one wants to convert, is to "save as". Here, there's a "convert selected" button. ...Selected what? font or character? When I click on that button, nothing happens, but all the open fonts get closed.
- Non-English languages: That it supports 256 characters (possibly in ISO-xxxxx), rather than just 128.




 

Rulaman

Bounding box : The character has a black background, the field itself is dark gray. Look closer. (But the background can't changed at the moment. I must implement it.)

Click detection: You can click the whole character. I didn't see the spot.


Unsupported formats: You can only open FONT.* (SCI), or *.WFN. It isn't important, if the font contain 128 or 256 characters .

Silent "save": What should happen, when you click on save, and nothing is open? You know, that nothing is open. But okay, that's a point. You can save cross format, Use the stand alone variant and click convert. (Description in the manual.)

Non-obvious conversion options : I can't reproduce this bevahiour. Why should all fonts close? (Convert selected character doesn't make any sense. So what?) What did you expect, when you click on the "Convert selected" button? It saves the WFN font in SCI format, when highlighted in the list, or saves a WFN font in SCI format.

Non-English languages: You din't read the manual. It supports 256-character.

Here is a font with 256 character: http://www.adventuregamestudio.co.uk/forums/index.php?topic=48798.msg636465473#msg636465473


80 percent of your request don't make any sense in my opinion, or I didn't understand them.
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Daniel Eakins

#22
Quote from: Monsieur OUXX on Mon 28/10/2013 12:22:30
- Unsupported formats: that there is a clearer error message when one tries to open an unsupported font format (e.g. 256-characters SCI format)
Hi Monsieur OUXX. Font management in the various versions of AGS and related tools is very diverse and there are lots of compatibility issues to consider.

There is something very important to know concerning the "Import over this font" button in AGS. This button can be used to import fonts that are in the TTF format or in the SCI format (whether 128-character or 256-character). What's important to know is that when you import an SCI font in the editor, the editor actually modifies the file slightly, for the purpose of game development. The modified file is not an "original" SCI format anymore; it's a "custom AGS format".

The catch is that the "Import over this font" button can import "original" SCI fonts, but it cannot import "custom AGS format" fonts. Yeah, AGS cannot import its own format; this is a bug in the editor. The fonts that Rulaman linked to in his last post are actually instances of this "custom AGS format", which means that they cannot be imported in AGS using the "Import over this font" button -- this is an issue totally unrelated to the fact that they are 256-character.

The only way to import "custom AGS format" fonts in AGS is to directly replace one of the font files in your game's directory with your new font (renamed) in the Windows explorer. Close and reload your editor to see the change.

What I said above allows you to import any font in AGS. But of course, if you are using AGS 3.2.1 or lower, you will only be able to use the first 128 characters of the font. If you want to use all 256 characters, one way is to use the Draconian split branch of AGS, or the AGS 3.4.0 alpha version (or wait for the stable version of AGS 3.4.0).


EDIT: Another way to have 256-character fonts is to use Calin Leafshade's SpriteFont Renderer plugin. It's probably the best option if you don't want to change your AGS version.
We all have our time machines, don't we?

Monsieur OUXX

#23
Quote from: Daniel Eakins on Mon 28/10/2013 23:43:05
The fonts that Rulaman linked to in his last post are actually instances of this "custom AGS format", which means that they cannot be imported in AGS

Thank god there are guys who make sense of that gigantic mess! :D
Thanks a lot.

@Rulaman: don't get me wrong, your tool is awesome. Most of the confusion came from the bug I encountered (that was causing all the open fonts to close, and nothing to get converted). I cannot seem to reproduce that bug either. I would suspect it happens when the app cannot write the converted font to disk, for any permission reason.

Here are the answers to the other points:







Also, for all those interested in multilingual fonts, this page could come handy : http://www.adventuregamestudio.co.uk/wiki/Fonts
 

Crimson Wizard

@Monsieur OUXX, I can see the difference between "light grey" and "dark grey" even on your picture, so that might be difference in monitor gamma level.

I agree that the constrast between character background and main background is way too low. Different colors and/or grid lines will improve the look greatly.

Monsieur OUXX

Quote from: Crimson Wizard on Thu 14/11/2013 21:00:22
that might be difference in monitor gamma level

In order to make sure it wasn't the reason, I zoomed in using Photoshop! And I used the "magic wand" tool to see if it would select something I didn't see. I believe you guys, but I'm wondering: what kind of wizardry is this? :D
 

Rulaman

Hi Monsieur OUXX,

About your problem with the O, you have to click on the white part: I can't reproduce this.

The other "problem" with the black and dark gray parts, I call this a hidden feature  :grin:.
But you are right, if it is a problem, I could make it clearer (other color) or selectable.

The good part about this tool is, that I delivered the sources, so every one could modify it (If I stopped the support).
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Scavenger

I really like this tool, I didn't find any outstanding bugs, but I did find it kind of hard to use. Apart from the clearer selection as stated before, would it be possible to be able to select characters by typing in the letters in a text box? I find it kind of hard to crossreference the ASCII table and figure out which box I'm clicking on when I have an empty font (which usually have 1x1 hitboxes) and select them for editing. I'd like to know which character I'm on in case two characters are alike. If this function was in there already I'm not sure I was able to find it.

Also, would it be possible to add a test render of the font to see if the font reads correctly without having to run a test game in AGS? Something with pangrams, like
The Quick Brown Fox Jumped Over The Lazy Dog
Falsches Üben von Xylophonmusik quält jeden gröàŸeren Zwerg
El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío, añoraba a su querido cachorro.

Those contain most of the extended ASCII characters, I believe. Though just being able to type a word would be awesome.

This program is amazing, though, a real lifesaver for doing >128 characters!

Monsieur OUXX

Quote from: Rulaman on Fri 15/11/2013 16:46:19
The good part about this tool is, that I delivered the sources, so every one could modify it (If I stopped the support).

That's cool.
Could I be as cheeky as to do two more enhancement requests? and those are really important, I believe, in the prduction flow of anyone manipulaitng fonts:
1) to be able to open a 128-chars font and click somewhere to extend it to a 256-characters font (with the 128 extra slots being empty at first).
2) to be able to entirely copy a selected character, to some "clipboard", and then paste it into another character.

That's because most people working with extended Latin characters have to work with commn characters (e.g. "n") and turn them into special ones (e.g. "ñ").

If you did those two things, your tool would become the ultimate tool for AGS fonts.
 

Rulaman

Hi you two (Scavenger and Monsieur OUXX),

first the easier requests.

Monsieur OUXX: 2) You can already copy and paste a character by clicking in the character field on the letter with the right mouse. (Did I mention it in the manual?) You can even paste it in an graphic tool and paste it back, after edited.
Monsieur OUXX: 1) Yeah, I think it could be possible.

Scavenger: You find the underlaying character by stay a while on the character.
Scavenger: The test rendering font is possible. I think about it. (Fixed implemented and freely selectable)

I think I implement a littel change in the background color and the ability to save the few values (color, grid, …) as well.

Greetings

PS: Any futher requests?
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Monsieur OUXX

#30
Quote from: Rulaman on Sat 16/11/2013 20:11:24
PS: Any futher requests?

Yes, since you ask! :) Starting editing a WFN/SCI font from a TTF font. I suppose (it's only a guess) it shouldn't be too hard, since AGS is able to open them and to render them as bitmaps.

Quote from: Rulaman on Sat 16/11/2013 20:11:24
Monsieur OUXX: 1) Yeah, I think it could be possible.

If you implement that: could you add a little label somewhere (anywhere!) saying: "you're currently working with a genuine 128-char SCI file", or "you're currently working with an AGS-only 256-characters SCI file" ? (or something similar). Once you know thet 256-char format is custom to AGS, it seems obvious, but before that it sounds like a puzzle to solve.
 

Rulaman

A bugfix release is out.

Additional features:

Since 1.2.0.1:
- save the selection field background color                                (p/s)
- save the state of the grid option                                             (p/s)
- save the render text                                                                (p/s)
- render the font in an example text                                          (p/s)
- change the color of the selection field with right click on it      (p/s)
- extend the font to 256 character                                             (p/s)
- show, if a font is 128 or 256 characters                                   (p/s)

Download: http://www.file-upload.net/download-8333852/WFN-FontEditor-V1.2.0.1.7z.html
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

#32
Is it possible to add few more things to the plugin?
1. Display the code of current character and total number of characters in font.
2. Next/Prev character commands.
3. Goto character (number) command. Alternatively, an option to display character codes in the main view.
4. (Maybe optionally) arrange characters in the uniform grid (aligned strictly by columns & rows). This will make it much easier to overview the font and find characters.
5. Some way to set same size to all characters in font.

Also, I don't really understand, how saving fonts works in plugin? It looks like font always got saved when pane is closed, which makes it impossible to undo changes; unless I miss something. Also, the pane's title shows asteriks (*) sometimes even though I did no changes, and - opposite - does not show it after I did some.


EDIT: Bug found in plugin code:
Spoiler

Code: csharp

                        if ( bmpData.Width <= 8 )
			{
				bytesPerLine = 1;
			}
			else if ( bmpData.Width <= 16 )
			{
				bytesPerLine = 2;
			}
			else if ( bmpData.Width <= 32 )
			{
				bytesPerLine = 3;
			}

[close]
This is incorrect, 3 bytes are for width = 24, and 4 bytes for width 32.
The general formula (used in AGS code) is:
Quote
bytesPerLine = (bmpData.Width - 1) / 8 + 1

Crimson Wizard

#33
I found two more bugs:
1. If you copy anything to the Windows clipboard (e.g. text), then right click on font character and select "Paste", the plugin will throw an exception:
Quote
System.NullReferenceException:
   ÃÂ² Indexed.Image.CopyToBpp(Bitmap b, Int32 bpp)
   ÃÂ² AGS.Plugin.FontEditor.FontEditorPane.MenuPasteClicked(Object sender, EventArgs e)

2. There's a bad bug, but it's a strange one, because it occured only on one computer, and did not on another.
If you extend a 128-character font to 256-characters, and edit only several characters in the middle of the second part, then they never be displayed. It appears that as soon as there's a non-edited character in font, the plugin saves all following characters with Width = 0 and Height = 0, even though some of them have contents (I found this detail only by debugging AGS).

Rulaman

Hi Crimson Wizard,

i'll look into it, when I have the time.
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

#35
Another bug: if I create new font, it does not appear under plugin node, so I can't choose it for editing until I reload the project.

UPD I found the bug that breaks font format when there's at least 1 non-edited character, created by extending 128-char font to 256-char. PMed Rulaman about details.
Interesting, the Draconian edition still works well with bad format, because of the way it loads font (it does not parse it, but loads as whole data chunk, same as AGS 3.2.1 did). My reimplementation fails though :).

Alan v.Drake

Quote from: Crimson Wizard on Tue 18/03/2014 08:15:51
[...] Interesting, the Draconian edition still works well with bad format, [...]

I guess it is the zero width/height characters that break this plugin and (I assume) your new code.
In fact I had been wondering why it wouldn't load my font, then realized that the empty characters (due to me importing a bitmap from radiant's fontedit) were blowing up the plugin due to trying to make an invalid 0x0 Bitmap.

- Alan

Crimson Wizard

Quote from: Alan v.Drake on Fri 21/03/2014 18:04:04
Quote from: Crimson Wizard on Tue 18/03/2014 08:15:51
[...] Interesting, the Draconian edition still works well with bad format, [...]

I guess it is the zero width/height characters that break this plugin and (I assume) your new code.
No, zero size is safely handled.
There was simply an incorrect size of data created for new blank characters in the plugin.

abstauber

Unfortunately the stand-alone editor crashes when I try to load anything.
Spoiler

Informationen über das Aufrufen von JIT-Debuggen
anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

************** Ausnahmetext **************
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei AGS.Plugin.FontEditor.FontEditorPane..ctor(String filepath, String filename, String fontname)
   bei WFN_FontEditor.MainWindow.FontListBox_SelectedIndexChanged(Object sender, EventArgs e)
   bei System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
   bei System.Windows.Forms.ListBox.WmReflectCommand(Message& m)
   bei System.Windows.Forms.ListBox.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Geladene Assemblys **************
mscorlib
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.3655 (GDR.050727-3600).
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll.
----------------------------------------
WFN-FontEditor
    Assembly-Version: 1.2.0.1.
    Win32-Version: 1.2.0.1.
    CodeBase: file:///D:/Eigene%20Dateien/AGS-3.3.0/WFN-FontEditor-V1.2.0.1/standalone/WFN-FontEditor.exe.
----------------------------------------
System.Windows.Forms
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.3645 (GDR.050727-3600).
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.
----------------------------------------
System
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.3644 (GDR.050727-3600).
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll.
----------------------------------------
System.Drawing
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.3644 (GDR.050727-3600).
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.
----------------------------------------
AGS.Plugin.FontEditor
    Assembly-Version: 1.2.0.1.
    Win32-Version: 1.2.0.1.
    CodeBase: file:///D:/Eigene%20Dateien/AGS-3.3.0/WFN-FontEditor-V1.2.0.1/standalone/AGS.Plugin.FontEditor.DLL.
----------------------------------------
AGS.Types
    Assembly-Version: 3.2.1.111.
    Win32-Version: 3.2.1.111.
    CodeBase: file:///D:/Eigene%20Dateien/AGS-3.3.0/WFN-FontEditor-V1.2.0.1/standalone/AGS.Types.DLL.
----------------------------------------
System.Xml
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.3654 (GDR.050727-3600).
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll.
----------------------------------------
mscorlib.resources
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.3655 (GDR.050727-3600).
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll.
----------------------------------------
System.Windows.Forms.resources
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.3053 (netfxsp.050727-3000).
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.
----------------------------------------

************** JIT-Debuggen **************
Um das JIT-Debuggen (Just-In-Time) zu aktivieren, muss in der
Konfigurationsdatei der Anwendung oder des Computers
(machine.config) der jitDebugging-Wert im Abschnitt system.windows.forms festgelegt werden.
Die Anwendung muss mit aktiviertem Debuggen kompiliert werden.

Zum Beispiel:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

Wenn das JIT-Debuggen aktiviert ist, werden alle nicht behandelten
Ausnahmen an den JIT-Debugger gesendet, der auf dem
Computer registriert ist, und nicht in diesem Dialogfeld behandelt.
[close]
Apart from the reported bugs, it works fine inside the editor.

Rulaman

Hi @all,

sorry for the delay but my pc crashed and now I haev VS only at work.
So it may take longer than I expected.
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

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?

eri0o

#60
Hey, I needed this plugin/editor to play around with fonts so I added a CI system for this project: https://github.com/ericoporto/WFN-FontEditor

A Pull Request is open here.

Edit: Rulaman merged it! :D

SMF spam blocked by CleanTalk