Jump to content

Westwood Font Editor [Development thread]


Nyerguds

Recommended Posts

v1.5 released.

Pasting images into the editor works now! How they come out depends entirely on the palette you got selected, since it'll match the pasted content on the palette as closely as possible.

A little test with the editor's own icon: (I temporarily changed the first palette color to black to do the paste for this)

fonteditor_18_paste.png

Other features include:

  • Changing the font type
  • A global color replace function
  • ctrl+arrow keys as shortcuts for symbol image data shifting, with ctrl+shift+arrows acting as global shifting of all symbols on the entire font. You may need to click in the main editor area for this to work, as it's disabled on controls that use certain of these shortcuts themselves (like text fields and the grid listing the symbols)
  • A right-click menu on the preview image to copy the image on it to the clipboard.
Link to comment
Share on other sites

Aaaand 1.5.1 released. Derp.

I messed up the paste logic; it tried to take image data before actual font data. Since copying a font symbol copies it both as font symbol data and as image, that means the paste logic never still used the font data version, and so the pasted stuff not only became palette-dependent (with a possibility of messing up colors, especially if that palette had changed), but also lost its Y-offset :dry:

[edit]

1.5.2 released: added some much-needed close confirmation, and finally implemented conversion logic into the "save as" dialog, so you can select the type to save as from the types dropdown list.

Not that I advise that, though; conversion usually needs some more touchups you'll need to do in the editor anyway :P

Link to comment
Share on other sites

Fixed a bug that corrupted the clipboard when editing palette colour #0.

 

So, apparently some rogue programmer at Microsoft in the time of the Windows Vista development thought it was a good idea to make double-clicking a Label copy its text to the clipboard. If you're wondering, I use Labels with a background colour set to build up the colour palette.

 

And it was done in such a half-assed way that the fix for it was pretty dumb, too.

Link to comment
Share on other sites

Yup. I actually thought it was the colour picker at first, and was kind of baffled by the fact it didn't seem to happen every time. Then I noticed that when I tried to paste the contents of the clipboard in various programs after the 'corruption', that, when pasted in MS Word, it put a "T" in the document.

Which is the little "Transparency" indicator the palette picker puts on colour #0. :huh:

In other words, it only does it when there's text on the label. The bafflingly stupid fix for it was apparently to make my own Label class which was derived from the original MS Label class, but which had its own new public "Text" property, overriding the original one. The whole Windows UI system adapted to that flawlessly, using the new offered Text stored in my own class... but that clipboard copy logic still seemed to use the internal one in the underlying "Label" itself, which was now never filled in. So yea, whoever did that thing did it in a really hacky way that didn't even use the normal publicly accessible data of the Label object.

(Another weird detail: when pasting the contents in Gimp after that "corruption", the image itself still appeared, despite all programmatic analysis done on the clipboard objects at that point assuring me there was no trace of any image data on the clipboard. Wut. Now I'm really wondering how Gimp accesses the clipboard O_o)

Link to comment
Share on other sites

  • 3 months later...

Fixed a couple of bugs in this, and released v1.5.6.

If you copy a symbol using ctrl+c or the menu, you can now also paste the character as text (as shown in the sidebar, according to the currently chosen text encoding) in text applications.

Seems like a little thing, but when dealing with these Cyrillic letters I really want to open these in something where I can take a closer look at them, lol.

Link to comment
Share on other sites

A couple more micro-releases later, I'm at 1.5.9, lol. Actually using this on a project sure brings a lot of bugs, missing features and little usability nuisances to light.

  • Fixed a crash in the previewer when one of the previewed characters is the last character in the font.
  • Fixed a bug in the font size changing that made it change the wrong dimension (which in turn led to crashes as the symbol size dimensions on the UI tried to adapt the wrong way).
  • Fixed the internal assembly name; it was still "CnCFontEditor".
  • Added shortcuts for "safe" image shifting, expanding the image to the shifted direction (with support for bulk changes)
  • Added shortcuts for changing the Y-offset (with support for bulk changes)
  • Holding down Ctrl now enables colour picker mode, for fast color picking.
  • Optimized refreshing of paint mode and color pick mode.
  • Colour picker now shows a hand cursor.
Link to comment
Share on other sites

  • 2 weeks later...

This still needs a little more development, but it's a feature I've wanted in there for a looong time; a manager for the palettes, which gives the ability to save edited palettes to a new entry on an external file.

fonteditor_19_pal_edit_1.7.0.png

This can do full management of the palettes, except for one detail: you can't rename the actual palette files. You can name them when creating them, you can delete them, but if you want to rename them, just go and find the files on your disk :P

Link to comment
Share on other sites

Thanks!

I got a new and really cool feature in the making, namely, pasting from clipboard with transparency support. This means that you can actually combine stuff, albeit in a somewhat rudimentary way; you can't really choose the position where it pastes except by adjusting what you copy. But you can get around that by editing / shifting / cutting out the stuff you want to copy in the editor, then copying to clipboard, and then just reverting the symbol you messed up by doing that ;)

Specifically, this it should make it much easier to add diacritics on characters that already exist.

I think I'll separate the options as "paste as symbol" and "paste on symbol".

Link to comment
Share on other sites

  • 3 months later...

I released a new version with better transparency support.

There is one big problem with the Windows clipboard: it does not have transparency support. Now, you may think, "hey, but application X I use handles that fine!" Yes, well. The standard image format on the clipboard doesn't have transparency support. But there are more options.

See, the clipboard can contain multiple objects simultaneously. When a symbol on the font editor is copied, it's not just in there as image. It's in there as image, as FontFileSymbol object of the font editor itself, and even as text character. So what these applications do is simple: they add it to the clipboard in more formats, and they support reading these extra ones.

A classic one seems to be png. A lot of applications, including MS Office and Gimp, support pasting that, with its transparency intact. But, when I filled the clipboard with the combination of standard clipboard image format and png, and pasted it into Chrome to upload it into Imgur, it took the nontransparent one, so apparently it can't handle the png version. Neither did I get a png image out of Chrome when I copied an image from the browser.

That's when I discovered the "device independent bitmap" (DIB) format. It's apparently another somewhat-standard way of putting an image on the clipboard.

However, according to its specifications, the type of DIB that Chrome put on the clipboard is 32-bit RGB. This means that while each colour is saved in 4 bytes, the 4th of those is not supposed to be read, and the format has technically no transparency. But it seems Chrome completely ignores that, and uses the format as ARGB. Just test it out; an image with transparency copied from Chrome and pasted into Gimp does not retain its transparency, because Gimp handles the format correctly. Meanwhile, that same image copied from Chrome and pasted into Imgur in Chrome will be uploaded with its transparency intact.

So in the end, I had no choice but to support this bastard-DIB format, because apparently reality is a lot less elegant than any specification. Yey X_x

 

Link to comment
Share on other sites

The mess with transparency just got kicked up a notch...

Apparently when you press Print Screen on a (Windows 10) desktop made of 2 screens with different heights, the resulting image is actually put in the clipboard by Windows itself as that bastard DIB format with transparency in it; the area under my smallest screen is transparent, not black.

GOxnaJj.png

This was saved through the font editor's clipboard code. When pasted in Gimp, the area underneath the left monitor image is, again, black, as it should technically be according to the DIB specs.

Link to comment
Share on other sites

  • 9 months later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...