Jump to content

CnCNet Forums

Search In
  • More options...
Find results that contain...
Find results in...

Westwood Font Editor [Development thread]

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)


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.

Share this post

Link to post
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:


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

Share this post

Link to post
Share on other sites

Released v1.5.3 yesterday... adding automatic height optimising to the v3 and v4 fonts, giving the text encodings more logical names, and fixing an import bug on the custom Dune 2000 FONT.BIN files (an undocumented feature anyway).

Share this post

Link to post
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.

Share this post

Link to post
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)

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

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.


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

Share this post

Link to post
Share on other sites


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".

Share this post

Link to post
Share on other sites

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


Share this post

Link to post
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.


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.

Share this post

Link to post
Share on other sites

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

  • Similar Content

    • By MVille
      Had cncnet open. Then it closed. Tried relaunching and it says cannot open because of virus or unwanted file. Have the installer, so tried that, and it said after going through the process, getting all the updates and extracting that it was missing a file couldnt complete the action. 
      Cant download new installer because it says virus detected/unwanted file.
      Any help would be appreciated
    • By DanGoMad
      Since today i can not play online TiberianSUN anymore. I have always played from this computer. Today i even played TS. I made a break durring midday and when i come bac some hours later i coudnt open TS-Online anymore. The map editor and singleplayer works still fine. But when i hit the "Play Online" Botton i get an error message. I didnt changed anything on my Computer and there was no updates from anything. I deinstalled and re-installed it. I tried the original-version from cncnet and some Beta-Version. But the Error message is still the same after re-install. All .exe files have Administrator rights and i tried all compatibility. Some times i get the Error Message that it is a Virus or Firewall block it, and most times it showes "Tiberian SUN Launcher Error, Error: CnCNet not found! Are u launching this from the game directory?"
      Yes i launch it from there. I also tried to deactivated my anti-virus and firewall software. It still stays the same.

    • By doublexe
      Windows say i have a trojaner in
      - cncnet.exe
      - TiberianDawn_Online_installer.exe
      - RedAlert1_Online_installer.exe
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...