The mechanics of using a font at a certain size
The mechanics of using a font at a certain size
I'm trying to use an own font which I'm making pixel-by-pixel.
My goal is to use a certain gauge at 100% or 50% size without any interpolation/antialiasing
on the fonts. I played quite a lot with this, but I don't understand the system behind it yet.
Lets say I am doing a font 8x6 pixels, textsize 8 or 16 pixels, antialiasing off - it's still blurred at
the edges. I was able to do this once with clearcut edges, but I lost the font. :/
So now I am trying to create a font 30 pixels high, but everything I do - it's always blurred.
How can I continue?
Re: The mechanics of using a font at a certain size
Are you scaling the individual blocks to a whole number?
Re: The mechanics of using a font at a certain size
Yes,take a look at the screenshot - 8 pixels high, textsize 8 and 16 are blurred (scaling 200% t see it better).
Re: The mechanics of using a font at a certain size
Hi,
This is always a bit of black magic (for me at least). It is partly up to the GPU.
Would you mind sending me a small test instrument, so I can test a bit?
Corjan
This is always a bit of black magic (for me at least). It is partly up to the GPU.
Would you mind sending me a small test instrument, so I can test a bit?
Corjan
Re: The mechanics of using a font at a certain size
It's a bit magic, yes.
8 pixels high too, but I cannot check since I did not save it. Perhaps it's a matter of wideness?
The goal is to have a font which is 30 pixels high at 100% and 15 pixels at 50% instrument scale.
I will do some more testruns to check the width at the same heigth.
Thanks for looking into it!
The attached instrument uses two fonts. The blurry one (testfont2) is 8 pixels high. The sharp one (testfont) should be8 pixels high too, but I cannot check since I did not save it. Perhaps it's a matter of wideness?
The goal is to have a font which is 30 pixels high at 100% and 15 pixels at 50% instrument scale.
I will do some more testruns to check the width at the same heigth.
Thanks for looking into it!
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: The mechanics of using a font at a certain size
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: The mechanics of using a font at a certain size
Hi,
Just checked both fonts in FontForge.
There seem to be some differences, see screenshot. I'm not sure how fonts work exactly, but you can tell from the numbers that stuff doesn't allign perfectly.
Corjan
Just checked both fonts in FontForge.
There seem to be some differences, see screenshot. I'm not sure how fonts work exactly, but you can tell from the numbers that stuff doesn't allign perfectly.
Corjan
Re: The mechanics of using a font at a certain size
There is some magic to the fontsize. To make a font at 50% clear without any interpolation,
the fontsize and position of text has to be divideable by 2.
First I measured the required fontsize from a photo of the real instrument, then made it
the same pixelheight in fontstruct. Afterwards I tried a teststring in AM at different sizes
and zoomed in to find out which one is without interpolation. I seems fontsize in AM needs
to be +2 to the height of the letter.
My main goal was to increase the TRQ/TOT/N1 readability of the EC 135 VEMD, along the
way I tuned minor details too, like coordinates, limit colors, + sign to OAT and voltage and stuff.
Lots of work just for a little gain, looks like Pareto was right once again
the fontsize and position of text has to be divideable by 2.
First I measured the required fontsize from a photo of the real instrument, then made it
the same pixelheight in fontstruct. Afterwards I tried a teststring in AM at different sizes
and zoomed in to find out which one is without interpolation. I seems fontsize in AM needs
to be +2 to the height of the letter.
My main goal was to increase the TRQ/TOT/N1 readability of the EC 135 VEMD, along the
way I tuned minor details too, like coordinates, limit colors, + sign to OAT and voltage and stuff.
Lots of work just for a little gain, looks like Pareto was right once again
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: The mechanics of using a font at a certain size
Hi,
I discovered something today. The quality of font placed on a canvas is largely improved if a smaller font size is placed on a smaller canvas the the canvas is resized using move()
NOTE: You can also compress,stretch,and distort the text.
Keith
I discovered something today. The quality of font placed on a canvas is largely improved if a smaller font size is placed on a smaller canvas the the canvas is resized using move()
Code: Select all
robR_20blubkbgC="font:roboto_regular.ttf; size:20px; color: #3cb7da; halign:center; valign:center;background_color:black"
my_text1_cv=canvas_add(0,0,150,40)
my_text2_cv=canvas_add(0,0,150,40)
canvas_draw(my_text1_cv, function()
_rect(0,0,150,40)
_fill("black")
_txt("Hellow World",robR_20blubkbgC,75,20)
end)
move(my_text1_cv,100,100,150,40)
canvas_draw(my_text2_cv, function()
_rect(0,0,150,40)
_fill("black")
_txt("Hellow World",robR_20blubkbgC,75,20)
end)
move(my_text2_cv,100,160,675,180)
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card