annotate samples/freetype.tp @ 338:1458c069c715

Added "value" method to option value and option none. It behaves similarly to value:none, except the none case just propagates the none value and the value case wraps the result in an option value
author Michael Pavone <pavone@retrodev.com>
date Sat, 04 Apr 2015 11:54:46 -0700
parents 577406b25f89
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 import: [
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 video
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 timer
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 ] from: (sdl subsystems)
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 import: [
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 quit
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 ] from: (sdl eventTypes)
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 import: [
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 streaming
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 ] from: (sdl textureAccess)
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 import: [
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 bgra8888
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 ] from: (sdl pixelFormats)
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
19 import: [
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
20 render
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
21 linearDesign
330
e70f9d3f19f8 Turn off hinting in freetype sample as hinting does not play nice with using font units for layout
Michael Pavone <pavone@retrodev.com>
parents: 328
diff changeset
22 noHinting
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
23 ] from: (freetype loadFlags)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
24
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
25 makeAtlas <- :renderer face fontSize dpi color {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
26 face setCharSize: fontSize res: dpi
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
27 slot <- face glyphSlot
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
28
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
29 glyphs <- #[]
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
30 //TODO: Use a bytearray once that has an append method
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
31 pixels <- #[]
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
32 foreach: (face charmap) :char glyphIdx {
330
e70f9d3f19f8 Turn off hinting in freetype sample as hinting does not play nice with using font units for layout
Michael Pavone <pavone@retrodev.com>
parents: 328
diff changeset
33 face loadGlyph: glyphIdx flags: (render or linearDesign or noHinting)
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
34 pixelStart <- pixels length
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
35 _width <- slot bitmapWidth
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
36 _height <- slot bitmapRows
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
37 pitch <- slot bitmapPitch
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
38 buffer <- slot bitmapData
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
39
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
40 y <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
41 while: { y < _height } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
42 x <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
43 idx <- y * pitch
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
44 while: { x < _width } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
45 pixels append: (buffer get: idx)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
46
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
47 x <- x + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
48 idx <- idx + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
49 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
50 y <- y + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
51 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
52
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
53 glyphs append: #{
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
54 width <- _width
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
55 height <- _height
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
56 pixelOffset <- pixelStart
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
57 hAdvance <- slot linearHoriAdvance
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
58 vAdvance <- slot linearVertAdvance
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
59 leftOffset <- (slot bitmapLeft)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
60 topOffset <- (slot bitmapTop)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
61 charCode <- char
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
62 glyphIndex <- glyphIdx
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
63
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
64 atlasX <- -1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
65 atlasY <- -1
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
66 atlasRect <- {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
67 sdl rect: atlasX atlasY size: width height
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
68 }
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
69 destRect <- :x y {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
70 sdl rect: x + leftOffset y - topOffset size: width height
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
71 }
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
72
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
73 <= <- :other {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
74 if: height > (other height) {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
75 true
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
76 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
77 if: height < (other height) {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
78 false
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
79 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
80 width >= (other width)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
81 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
82 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
83 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
84 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
85 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
86 glyphs sort
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
87 maxDim <- 2048
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
88 aWidth <- 128
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
89 minSize <- maxDim * maxDim
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
90 minSizeWidth <- -1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
91 aHeight <- maxDim
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
92
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
93 while: { aWidth <= maxDim } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
94 print: "Checking width: " . aWidth . "\n"
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
95 curX <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
96 curY <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
97 minHeight <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
98 avail <- glyphs foldr: [] with: :acc val {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
99 val | acc
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
100 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
101 while: { (not: (avail empty?)) && curY <= maxDim } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
102 curGlyph <- avail value
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
103 if: curX + (curGlyph width) < aWidth {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
104 if: curY + (curGlyph height) < maxDim {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
105 curX <- curX + (curGlyph width)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
106 avail <- avail tail
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
107 if: (curGlyph height) > minHeight {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
108 minHeight <- curGlyph height
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
109 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
110 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
111 curY <- maxDim + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
112 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
113 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
114 skinny <- option none
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
115 if: aWidth > curX {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
116 availPixels <- aWidth - curX
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
117
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
118 skinny <- avail find: :val {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
119 (val width) <= availPixels
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
120 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
121 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
122
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
123 skinny value: :curGlyph {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
124 curX <- curX + (curGlyph width)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
125 if: (curGlyph height) > minHeight {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
126 minHeight <- curGlyph height
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
127 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
128 avail <- avail filter: :glyph {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
129 (glyph charCode) != (curGlyph charCode)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
130 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
131 } none: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
132 curY <- curY + minHeight
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
133 minHeight <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
134 curX <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
135 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
136 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
137 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
138 if: (avail empty?) {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
139 aHeight <- curY + minHeight
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
140 p2Height <- 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
141 while: { p2Height < aHeight } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
142 p2Height <- lshift: p2Height by: 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
143 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
144
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
145 size <- aWidth * p2Height
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
146 if: size < minSize {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
147 minSize <- size
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
148 minSizeWidth <- aWidth
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
149 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
150 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
151 aWidth <- aWidth * 2
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
152 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
153 if: minSizeWidth > -1 {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
154 print: "Best width: " . minSizeWidth . ", height: " . (minSize / minSizeWidth) . "\n"
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
155 aWidth <- minSizeWidth
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
156 aHeight <- minSize / minSizeWidth
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
157
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
158 (renderer createTexture: bgra8888 access: streaming width: aWidth height: aHeight) value: :drawTex {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
159 drawTex blendMode!: ((sdl blendModes) blend)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
160 //TODO: Use "update" with a static texture
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
161 drawTex lockRect: (sdl rect: 0 0 size: aWidth aHeight) with: :bytearr pitch {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
162 n <- aHeight * pitch
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
163 i <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
164 while: { i < n } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
165 bytearr set: i 0u8
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
166 i <- i + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
167 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
168 curX <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
169 curY <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
170 minHeight <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
171 avail <- glyphs foldr: [] with: :acc val {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
172 val | acc
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
173 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
174 while: { not: (avail empty?) } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
175 curGlyph <- avail value
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
176 if: curX + (curGlyph width) < aWidth {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
177 curGlyph atlasX!: curX
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
178 curGlyph atlasY!: curY
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
179 y <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
180 dstY <- curY
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
181 idx <- curGlyph pixelOffset
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
182 while: { y < (curGlyph height) } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
183 dstIdx <- dstY * pitch + curX * 4
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
184 x <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
185 while: { x < (curGlyph width) } do: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
186 //FIXME: This will probably only work on little endian machines
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
187 bytearr set: dstIdx (pixels get: idx)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
188 dstIdx <- dstIdx + 1
333
577406b25f89 Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
Michael Pavone <pavone@retrodev.com>
parents: 330
diff changeset
189 bytearr set: dstIdx 255u8 //(color r)
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
190 dstIdx <- dstIdx + 1
333
577406b25f89 Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
Michael Pavone <pavone@retrodev.com>
parents: 330
diff changeset
191 bytearr set: dstIdx 255u8 (color g)
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
192 dstIdx <- dstIdx + 1
333
577406b25f89 Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
Michael Pavone <pavone@retrodev.com>
parents: 330
diff changeset
193 bytearr set: dstIdx 255u8 (color b)
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
194 dstIdx <- dstIdx + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
195
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
196 idx <- idx + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
197 x <- x + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
198 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
199 y <- y + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
200 dstY <- dstY + 1
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
201 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
202
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
203 curX <- curX + (curGlyph width)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
204 avail <- avail tail
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
205 if: (curGlyph height) > minHeight {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
206 minHeight <- curGlyph height
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
207 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
208 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
209 skinny <- option none
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
210 if: aWidth > curX {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
211 availPixels <- aWidth - curX
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
212 skinny <- avail find: :val {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
213 (val width) <= availPixels
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
214 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
215 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
216
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
217 skinny value: :curGlyph {
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
218 curGlyph atlasX!: curX
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
219 curGlyph atlasY!: curY
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
220 y <- 0
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
221 dstY <- curY
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
222 idx <- curGlyph pixelOffset
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
223 while: { y < (curGlyph height) } do: {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
224 dstIdx <- dstY * pitch + curX * 4
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
225 x <- 0
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
226 while: { x < (curGlyph width) } do: {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
227 //FIXME: This will probably only work on little endian machines
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
228 bytearr set: dstIdx (pixels get: idx)
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
229 dstIdx <- dstIdx + 1
333
577406b25f89 Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
Michael Pavone <pavone@retrodev.com>
parents: 330
diff changeset
230 bytearr set: dstIdx 255u8 //(color r)
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
231 dstIdx <- dstIdx + 1
333
577406b25f89 Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
Michael Pavone <pavone@retrodev.com>
parents: 330
diff changeset
232 bytearr set: dstIdx 255u8 (color g)
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
233 dstIdx <- dstIdx + 1
333
577406b25f89 Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
Michael Pavone <pavone@retrodev.com>
parents: 330
diff changeset
234 bytearr set: dstIdx 255u8 (color b)
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
235 dstIdx <- dstIdx + 1
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
236
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
237 idx <- idx + 1
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
238 x <- x + 1
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
239 }
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
240 y <- y + 1
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
241 dstY <- dstY + 1
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
242 }
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
243
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
244 curX <- curX + (curGlyph width)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
245 if: (curGlyph height) > minHeight {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
246 minHeight <- curGlyph height
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
247 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
248 avail <- avail filter: :glyph {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
249 (glyph charCode) != (curGlyph charCode)
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
250 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
251 } none: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
252 curY <- curY + minHeight
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
253 minHeight <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
254 curX <- 0
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
255 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
256 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
257 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
258 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
259 glyphDict <- dict hash
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
260 foreach: glyphs :idx glyph {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
261 glyphDict set: (glyph charCode) glyph
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
262 }
333
577406b25f89 Added binding for SDL_SetTextureColorMod and SDL_GetTextureColorMod and updated the Freetype sample to use it for setting the color of text
Michael Pavone <pavone@retrodev.com>
parents: 330
diff changeset
263 drawTex colorMod!: color
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
264 _pixelFactor <- ((face unitsPerEm) f64) * 72.0 / (fontSize * (dpi f64))
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
265 option value: #{
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
266 texture <- drawTex
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
267 width <- aWidth
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
268 height <- aHeight
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
269 glyphs <- glyphDict
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
270 drawString:at:useKerning? <- :str :xPos yPos :kern? {
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
271 //pixels to font units
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
272 designPosition <- (xPos f64) * _pixelFactor
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
273 charIdx <- 0
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
274 last <- 0u32
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
275 useKerning? <- kern? && (face hasKerning?)
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
276
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
277 while: { charIdx < (str byte_length) } do: {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
278 //TODO: UTF-8
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
279 char <- (str byte: charIdx) uint32
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
280 glyph <- glyphs get: char else: {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
281 glyphs get: 0u32 else: { false }
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
282 }
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
283 texture copyRect: (glyph atlasRect) To: (glyph destRect: xPos yPos)
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
284
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
285 designPosition <- designPosition + ((glyph hAdvance) f64)
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
286 if: charIdx > 0 && useKerning? {
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
287 (face getKerning: last (glyph glyphIndex) mode: ((freetype kerning) unscaled)) value: :kern {
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
288 designPosition <- designPosition + ((kern x) f64)
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
289 } none: {}
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
290 }
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
291 xPos <- (designPosition / _pixelFactor + 0.5) truncInt32
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
292
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
293 last <- glyph glyphIndex
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
294 charIdx <- charIdx + 1
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
295 }
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
296 }
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
297 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
298 } none: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
299 print: "Failed to create texture for atlas"
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
300 option none
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
301 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
302 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
303 print: "Font is too big for a 2048x2048 texture!"
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
304 option none
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
305 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
306 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
307
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
308 hex2 <- :num {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
309 val <- hex: num
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
310 if: (val length) < 2 {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
311 val <- "0" . val
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
312 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
313 val
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
314 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
315
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
316 main <- :args {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
317 retcode <- 0
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
318 dpi <- 96
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
319 arg <- 1
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
320 expectVal <- false
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
321 optName <- ""
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
322 windowWidth <- 512
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
323 windowHeight <- 512
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
324 posArgs <- #[]
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
325 while: { arg < (args length) } do: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
326 curArg <- args get: arg
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
327 if: expectVal {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
328 if: optName = "--dpi" || optName = "-d" {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
329 dpi <- curArg int32
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
330 } else: {
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
331 if: optName = "--height" {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
332 windowHeight <- curArg int32
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
333 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
334 if: optName = "--width" {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
335 windowWidth <- curArg int32
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
336 } else: {
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
337 print: "Unrecognized option: " . optName . "\n"
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
338 }
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
339 }
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
340 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
341 expectVal <- false
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
342 } else: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
343 if: (curArg startsWith?: "-") {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
344 expectVal <- true
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
345 optName <- curArg
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
346 } else: {
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
347 posArgs append: curArg
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
348 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
349 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
350 arg <- arg + 1
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
351 }
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
352 path <- posArgs get: 0
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
353 str <- if: (posArgs length) > 1 { posArgs get: 1 } else: { "" }
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
354 ft <- freetype init
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
355 maybeFace <- ft faceFromPath: path index: 0
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
356 charCodes <- #[]
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
357 maybeFace value: :face {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
358 charMap <- face charmap
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
359 foreach: charMap :char glyph {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
360 print: "Char: " . char . ", glyph index: " . glyph . "\n"
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
361 charCodes append: char
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
362 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
363
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
364 if: (sdl init: (video or timer)) = 0 {
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
365 (sdl createWindow: "Freetype Test" pos: 0 0 size: windowWidth windowHeight flags: 0u32) value: :window {
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
366 (window createRenderer: -1 flags: ((window renderOpts) accelerated)) value: :renderer {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
367 renderer drawColor!: (sdl r: 255u8 g: 255u8 b: 255u8)
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
368
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
369 (makeAtlas: renderer face 12.0 dpi (sdl r: 0u8 g: 0u8 b: 0u8)) value: :atlas {
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
370 continue? <- true
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
371 while: { continue? } do: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
372 renderer clear
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
373 if: (str length) > 0 {
328
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
374 atlas drawString: str at: 0 windowHeight / 3 useKerning?: true
c1fad3d93861 Add getKerning to freetype module and use it in sample
Michael Pavone <pavone@retrodev.com>
parents: 326
diff changeset
375 atlas drawString: str at: 0 windowHeight * 2 / 3 useKerning?: false
326
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
376 } else: {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
377 y <- 0
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
378 x <- 0
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
379 while: { y < (atlas height) } do: {
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
380 copyWidth <- if: (atlas width) < windowWidth { atlas width } else: { windowWidth }
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
381 copyHeight <- if: (atlas height) < windowHeight { atlas height } else: { windowHeight }
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
382 (atlas texture) copyRect: (sdl rect: 0 y size: copyWidth copyHeight) To: (sdl rect: x 0 size: copyWidth copyHeight)
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
383 y <- y + windowHeight
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
384 x <- x + copyWidth
50760ba52b11 Added basic rendering of strings to freetype demo
Michael Pavone <pavone@retrodev.com>
parents: 324
diff changeset
385 }
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
386 }
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
387 renderer present
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
388 event <- option none
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
389 while: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
390 event <- sdl pollEvent
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
391 event value?
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
392 } do: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
393 event value: :ev {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
394 if: (ev type) = quit {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
395 continue? <- false
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
396 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
397 } none: {}
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
398 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
399 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
400 } none: {
324
615f23450f8f Freetype sample: Build texture of glyphs in a more intelligent way
Michael Pavone <pavone@retrodev.com>
parents: 321
diff changeset
401 retcode <- -1
321
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
402 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
403 } none: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
404 print: "Failed to create renderer\n"
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
405 retcode <- 1
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
406 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
407 window destroy
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
408 } none: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
409 print: "Failed to create window\n"
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
410 retcode <- 1
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
411 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
412 } else: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
413 print: "Failed to initialize SDL\n"
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
414 retcode <- 1
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
415 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
416 } none: {
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
417 retcode <- 1
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
418 print: "Failed to load font face from " . path . "\n"
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
419 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
420
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
421 ft destroy
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
422 retcode
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
423 }
3edd0169311a Add basic binding to Freetype2
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
424 }