Jibble

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

Monsieur OUXX

  • Posts: 3,541
  • 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 #20 on: 28 Oct 2013, 12:22 »
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.




« Last Edit: 28 Oct 2013, 14:08 by Monsieur OUXX »
 

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #21 on: 28 Oct 2013, 19:26 »
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

  • Posts: 86
  • Time Traveller
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #22 on: 28 Oct 2013, 23:43 »
- 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.
« Last Edit: 29 Oct 2013, 18:03 by Daniel Eakins »
We all have our time machines, don't we?

Monsieur OUXX

  • Posts: 3,541
  • 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 #23 on: 14 Nov 2013, 10:01 »
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
« Last Edit: 14 Nov 2013, 20:57 by Monsieur OUXX »
 

Crimson Wizard

  • Posts: 8,737
    • 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 #24 on: 14 Nov 2013, 21:00 »
@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

  • Posts: 3,541
  • 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 #25 on: 14 Nov 2013, 21:14 »
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

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #26 on: 15 Nov 2013, 16:46 »
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

  • 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 #27 on: 15 Nov 2013, 17:00 »
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

  • Posts: 3,541
  • 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 #28 on: 16 Nov 2013, 00:50 »
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

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #29 on: 16 Nov 2013, 20:11 »
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

  • Posts: 3,541
  • 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 #30 on: 17 Nov 2013, 14:33 »
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.

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.
« Last Edit: 17 Nov 2013, 14:39 by Monsieur OUXX »
 

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #31 on: 25 Nov 2013, 20:20 »
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

  • Posts: 8,737
    • 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 #32 on: 14 Mar 2014, 11:52 »
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: ShowHide

Code: C#
  1.                         if ( bmpData.Width <= 8 )
  2.                         {
  3.                                 bytesPerLine = 1;
  4.                         }
  5.                         else if ( bmpData.Width <= 16 )
  6.                         {
  7.                                 bytesPerLine = 2;
  8.                         }
  9.                         else if ( bmpData.Width <= 32 )
  10.                         {
  11.                                 bytesPerLine = 3;
  12.                         }
  13.  

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
« Last Edit: 14 Mar 2014, 21:31 by Crimson Wizard »

Crimson Wizard

  • Posts: 8,737
    • 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 #33 on: 14 Mar 2014, 21:55 »
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.Me nuPasteClicked(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).
« Last Edit: 14 Mar 2014, 22:01 by Crimson Wizard »

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #34 on: 15 Mar 2014, 17:31 »
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

  • Posts: 8,737
    • 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 #35 on: 18 Mar 2014, 08:15 »
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 :).
« Last Edit: 18 Mar 2014, 09:11 by Crimson Wizard »

Alan v.Drake

  • Posts: 330
  • ...
    • Alan v.Drake worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #36 on: 21 Mar 2014, 18:04 »
[...] 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

  • Posts: 8,737
    • 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 #37 on: 22 Mar 2014, 20:55 »
[...] 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

  • Cavefish
  • Posts: 2,045
  • still mowing the lawn
    • abstauber worked on a game that was nominated for an AGS Award!
      abstauber worked on a game that won an AGS Award!
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #38 on: 24 Mar 2014, 13:06 »
Unfortunately the stand-alone editor crashes when I try to load anything.
Spoiler: ShowHide

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..c tor(String filepath, String filename, String fontname)
   bei WFN_FontEditor.MainWindow.FontListBox_S electedIndexChanged(Object sender, EventArgs e)
   bei System.Windows.Forms.ListBox.OnSelected IndexChanged(EventArgs e)
   bei System.Windows.Forms.ListBox.WmReflectC ommand(Message& m)
   bei System.Windows.Forms.ListBox.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNat iveWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNat iveWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callb ack(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.

Apart from the reported bugs, it works fine inside the editor.

Rulaman

  • Posts: 83
Re: EDITOR PLUGIN: WFN-FontEditor
« Reply #39 on: 25 Mar 2014, 19:45 »
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.