fractional pixels should be rounded off

cvs
Slava Pestov 2005-10-23 20:21:30 +00:00
parent 0e2a00fca7
commit 13b45b0fb1
1 changed files with 5 additions and 5 deletions

View File

@ -83,10 +83,10 @@ TUPLE: font ascent descent height handle sprites ;
: dpi 72 ; : dpi 72 ;
: fix>float 64 /f ; : fix>int 64 /i ;
: font-units>pixels ( n font -- n ) : font-units>pixels ( n font -- n )
face-size face-size-y-scale FT_MulFix fix>float ; face-size face-size-y-scale FT_MulFix fix>int ;
: init-ascent ( font face -- ) : init-ascent ( font face -- )
dup face-y-max swap font-units>pixels swap set-font-ascent ; dup face-y-max swap font-units>pixels swap set-font-ascent ;
@ -115,8 +115,8 @@ C: font ( handle -- font )
freetype-error face-glyph ; freetype-error face-glyph ;
: glyph-size ( glyph -- dim ) : glyph-size ( glyph -- dim )
dup glyph-advance-x fix>float dup glyph-advance-x fix>int
swap glyph-height fix>float 0 3array ; swap glyph-height fix>int 0 3array ;
: render-glyph ( font char -- bitmap ) : render-glyph ( font char -- bitmap )
#! Render a character and return a pointer to the bitmap. #! Render a character and return a pointer to the bitmap.
@ -157,7 +157,7 @@ C: font ( handle -- font )
] with-locked-block ; ] with-locked-block ;
: glyph-texture-loc ( glyph font -- loc ) : glyph-texture-loc ( glyph font -- loc )
font-ascent swap glyph-hori-bearing-y fix>float - font-ascent swap glyph-hori-bearing-y fix>int -
0 swap 0 3array ; 0 swap 0 3array ;
: glyph-texture-size ( glyph -- dim ) : glyph-texture-size ( glyph -- dim )