SynthMaker

custom font render engine example

Archive · 2005 47 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

rl ·

If you build a plugin that uses special fonts installed on your computer it is highly problable that the fonts aren't available on other systems.

The solution presented here provides it's own font embedded in the schematic. The example uses a 5x7 font you find on dot-matrix displays of many synthesizers.

Implementation details: the font is a png image of printable characters sorted in ASCII order. According to the disussion in this thread the font is used as a "resource" and loaded only once. The font image and the font metrics can be accessed by wireless connectors.

The displayed string is parsed and split in individual characters, converted into ASCII code; the font glyphs are painted onto a view. There is some tricky stuff in the schematic (recursive parser usage, using the bus create/extract as a ASCII lookup table), so don't try this at home, kids (Would be much easier if SM provides more string primitive modules as suggested here).

According to a parser bug (See here for details), Space chars are not supported yet.

schematic file

Question to malc: I have to use an AfterLoad trigger to render the results on startup. Is there a better/easier way?

____________________________________________________________

UPDATE 05/12/08:

New schematic uses new string processing primitives instead of parser. All workaround cleared. No problem with spaces. All problems gone. Much simpler schematic.

New schematic here

Tom7777 ·

so don't try this at home

Im trying crazy stuff all the time in SM though 🙂

Great example, thanks rl, im also looking forward to those new string modules as im not so great with the parser at the moment 😉

Edit - I just noticed theres a few wireless connections in the 5x7-font module that are not connected, did you change the system from something else and forgot to delete them or is this an error? Also the split string modules size output for a word like "and" will register as 4 letters but im guessing this has something to do with the loop module after which changes it to 3 again but if theres 0 letters it will display 0 correctly but the loop modules output will display at 1.

sambean ·

Excellent couple of releases rl, both this and the 7-seg module.. Could definately put these to good use..

wrt to both these modules is it possible to have them re-scaleable without reloading the bitmaps? This would be quite a useful option..

Good work

Sam

malc ·

Whoa!

Pushing the boundries again 🙂

To answer your question about the redraw on load, it looks like the String Array component is not saving the array so a small bugette there.

lalo ·

😮 😮

mega great!!

rl ·

@dan: I started with some wireless connectors, because I thought they will be useful. Later it turned out, that not all of them are needed in the example. Maybe for others?

I noted too that the stringsize is one ahead. but thats exactly the value the Loop module needs.

@sambeam: rescaling does not look very pretty. BmpArea seems to blur images when scaling. It's like a good old non-TrueType, non-Vector bitmap font. Maybe SM will support SVG images one day?

Rudolf

Tom7777 ·

I started with some wireless connectors, because I thought they will be useful. Later it turned out, that not all of them are needed in the example.

Ah ok, i thought this was probably what had happened 🙂 As for the string size module i thought it was becuase of the loop after that it did this but you put a help module inside so i thought you might have ment for this to be used as a general parser module which is why i thought i should bring it up, hopefully this function (letter counter) will be one of the new string modules being added which you requested. 😉

The only thing i think your schematic might need now is a color change choice, white and black would be the colors i often use, i wonder if this can be done without using multiple bitmaps and a selector, it may not be possible at the moment.

Maybe there should be a bitmap alpha area to area module which could do this so it recognises only 255 solid colors as the area, this way you could overlay it with any color and also this would work great for masking colors in general, Malc is this a reasonable request for a module? thanks 🙂

NothanUmber ·

Here a spacy extension of rl's original schematic... 😀

the osm file

Greetings, NothanUmber

rl ·

