From e521722f5fd339ef72ee51af88f3941b71b1d9cf Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Thu, 12 Nov 2026 22:40:42 -0700 Subject: okay, all the color stuff is well-organized now since color is one of those "the data is the point" types, rather than one that encapsulates remote state, both the xcb and xft stuff is handled by a single type, Color. Force-Push: yes Change-Id: I192c40b13dd9040897cbf043d5dd84d5a73f607b --- src/x/font.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/x/font.rs') diff --git a/src/x/font.rs b/src/x/font.rs index d12cbe8..e0e3602 100644 --- a/src/x/font.rs +++ b/src/x/font.rs @@ -3,16 +3,11 @@ use crate::x::*; use std::ffi::CString; use std::sync::Arc; -use x11::xft::{ - XftColor, - XftDraw, - XftDrawStringUtf8, - XftFontOpenName, -}; +use x11::xft::{ XftDrawStringUtf8, XftFontOpenName }; pub struct Font { - display: Arc, + _display: Arc, font_state: *mut x11::xft::XftFont, } @@ -27,17 +22,17 @@ impl Font { XftFontOpenName(xlib_display, screen_index, name.as_ptr().cast()) }; - Ok(Font { display, font_state }) + Ok(Font { _display: display, font_state }) } - pub fn draw(&self, context: &FontGraphicContext, xft_color: &XftColor, + pub fn draw(&self, context: &FontGraphicContext, color: &Color, x: i32, y: i32, text: &str) -> xcb::Result<()> { let xft_draw = context.get_xft_draw(); let text = CString::new(text).unwrap(); unsafe { - XftDrawStringUtf8(xft_draw, xft_color, self.font_state, x, y, + XftDrawStringUtf8(xft_draw, color.as_xft_color(), self.font_state, x, y, text.as_ptr().cast(), text.count_bytes() as i32) }; -- cgit 1.4.1