|
|
@ -31,7 +31,18 @@ |
|
|
|
x int y int str (* (const char))) |
|
|
|
(var write-x int x) |
|
|
|
(var write-y int y) |
|
|
|
(var tab-width int 100) |
|
|
|
(var line-height int 100) |
|
|
|
(each-char-in-string-const str current-char |
|
|
|
(cond |
|
|
|
((= (deref current-char) '\n') |
|
|
|
(set write-y (+ line-height write-y)) |
|
|
|
(set write-x x) |
|
|
|
(continue)) |
|
|
|
((= (deref current-char) '\t') |
|
|
|
(set write-x (+ write-x tab-width)) |
|
|
|
(continue))) |
|
|
|
|
|
|
|
(var search-key char (deref current-char)) |
|
|
|
(var glyph (* glyph-entry) (dict-ptr-at (path font > glyph-lookup-table) search-key)) |
|
|
|
(unless glyph ;; fallback |
|
|
@ -74,8 +85,10 @@ |
|
|
|
(defer (SDL_DestroyRenderer renderer)) |
|
|
|
|
|
|
|
(var ubuntu-regular-font-atlas font-atlas (array 0)) |
|
|
|
(var font-size-points (unsigned char) 12) |
|
|
|
(unless (= 0 (build-font-atlas s-start-ubuntu-regular-font |
|
|
|
(- s-end-ubuntu-regular-font s-start-ubuntu-regular-font) |
|
|
|
font-size-points |
|
|
|
(addr ubuntu-regular-font-atlas))) |
|
|
|
(return 1)) |
|
|
|
(defer (free-font-atlas (addr ubuntu-regular-font-atlas))) |
|
|
@ -127,8 +140,17 @@ |
|
|
|
(sdl-print-error) |
|
|
|
(set exit-reason "SDL failed to render font atlas"))) |
|
|
|
|
|
|
|
(render-string renderer (addr ubuntu-regular-font-atlas) ubuntu-regular-texture |
|
|
|
200 600 "This is a test!") |
|
|
|
(render-string |
|
|
|
renderer (addr ubuntu-regular-font-atlas) ubuntu-regular-texture |
|
|
|
200 600 |
|
|
|
#"#result= FT_Set_Char_Size(typeface, 0, (16 * 64), 300, 300); |
|
|
|
if (!((result== FT_Err_Ok))) |
|
|
|
{ |
|
|
|
fprintf(stderr, "error: encountered error %d while %s\n", result, "setting character size"); |
|
|
|
FT_Done_Face(typeface); |
|
|
|
FT_Done_FreeType(freetypeLibrary); |
|
|
|
return 1; |
|
|
|
}#"#) |
|
|
|
|
|
|
|
(SDL_RenderPresent renderer) |
|
|
|
(SDL_UpdateWindowSurface window) |
|
|
|