Bad Font Alignment

For general discussion related FlowStone
Post Reply
Perfect Human Interface
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Bad Font Alignment

Post by Perfect Human Interface »

I created a pixel font, but found FS can't seem to render it correctly. It should be pixel-perfect, but it's blurry. Font size is set to 1, no alignment setting, style is "regular." It simply doesn't line up to pixels.

FontAlignment.PNG
FontAlignment.PNG (4.14 KiB) Viewed 13206 times



Not only is the placement of the text off but the spacing is too. So no hope of fixing it by setting x/y with area to float.

FontAlignment2.PNG
FontAlignment2.PNG (2.97 KiB) Viewed 13206 times


It should be exactly 1 pixel between each character. You can see it's a little wider.

This font renders perfectly in Photoshop, no problem.

Not expecting a fix for this, but I thought I would at least point it out. I'm not sure if this has any real effect on most other fonts. It is kind of a bummer though as it means I can't do what I was hoping to without rendering out all the characters and then writing a code to draw them all out.
TheOm
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Bad Font Alignment

Post by TheOm »

In Ruby you can change the Font Rendering Method.
Use the method setTextRenderingHint with one of the follwing arguments:
"off"
"singleBitPerPixelGridFit" -try this
"singleBitPerPixel" -or this one for your font
"antiAliasGridFit" -I like this one for small font sizes and transparent background when using normal fonts
"antiAlias" -this is the default setting and looks very blurry
"clearTypeGridFit" -this usually looks best with normal fonts but doesn't work if the background is transparent

Here's also an advanced label for quick testing and comparing of these options.
Attachments
label.fsm
(1.08 KiB) Downloaded 943 times
djbrynte
Posts: 613
Joined: Mon Jun 22, 2009 10:51 am
Contact:

Re: Bad Font Alignment

Post by djbrynte »

Hey mate do this save the fonts. So for example if another guy open my synth if i used font BLABLA. and he doesent have it. Does it still show this font blabla?
Perfect Human Interface
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Bad Font Alignment

Post by Perfect Human Interface »

TheOm wrote:In Ruby you can change the Font Rendering Method.


http://38.media.tumblr.com/tumblr_lvr97 ... r1_500.png

djbrynte wrote:Hey mate do this save the fonts. So for example if another guy open my synth if i used font BLABLA. and he doesent have it. Does it still show this font blabla?


It'll have to be installed on the machine in order for it to be used in the plugin.

...unless there's a magic Ruby function to load fonts from a folder or stored in a schematic as well. :)
Actually if you could just install a font from within ruby that might at least let you avoid creating an exe installer.
Perfect Human Interface
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Bad Font Alignment

Post by Perfect Human Interface »

Hi, bumping the old thread here. I've been putting TheOm's ruby label above to good use. There's an issue though that, consistently, the label will "forget" the vertical alignment setting when the project is reloaded, and ONLY the vertical alignment (even though both vertical and horizontal alignment are being combined into one string format connector). Of course it rights itself if you send it a trigger.

Anyone know how to fix this? Continue to be baffled by Ruby load issues. :S
TheOm
Posts: 103
Joined: Tue Jan 28, 2014 7:35 pm
Location: Germany

Re: Bad Font Alignment

Post by TheOm »

Perfect Human Interface wrote:Continue to be baffled by Ruby load issues. :S

Sigh.. Indeed, it's really annoying :roll:
This can be fixed by adding After Load and After Duplicate.
Attachments
Advanced Label.fsm
(1.05 KiB) Downloaded 907 times
Last edited by TheOm on Wed Mar 18, 2015 3:50 pm, edited 1 time in total.
Perfect Human Interface
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Bad Font Alignment

Post by Perfect Human Interface »

TheOm wrote:This can be fixed it by adding After Load and After Duplicate.


Yeah, I was hoping for a more "proper" solution. I'll stick with that until then. Thanks
Post Reply