aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prototypes/xgb-xrender.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/prototypes/xgb-xrender.go b/prototypes/xgb-xrender.go
index ea20624..75bf62e 100644
--- a/prototypes/xgb-xrender.go
+++ b/prototypes/xgb-xrender.go
@@ -226,7 +226,7 @@ func main() {
// LCD subpixel rendering isn't supported. :(
opts := &truetype.Options{
- Size: 9,
+ Size: 10,
DPI: 96, // TODO: Take this from the screen or monitor.
Hinting: font.HintingFull,
}
@@ -234,10 +234,12 @@ func main() {
bounds := f.Bounds(fixed.Int26_6(opts.Size * float64(opts.DPI) *
(64.0 / 72.0)))
- var alphaFormat render.Pictformat
+ var rgbFormat render.Pictformat
for _, pf := range pformats.Formats {
- if pf.Depth == 8 && pf.Direct.AlphaMask == 0xff {
- alphaFormat = pf.Id
+ // Hopefully. Might want to check byte order.
+ if pf.Depth == 32 && pf.Direct.AlphaMask != 0 {
+ rgbFormat = pf.Id
+ break
}
}
@@ -248,11 +250,12 @@ func main() {
// NOTE: A depth of 24 will not work, the server always rejects it.
// Composite alpha doesn't make sense since golang/freetype can't use it.
- _ = render.CreateGlyphSet(X, gsid, alphaFormat)
+ // We use RGBA here just so that lines are padded to 32 bits.
+ _ = render.CreateGlyphSet(X, gsid, rgbFormat)
// NOTE: We could do gamma post-correction in higher precision if we
// implemented our own clone of the image.Image implementation.
- nrgb := image.NewGray(image.Rect(
+ nrgb := image.NewRGBA(image.Rect(
+bounds.Min.X.Floor(),
-bounds.Min.Y.Floor(),
+bounds.Max.X.Ceil(),