Rewrite WINGs wfont.c in Rust #9

Merged
trurl merged 14 commits from trurl/wmaker:refactor/wings-rs-font into refactor/wings-rs 2025-12-15 12:36:08 -05:00
Owner

This is a step towards getting rid of all uses of WMHashTable and, more importantly, a first crack at rewriting WINGs itself.

This is a step towards getting rid of all uses of WMHashTable and, more importantly, a first crack at rewriting WINGs itself.
trurl added 12 commits 2025-11-23 16:28:58 -05:00
We will use these to port W_Font, W_Screen, etc., to Rust.

Bindings are regenerated whenever the relevant C source files change and then
patched to make sure they will build. This is a bit hacky but will serve our
purposes: the struct definitions should be migrated to Rust sooner rather than
later, so the hackishness should be transient.
Having wings-rs depend on WINGs/WINGs/WINGsP.h was not working very well if all
of WINGs/ had to be built before wings-rs/. Moving wings-rs/ into WINGs/
addresses this.
This starts to establish the structure for an in-place rewrite of WINGs. An
actual redesign of WINGs may follow, but for now there are no plans to alter the
structure of WINGs substantially.
trurl requested review from cross 2025-11-23 16:29:36 -05:00
cross reviewed 2025-12-12 07:23:08 -05:00
@@ -0,0 +41,4 @@
NonNull::new(unsafe {
x11::xft::XftXlfdParse(
name.as_ptr(),
/*ignore_scalable=*/ 0,
Member

Instead of the comments, why not give these proper names via let bindings?

    let ignore_scalable = 0;
    let complete = 0;
    unsafe { x11::xft::XftXlfdParse(name.as_ptr(), ignore_scalable, complete) }
    ...
Instead of the comments, why not give these proper names via `let` bindings? ```rust let ignore_scalable = 0; let complete = 0; unsafe { x11::xft::XftXlfdParse(name.as_ptr(), ignore_scalable, complete) } ... ```
Author
Owner

I like the Google C++ style guide's prescription on this, but we don't have a lint, so... sure.

I like the Google C++ style guide's prescription on this, but we don't have a lint, so... sure.
trurl marked this conversation as resolved
cross approved these changes 2025-12-12 07:28:39 -05:00
cross left a comment
Member

This is certainly an improvement! I'm a bit surprised there aren't crates providing better bindings to both Xft and pango, but that's a separate matter.

This is certainly an improvement! I'm a bit surprised there aren't crates providing better bindings to both Xft and pango, but that's a separate matter.
Author
Owner

There are crates that provide pango bindings, but there's some weird provenance (https://github.com/yeslogic/fontconfig-rs/issues/52), and nothing seems like a drop-dead obvious thing to drop into the existing WINGs API.

Switching to a dedicated Xft/Pango crate, or something else entirely for managing fonts and drawing to the screen (to provide independence from X11), is definitely in the cards.

There are crates that provide pango bindings, but there's some weird provenance (https://github.com/yeslogic/fontconfig-rs/issues/52), and nothing seems like a drop-dead obvious thing to drop into the existing WINGs API. Switching to a dedicated Xft/Pango crate, or something else entirely for managing fonts and drawing to the screen (to provide independence from X11), is definitely in the cards.
trurl added 2 commits 2025-12-15 12:35:48 -05:00
trurl merged commit 9444c56e15 into refactor/wings-rs 2025-12-15 12:36:08 -05:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitrine/wmaker#9