yep, clever solution, but unfortunately non-Alnums (<>!"$%&/....) are not displayed.

NothanUmber ·

unfortunately non-Alnums (<>!"$%&/....) are not displayed.

shouldn't have used alnums... here a version that uses ranges and thus should work with more chars. Btw. if I reload the schematic it doesn't repaint correctly (have to go inside the component and outside once first, or hit the enter key in the input string field) . In theory the component that generates the array out of the string should send a trigger when it's ready with parsing but it doesn't seem to send it in some circumstances or the following font engine doesn't recognize it in all cases, has anybody a clue what could be wrong?

Greetings, NothanUmber

rl ·

UPDATE:

As an incentive for the developers for creating string primitve modules 😉 I've updated the schematic to use the new string processing primitives.

Download link is at end of first post in this thread

Shifrin ·

Cheers rl, I appreciate the update - this is really useful 😀

Shif.

sambean ·

Hey rl, thanks for this.. I use this for one of my plugins I'm working on, it's really smart.. I asked a while back about having it resizable, do you think if you switched off GUI smoothing it would be possible to have it resizable to whole factors (2x, 3x etc..)?

Sam

rl ·

will have to check. Another item on my list is support for non-monospaced "fonts".

infuzion ·

There are a neat monospaced font here: http://www.dsg4.com/04/extra/bitmap/ the -24 one...

rl ·

thanks for the free font link.

BTW: It could be that the usage of fonts as presented in this example causes licensing issues. I found out that some commercially purchased fonts are not necessarily allowed to be distributed, e.g. some font licenses do not allow embedding of fonts in PDF or powerpoint documents. So better check before running into trouble.

platinumears ·

rl wrote: BTW: It could be that the usage of fonts as presented in this example causes licensing issues.

I believe that's why Synthedit can't embed fonts into exported VSTs..

skOre ·

Embedded fonts are one major minefield. So as long as you own them and don't include them in a way that others would get them you're fine. Thats why I think there ought to be no problem with this bmp-rendering.

But be alarmed that fonts can be a pitfall, especially if you don't know from where you got them.

global goon ·

this is boss, can I use it in my synth? i'll post any fonts i make here...

:0)

jobro ·

Jikes! What about changing the font color?

sambean ·

[hint]Would be nice if we had a complimentary 'font render' module to go with this...[/hint]

Apart from that I'd recommend opening an art program and selecting the fonts and pasting a new colour version...

You could also probably use the colour matrix...

Sam

jobro ·

Yeah I was thinking that way as well, if the font could be white then you could afaik alter the color of the picture to make the white color whatever color you choose. Am I right?

Dave ·

How can i change the used bitmap font to another?

In the properties i can only change the size but not the bitmap itself :-(

sunsynth ·

Hi Dave,

double click on the 'font configuration panel' You see the hole font-bitmap... click on it 2 load a new one!

SUNsynth

Dave ·

Ah... thanks! I was looking for an common "open file dialog" in the properties 🙂

AngularMomentum ·

I did a template for knobman, where you can create ASCII font sets with ease for RL's schematic. Really in just a few clicks. Anyone interested please PM me your email and I'll send it.

AngularMomentum ·

All requests sent off! 😉

Nu Audio Science ·

Thank you very much AM 🙂

NAS

AngularMomentum ·

You are "very much" welcome!

sunsynth ·

Hi rl,

can u please have a look at ur schematic with v2.03:

i get a space between every character... 🙁

Cheers, Walter

DigitalWhiteByte ·

Reworked Custom Font Engine Now support full ascii table. 😀 Ps:in this schematic also find a new module: String to Ascii.

nix ·

thanks man!

sunsynth ·

Yeah - really thank U DWB

...appreciate ur mods 😉

jjs ·

Thanks for your contribution. I'm trying to implement this and it works. But how to get the FONTS bigger. I tried some of the values in different parts of your schematic but then strange things happen, like half displayed or some characters not.

Can you tell how i can easily change the size of the font displayed? Thanks. 🙂

DigitalWhiteByte ·

jjs wrote: Thanks for your contribution. I'm trying to implement this and it works. But how to get the FONTS bigger. I tried some of the values in different parts of your schematic but then strange things happen, like half displayed or some characters not.

Can you tell how i can easily change the size of the font displayed? Thanks. 🙂

Or you can create a different set of sizes for your fonts, but I remind you that it is based on a bitmap image, then you must create a new bitmap for the font size you need. You can do this with a graphics software but not really very practical, or you may use my Bitmap Font Tool, you can find it in the section of registered users.

jjs ·

Ok will check it out.

Thanks Digitalwhitebyte

regards, jjs

jjs ·

Hey Digitalwhitebite,

i noticed 2 wireless links not connected to anything also i could not find the receivers anywere. I tried to load some other bitmap fonts but, then half of the fonts are not shown when they are bigger then the original used font. Maybe this is why other fonts are not working with it. Could you check please?

thanks a lot for your help!

DigitalWhiteByte ·

Those links were then no longer used, are not used anywhere. However, if places an example of font you are using we can take a look.

jjs ·

oops, forgot to copy them on my USB stick. They're on my wife's laptop and she has took it to the hospital cause my daughter is ill.

I'll will take the font with me tommorow and post it here. I took a shanghai.ttf font and used a font maker to resize them to size 20. added some color and shadow effects and made a png from it. Only the characters i need so a-z. I did not quite understand if had to be 1 entire png containing all charcters or all separate, but now i know it has to be one image and all on 1 line. i extracted the image you use in your schematic. But its all very tiny and i want to use a size 20 or so.

It's not for a vsti or fx, but a little project i thought of. I had a version with only nr's, and now i have a version with names too, but it is hard to read. And i'm using your schematic in it. When it is ready i can send it to you.

When i'm correct i also used a little example from the dsp robotics forum because you can use them also in SM.

best regards, jjs

jjs ·

Hey Digitalwhitebyte,

this is the font i'm trying to use (attached)

On a colored background you'll see the shadow. Hope you can help me with this.

Thanks in advance

best regards, jjs

DigitalWhiteByte ·

ok now try to explain how, first you have to keep in mind that the fonts to be used must be created as a bmp image. you have to create the sequence for characters, respecting the character table ASCII. each character, for example in your case W=15pixel H=20pixel? must be a sequence of 15x20 cells, with no space.

The module is based on character code conversion to decimal value (it will be used as an index to select the proper portion of the cell in the bitmap).

If you only use numbers and capital letters, you will still leave blank spaces for the characters that you will not use to be inherent to the table ASCII.

Then: from the ascii table, your characters start from the decimal value 48 and ending with 90.

the characters in this sequence are: 48 >>> 90 0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ

even if you do not want to enter characters :;<=>?, will still be present, the empty cells in bitamp.

so as to have a single image that contains 42 cells, 15x20 pixels.

you specify in the module: Font width = 15; Font height = 20; Font char first = 40;

I hope I made myself understood.

jjs ·

Great. Thanks for explaining.

I used FontStudio 4.21 and it only uses png for graphics to save. But maybe its not good enough for it? It can also save the image with the cell lines.

I will test the settings you gave. In fontstudio the only thing you can enter is how big the fontsize must be. Its not giving details about height or width pixels.

I will test it and come back to you.

thanks a lot.

regards, jjs

Nu Audio Science ·

Has anybody still got the angular momentum .knob for rendering bmp fonts Hard drive failure and lost it 🙁

jjs ·

@ Digital White Byte,

so i finally have time to upload the font i'm using with the osm you've made. it's not working as it should, but i can't figure out exactly what is going wrong here. If you enter some characters they do not show as expected. Also i had to change some values to get in sight finally.

I ope you can assist me with this.

Thanks very much,

jjs

rl ·

Nice to see my ancient example still being useful.

jjs, there is a trigger problem. When the string changes, reset the counter of the array index and force a trigger of the redraw area (because this fires the V-loop). The connection from the the string length module is wrong (no trigger in case the length of the string does not change)

jjs ·

Hi rl,

thanks for helping. That indeed did the trick! I also changed the font width to 58 so the font comes out better.

When i have the project ready i can post it here as it will be freely available.

Best regards, jjs

jjs ·

As promised.

Place the BS2.txt from the zip file in c:\temp, it contains the names used in the program.

(i also made an installer wich does this automatically)

🙂

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.