summaryrefslogtreecommitdiff
path: root/meta/3rd/love2d/library/love.font.lua
blob: 7ec34ef3641a5259766e306cb91e72a3b0c39ec3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---@meta

---@class love.font
love.font = {}

---
---Creates a new BMFont Rasterizer.
---
---@param imageData love.ImageData # The image data containing the drawable pictures of font glyphs.
---@param glyphs string # The sequence of glyphs in the ImageData.
---@param dpiscale number # DPI scale.
---@return love.Rasterizer rasterizer # The rasterizer.
function love.font.newBMFontRasterizer(imageData, glyphs, dpiscale) end

---
---Creates a new GlyphData.
---
---@param rasterizer love.Rasterizer # The Rasterizer containing the font.
---@param glyph number # The character code of the glyph.
function love.font.newGlyphData(rasterizer, glyph) end

---
---Creates a new Image Rasterizer.
---
---@param imageData love.ImageData # Font image data.
---@param glyphs string # String containing font glyphs.
---@param extraSpacing number # Font extra spacing.
---@param dpiscale number # Font DPI scale.
---@return love.Rasterizer rasterizer # The rasterizer.
function love.font.newImageRasterizer(imageData, glyphs, extraSpacing, dpiscale) end

---
---Creates a new Rasterizer.
---
---@param filename string # The font file.
---@return love.Rasterizer rasterizer # The rasterizer.
function love.font.newRasterizer(filename) end

---
---Creates a new TrueType Rasterizer.
---
---@param size number # The font size.
---@param hinting love.HintingMode # True Type hinting mode.
---@param dpiscale number # The font DPI scale.
---@return love.Rasterizer rasterizer # The rasterizer.
function love.font.newTrueTypeRasterizer(size, hinting, dpiscale) end

---@class love.GlyphData: love.Data, love.Object
local GlyphData = {}

---
---Gets glyph advance.
---
---@return number advance # Glyph advance.
function GlyphData:getAdvance() end

---
---Gets glyph bearing.
---
---@return number bx # Glyph bearing X.
---@return number by # Glyph bearing Y.
function GlyphData:getBearing() end

---
---Gets glyph bounding box.
---
---@return number width # Glyph width.
---@return number height # Glyph height.
function GlyphData:getBoundingBox() end

---
---Gets glyph dimensions.
---
---@return number width # Glyph width.
---@return number height # Glyph height.
function GlyphData:getDimensions() end

---
---Gets glyph pixel format.
---
---@return love.PixelFormat format # Glyph pixel format.
function GlyphData:getFormat() end

---
---Gets glyph number.
---
---@return number glyph # Glyph number.
function GlyphData:getGlyph() end

---
---Gets glyph string.
---
---@return string glyph # Glyph string.
function GlyphData:getGlyphString() end

---
---Gets glyph height.
---
---@return number height # Glyph height.
function GlyphData:getHeight() end

---
---Gets glyph width.
---
---@return number width # Glyph width.
function GlyphData:getWidth() end

---@class love.Rasterizer: love.Object
local Rasterizer = {}

---
---Gets font advance.
---
---@return number advance # Font advance.
function Rasterizer:getAdvance() end

---
---Gets ascent height.
---
---@return number height # Ascent height.
function Rasterizer:getAscent() end

---
---Gets descent height.
---
---@return number height # Descent height.
function Rasterizer:getDescent() end

---
---Gets number of glyphs in font.
---
---@return number count # Glyphs count.
function Rasterizer:getGlyphCount() end

---
---Gets glyph data of a specified glyph.
---
---@param glyph string # Glyph
---@return love.GlyphData glyphData # Glyph data
function Rasterizer:getGlyphData(glyph) end

---
---Gets font height.
---
---@return number height # Font height
function Rasterizer:getHeight() end

---
---Gets line height of a font.
---
---@return number height # Line height of a font.
function Rasterizer:getLineHeight() end

---
---Checks if font contains specified glyphs.
---
---@param glyph1 love.string or number # Glyph
---@param glyph2 love.string or number # Glyph
---@return boolean hasGlyphs # Whatever font contains specified glyphs.
function Rasterizer:hasGlyphs(glyph1, glyph2) end

---@class love.HintingMode
---@field normal integer # Default hinting. Should be preferred for typical antialiased fonts.
---@field light integer # Results in fuzzier text but can sometimes preserve the original glyph shapes of the text better than normal hinting.
---@field mono integer # Results in aliased / unsmoothed text with either full opacity or completely transparent pixels. Should be used when antialiasing is not desired for the font.
---@field none integer # Disables hinting for the font. Results in fuzzier text.