Difference between revisions of "Font:setFilter"

(Created page with "{{newin|0.9.0|090|type=function}} Sets the filter mode for a font. == Function == === Synopsis === <source lang="lua"> Font:setFilter( min, mag ) </source> === Arguments === ...")
 
(Added missing default value. Extended example.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{newin|[[0.9.0]]|090|type=function}}
 
{{newin|[[0.9.0]]|090|type=function}}
 
Sets the filter mode for a font.
 
Sets the filter mode for a font.
 +
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Font:setFilter( min, mag )
+
Font:setFilter( min, mag, anisotropy )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
 
{{param|FilterMode|min|How to scale a font down.}}
 
{{param|FilterMode|min|How to scale a font down.}}
{{param|FilterMode|mag|How to scale a font up.}}
+
{{param|FilterMode|mag (min)|How to scale a font up.}}
 +
{{param|number|anisotropy (1)|Maximum amount of anisotropic filtering used.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
 +
== Example ==
 +
<source lang="lua">
 +
local font = love.graphics.newFont(40)
 +
font:setFilter("linear", "nearest")
 +
 +
function love.draw()
 +
love.graphics.setFont(font)
 +
love.graphics.print("Hello", 100,100, 0, .5) -- Scaled down.
 +
love.graphics.print("World", 100,116, 0, 2)  -- Scaled up.
 +
end
 +
</source>
 +
 
== See Also ==
 
== See Also ==
* [[parent::Image]]
+
* [[parent::Font]]
 +
* [[Font:getFilter]]
 
* [[FilterMode]]
 
* [[FilterMode]]
 +
 +
== Other Languages ==
 +
{{i18n|Font:setFilter}}
 +
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=Sets the filter mode for a font.}}
 
{{#set:Description=Sets the filter mode for a font.}}
== Other Languages ==
 
{{i18n|Font:setFilter}}
 

Latest revision as of 05:53, 31 August 2022

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

Sets the filter mode for a font.

Function

Synopsis

Font:setFilter( min, mag, anisotropy )

Arguments

FilterMode min
How to scale a font down.
FilterMode mag (min)
How to scale a font up.
number anisotropy (1)
Maximum amount of anisotropic filtering used.

Returns

Nothing.

Example

local font = love.graphics.newFont(40)
font:setFilter("linear", "nearest")

function love.draw()
	love.graphics.setFont(font)
	love.graphics.print("Hello", 100,100, 0, .5) -- Scaled down.
	love.graphics.print("World", 100,116, 0, 2)  -- Scaled up.
end

See Also

Other Languages