LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-22-2023, 03:12 AM   #1
penguin_quest
LQ Newbie
 
Registered: Jul 2023
Posts: 2

Rep: Reputation: 0
Linux text/font rendering stack


I've been trying to get into lower-level programming with fonts, particularly for interactive use, but it's been difficult to navigate the documentation. A lot of it is unfortunately outdated or full of broken links, since the lower-level libraries are ancient .

My understanding is that for X11, the stack is basically:
  • fontconfig for locating fonts that match a pattern.
  • freetype is the basic glyph rasterization library.
  • cairo, on top of freetype, is a cross-platform abstract API for consistent rendering results.
  • HarfBuzz parses text and feeds cairo the positions each glyph should be rendered.
  • Pango splits the input text into "runs" of the same script, language, and directionality, to feed to HarfBuzz.
  • At the top of the stack, lots of software like Gtk and Qt are built on Pango.

My question is this: how does this translate to Wayland? There's not as much written for Wayland as for X. I know Gtk and Qt work on Wayland, but the dependencies for each display server may be different. I couldn't tell just by looking at their build scripts. I assumed that the software stacks would remain pretty much the same, but what really confuses me is that Cairo seems to have no target for Wayland. Cairo supports XCB and Xlib surfaces, whereas its support for EGL surfaces was removed in 2021, and EGL is what Wayland uses.

(Also, did I miss any other prominent libraries in the text rendering stack above?)

Thanks.
 
Old 07-28-2023, 07:11 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,267
Blog Entries: 24

Rep: Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195
Welcome to LQ and the Programming forum!

Unfortunately there do not appear to be any font rendering stack gurus about at this time!

As your question seems to be specifically about Wayland you might get a better, more active response from the Wayland developers themselves, just follow the link!

Best of luck finding what you seek, please let us know what you find and return to LQ if you have other questions!
 
Old 07-28-2023, 09:06 PM   #3
EdGr
Member
 
Registered: Dec 2010
Location: California, USA
Distribution: I run my own OS
Posts: 998

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
I just now saw this thread.

While I have not worked at this level of the stack, I see that GDK contains the plumbing between Cairo and Wayland. GDK is part of GTK.

In gdkwindow-wayland.c:

Code:
/* The cairo surface returned here uses a memory segment that's shared
 * with the display server.  This is not a temporary buffer that gets
 * copied to the display server, but the actual buffer the display server
 * will ultimately end up sending to the GPU. At the time this happens
 * impl->committed_cairo_surface gets set to impl->staging_cairo_surface, and
 * impl->staging_cairo_surface gets nullified.
 */
static cairo_surface_t *
gdk_wayland_window_ref_cairo_surface (GdkWindow *window)
{
Cairo draws on a cairo_image_surface in memory. There is no Wayland-specific backend.
Ed
 
1 members found this post helpful.
Old 07-29-2023, 09:38 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
I've only played with libX11 CoreFonts and libXft. Not messed with cairo, fontconfig, harfbuzz, freetype or any of the fancy stuff. No experience with wayland either.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Blender 3.2 Enables AMD GPU Rendering on Linux, Adds New Rendering Features LXer Syndicated Linux News 0 06-09-2022 07:06 AM
rendering in vlc ubuntu. how can I start rendering in vlc opensuse ? JaeBok Linux - Newbie 5 05-28-2022 07:24 AM
Font rendering is ugly. Which font and settings to use? rempas Linux - Desktop 19 01-06-2022 03:26 PM
single 8K process stack vs 4K process stack and a seperate 4K interrupt stack charvak Linux - Kernel 1 03-17-2010 06:58 PM
direct rendering: Yes :: (but applications say direct rendering is not possible?) AbsoluteMonkey Fedora 0 12-16-2008 09:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration