@@ -6,9 +6,9 @@ iter_or_array(x::StaticArray) = repeated(x)
6
6
7
7
8
8
function metrics_bb (char:: Char , font:: FTFont , pixel_size)
9
- extent = get_extent (font, char) .* Vec2f0 (pixel_size)
9
+ extent = get_extent (font, char) .* Vec2f (pixel_size)
10
10
mini = bearing (extent)
11
- return Rect2D (mini, Vec2f0 (extent. scale)), extent
11
+ return Rect2 (mini, Vec2f (extent. scale)), extent
12
12
end
13
13
14
14
function boundingbox (char:: Char , font:: FTFont , pixel_size)
@@ -28,7 +28,7 @@ Newlines will be drawn like any other character.
28
28
`fonts` can be a vector of fonts, or a single font.
29
29
`scales` can be a single float or a Vec2, or a vector of any of those.
30
30
31
- `f` will get called with `(char::Char, glyph_box::Rec2D, glyph_advance::Point2f0 )`.
31
+ `f` will get called with `(char::Char, glyph_box::Rec2D, glyph_advance::Point2f )`.
32
32
33
33
`char` is the currently iterated char.
34
34
@@ -43,16 +43,16 @@ function iterate_extents(f, line::AbstractString, fonts, scales)
43
43
lastpos = 0.0
44
44
for (char, scale, font) in iterator
45
45
glyph_box, extent = metrics_bb (char, font, scale)
46
- mini = minimum (glyph_box) .+ Vec2f0 (lastpos, 0.0 )
47
- glyph_box = Rect2D (mini, widths (glyph_box))
48
- glyph_advance = Point2f0 (extent. advance)
46
+ mini = minimum (glyph_box) .+ Vec2f (lastpos, 0.0 )
47
+ glyph_box = Rect2 (mini, widths (glyph_box))
48
+ glyph_advance = Point2f (extent. advance)
49
49
lastpos += glyph_advance[1 ]
50
50
f (char, glyph_box, glyph_advance)
51
51
end
52
52
end
53
53
54
54
function glyph_rects (line:: AbstractString , fonts, scales)
55
- rects = Rect2D []
55
+ rects = Rect2 []
56
56
iterate_extents (line, fonts, scales) do char, box, advance
57
57
push! (rects, box)
58
58
end
@@ -68,13 +68,13 @@ function inkboundingbox(ext::FontExtent)
68
68
r = rightinkbound (ext)
69
69
b = bottominkbound (ext)
70
70
t = topinkbound (ext)
71
- return FRect2D ((l, b), (r - l, t - b))
71
+ return Rect2f ((l, b), (r - l, t - b))
72
72
end
73
73
74
74
function height_insensitive_boundingbox (ext:: FontExtent , font:: FTFont )
75
75
l = leftinkbound (ext)
76
76
r = rightinkbound (ext)
77
77
b = descender (font)
78
78
t = ascender (font)
79
- return FRect2D ((l, b), (r - l, t - b))
79
+ return Rect2f ((l, b), (r - l, t - b))
80
80
end
0 commit comments