Hey, I'd like to know how to filter fonts, not images fonts, .ttf fonts etc my text looks like this when I scale my camera, I do not know how to filter the font so i'd love to know how
(Also, I have looked on the Forums etc, I may not have looked hard, but I really do not want to look any further as I am busy as it is, so I'd just like a straight on answer, not a re-direct to another post that won't help me like I usually get -_-)
-Triplenox
Filtering Fonts
- slime
- Solid Snayke
- Posts: 3163
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Filtering Fonts
You can't in 0.8.0. Font:setFilter will likely be added to 0.8.1.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Filtering Fonts
Yes you can if you filter the image first.
Code: Select all
local fontImage = love.graphics.newImage("fontfile.png")
fontImage:setFilter("nearest", "nearest")
fontName = love.graphics.newImageFont(fontImage, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 :-!.,\"?<>_()")
- slime
- Solid Snayke
- Posts: 3163
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Filtering Fonts
Jasoco wrote:Yes you can if you filter the image first.
Triplenox wrote:Hey, I'd like to know how to filter fonts, not images fonts, .ttf fonts
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Filtering Fonts
My mistake. Your image above looks like a pixellated image font. In which case you should just use a pixellated image instead of an actual font file. It would probably be smaller in size anyway.
To answer it now, you can't apply a filter to normal fonts yet, but can fake it if you're willing to use canvases. Though you then risk the wrath of all the people here who can't use them. Basically you'd print to the canvas and then draw the canvas with a filter applied to it instead.
But then you're going overboard. Just use an image font as it seems you're looking for that kind of result anyway.
Otherwise if you're bent on using a normal font, just create a larger version of the font to use when scaled up instead of trying to use the scale features. (You'll need to move the text printing parts of the code OUTSIDE the camera drawing stuff in this case.)
To answer it now, you can't apply a filter to normal fonts yet, but can fake it if you're willing to use canvases. Though you then risk the wrath of all the people here who can't use them. Basically you'd print to the canvas and then draw the canvas with a filter applied to it instead.
But then you're going overboard. Just use an image font as it seems you're looking for that kind of result anyway.
Otherwise if you're bent on using a normal font, just create a larger version of the font to use when scaled up instead of trying to use the scale features. (You'll need to move the text printing parts of the code OUTSIDE the camera drawing stuff in this case.)
Who is online
Users browsing this forum: Bing [Bot], Semrush [Bot] and 3 guests