Mercurial > repos > tabletprog
comparison modules/freetype.tp @ 328:c1fad3d93861
Add getKerning to freetype module and use it in sample
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 25 Mar 2015 00:16:37 -0700 |
parents | 50760ba52b11 |
children |
comparison
equal
deleted
inserted
replaced
327:860075fdc2d3 | 328:c1fad3d93861 |
---|---|
230 u16ret <- make_object: (addr_of: obj_uint16_meta) NULL 0 | 230 u16ret <- make_object: (addr_of: obj_uint16_meta) NULL 0 |
231 u16ret num!: (face units_per_EM) | 231 u16ret num!: (face units_per_EM) |
232 u16ret | 232 u16ret |
233 } | 233 } |
234 | 234 |
235 llMessage: hasKerning? withVars: { | |
236 ret <- object ptr | |
237 } andCode: { | |
238 if: (FT_HAS_KERNING: face) { | |
239 true | |
240 } else { | |
241 false | |
242 } | |
243 } | |
244 | |
245 llMessage: getKerning:mode withVars: { | |
246 oleft <- object ptr | |
247 oright <- object ptr | |
248 omode <- object ptr | |
249 left <- obj_uint32 ptr | |
250 right <- obj_uint32 ptr | |
251 mode <- obj_uint32 ptr | |
252 x <- obj_int32 ptr | |
253 y <- obj_int32 ptr | |
254 ret <- object ptr | |
255 kernVec <- FT_Vector | |
256 err <- int | |
257 } andCode: :oleft oright :omode { | |
258 left <- (mcall: uint32 1 oleft) castTo: (obj_uint32 ptr) | |
259 right <- (mcall: uint32 1 oright) castTo: (obj_uint32 ptr) | |
260 mode <- (mcall: uint32 1 omode) castTo: (obj_uint32 ptr) | |
261 err <- FT_Get_Kerning: face (left num) (right num) (mode num) (addr_of: kernVec) | |
262 if: err != 0 { | |
263 mcall: none 1 option | |
264 } else: { | |
265 x <- make_object: (addr_of: obj_int32_meta) NULL 0 | |
266 y <- make_object: (addr_of: obj_int32_meta) NULL 0 | |
267 x num!: ((addr_of: kernVec) x) | |
268 y num!: ((addr_of: kernVec) y) | |
269 ret <- mcall: x:y 3 vec x y | |
270 mcall: value 2 option ret | |
271 } | |
272 } | |
273 | |
235 firstChar <- { | 274 firstChar <- { |
236 _helper getFirstChar: faceOpaque _makeChar | 275 _helper getFirstChar: faceOpaque _makeChar |
237 } | 276 } |
238 | 277 |
239 nextChar <- :curChar { | 278 nextChar <- :curChar { |
278 _constant: linearDesign FT_LOAD_LINEAR_DESIGN | 317 _constant: linearDesign FT_LOAD_LINEAR_DESIGN |
279 _constant: noAutohint FT_LOAD_NO_AUTOHINT | 318 _constant: noAutohint FT_LOAD_NO_AUTOHINT |
280 _constant: color FT_LOAD_COLOR | 319 _constant: color FT_LOAD_COLOR |
281 } | 320 } |
282 | 321 |
322 _kerning <- #{ | |
323 _constant: default FT_KERNING_DEFAULT | |
324 _constant: unfitted FT_KERNING_UNFITTED | |
325 _constant: unscaled FT_KERNING_UNSCALED | |
326 } | |
327 | |
283 #{ | 328 #{ |
284 init <- { | 329 init <- { |
285 | 330 |
286 #{ | 331 #{ |
287 includeSystemHeader: "ft2build.h" | 332 includeSystemHeader: "ft2build.h" |
317 } | 362 } |
318 } _init | 363 } _init |
319 } | 364 } |
320 | 365 |
321 loadFlags <- { _loadFlags } | 366 loadFlags <- { _loadFlags } |
367 kerning <- { _kerning } | |
322 } | 368 } |
323 } | 369 } |