Difference between revisions of "Font:setLineHeight (Deutsch)"

m (Add link to getter.)
(Add example.)
 
Line 13: Line 13:
 
=== Rückgabewerte ===
 
=== Rückgabewerte ===
 
Keine.
 
Keine.
 +
== Beispiele ==
 +
Vergrößert den Zeilenabstand wenn die + oder - Taste gedrückt wird.
 +
<source lang="lua">
 +
local font
 +
function love.load()
 +
    font = love.graphics.newFont()
 +
end
 +
 +
function love.draw()
 +
    love.graphics.setFont(font)
 +
    love.graphics.print("Line Height: " .. font:getLineHeight(), 20, 20)
 +
    love.graphics.print("Line One\nLine Two\nLine Three", 20, 40)
 +
end
 +
 +
function love.keypressed(key)
 +
    if key == '+' then
 +
        font:setLineHeight(font:getLineHeight() + 0.1)
 +
    elseif key == '-' then
 +
        font:setLineHeight(font:getLineHeight() - 0.1)
 +
    end
 +
end
 +
</source>
 
== Siehe auch ==
 
== Siehe auch ==
 
* [[parent::Font (Deutsch)|Font]]
 
* [[parent::Font (Deutsch)|Font]]

Latest revision as of 07:55, 19 March 2015

Bestimmt die Zeilenhöhe des Font.

Wenn der Font gerendert wird, wird die tatsächliche Höhe von der Zeilenhöhe multipliziert mit der Höhe des Font bestimmt.

Der Standardwert für die Zeilenhöhe ist 1.0.

Funktion

Übersicht

Font:setLineHeight( height )

Argumente

number (Deutsch) height
Die neue Zeilenhöhe.

Rückgabewerte

Keine.

Beispiele

Vergrößert den Zeilenabstand wenn die + oder - Taste gedrückt wird.

local font
function love.load()
    font = love.graphics.newFont()
end

function love.draw()
    love.graphics.setFont(font)
    love.graphics.print("Line Height: " .. font:getLineHeight(), 20, 20)
    love.graphics.print("Line One\nLine Two\nLine Three", 20, 40)
end

function love.keypressed(key)
    if key == '+' then
        font:setLineHeight(font:getLineHeight() + 0.1)
    elseif key == '-' then
        font:setLineHeight(font:getLineHeight() - 0.1)
    end
end

Siehe auch


Andere Sprachen