Creates a new [[Font]] by loading a [[ImageFontFormat|specifically formatted]] image.

In versions prior to [[0.9.0]], LÖVE expects ISO 8859-1 encoding for the glyphs string.

{{newobjectnotice (日本語)}}
== 関数 ==
=== 概要 ===
<source lang="lua">
font = love.graphics.newImageFont( filename, glyphs )
</source>
=== 引数 ===
{{param (日本語)|string|filename|The filepath to the image file.}}
{{param (日本語)|string|glyphs|A string of the characters in the image in order from left to right.}}
=== 返値 ===
{{param (日本語)|Font|font|A Font object which can be used to draw text on screen.}}

== 関数 ==
=== 概要 ===
<source lang="lua">
font = love.graphics.newImageFont( imagedata, glyphs )
</source>
=== 引数 ===
{{param (日本語)|ImageData|imageData|The ImageData object to create the font from.}}
{{param (日本語)|string|glyphs|A string of the characters in the image in order from left to right.}}
=== 返値 ===
{{param (日本語)|Font|font|A Font object which can be used to draw text on screen.}}

== 関数 ==
{{newin (日本語)|[[0.10.0 (日本語)|0.10.0]]|100|type=異形}}
=== 概要 ===
<source lang="lua">
font = love.graphics.newImageFont( filename, glyphs, extraspacing )
</source>
=== 引数 ===
{{param (日本語)|string|filename|The filepath to the image file.}}
{{param (日本語)|string|glyphs|A string of the characters in the image in order from left to right.}}
{{param (日本語)|number|extraspacing|Additional spacing (positive or negative) to apply to each glyph in the Font.}}
=== 返値 ===
{{param (日本語)|Font|font|A Font object which can be used to draw text on screen.}}

== 注釈 ==
Instead of using this function, consider using a BMFont generator such as [http://www.angelcode.com/products/bmfont/ bmfont], [http://kvazars.com/littera/ littera], or [https://www.bmglyph.com/ bmGlyph] with [[love.graphics.newFont]]. Because slime said it was better.

== 用例 ==
Creating a simple image font. Download this [[:File:font_example.png|image file]] which will be used by LÖVE to create the font. Obviously when you want to create a font for your game you want to make the background transparent.
<source lang="lua">
local font = love.graphics.newImageFont( 'font_example.png', ' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' )
function love.draw()
    love.graphics.setFont( font )
    love.graphics.print( 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 16, 16 )
    love.graphics.print( 'Text is now drawn using the font', 16, 32 )
end
</source>

== 関連 ==
* [[parent::love.graphics (日本語)]]
* [[Constructs::Font (日本語)]]
* [[ImageFontFormat (日本語)|Image Font Format]]
[[Category:Functions (日本語)]]
[[Sub-Category::Object Creation (日本語)| ]]
{{#set:Description=Creates a new [[Font]] by loading a specifically formatted image.}}
{{#set:Since=020}}
{{#set:PrettySince=0.2.0}}
== そのほかの言語 ==
{{i18n (日本語)|love.graphics.newImageFont}}