]> gitweb.factorcode.org Git - factor.git/commitdiff
core-text: fix height to round out to a screen pixel.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 16 Dec 2021 21:03:27 +0000 (13:03 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 16 Dec 2021 21:03:27 +0000 (13:03 -0800)
basis/core-text/core-text.factor

index 47112623ce203fe1fe5946b8828449411f82a621..4637ae1c6d3ac40e7c07740e7314f7ba5e439ccd 100644 (file)
@@ -4,9 +4,9 @@ USING: accessors alien.c-types alien.data alien.syntax arrays
 assocs cache classes colors combinators core-foundation
 core-foundation.attributed-strings core-foundation.strings
 core-graphics core-graphics.types core-text.fonts destructors
-fonts init kernel locals make math math.functions math.order
-math.vectors memoize namespaces sequences strings
-io.encodings.utf16n io.encodings.string ;
+fonts init io.encodings.string io.encodings.utf16n kernel make
+math math.functions math.order math.vectors namespaces opengl
+sequences strings ;
 IN: core-text
 
 TYPEDEF: void* CTLineRef
@@ -77,7 +77,8 @@ render-loc render-dim ;
     compute-height ;
 
 : metrics>dim ( bounds -- dim )
-    [ width>> ] [ [ ascent>> ] [ descent>> ] bi + ] bi 2array ;
+    [ width>> ] [ [ ascent>> ] [ descent>> ] bi + ] bi
+    gl-scale ceiling >integer gl-unscale 2array ;
 
 : fill-background ( context font dim -- )
     [ background>> >rgba-components CGContextSetRGBFillColor ]