[PATCH 1/4] shadowfb calls GetGlyphs() so list libXfont as a dependency

Alan Coopersmith alan.coopersmith at oracle.com
Sun Jun 24 09:31:10 PDT 2012


On 06/23/12 09:20 PM, Yaakov (Cygwin/X) wrote:
> On 2012-06-22 23:59, Alan Coopersmith wrote:
>> Blargh.   On Solaris you have to link libXfont just right to avoid the weak
>> symbols being linked wrong and overriding the symbols from Xorg, which leaves
>> Xorg unable to start because it can't even find the builtin fonts.
> 
> That's exactly what happens on Cygwin as well with a shared libXfont.
> 
>> Maybe its time to finally make libXfont stop being a 900 lb. weakling.
> 
> How exactly?

I was thinking of making it so that libXfont didn't call those functions
directly, but required the caller to call a new "init callbacks" API that
passed in pointers to them, much like the RegisterFPEFunctions functions
does for each font backend.   Alternatively, we could just drop the weak
stubs and require all callers to provide all those functions - currently
I see three remaining users of libXfont - the X server, xfs, & bdftopcf.
I suspect for bdftopcf the best long term plan is to move it to using
freetype instead of libXfont, and then we're left with the two servers
which already implement most of those functions and shouldn't need weak
versions, but that wouldn't allow "-no-undefined" linking for it, while
an init callbacks API would.

But in looking at what it would take to do that I found a much simpler
solution for this case, since GetGlyphs() is not a weak-linked function,
and not used by anything but the X server & its modules, and is just a
simple wrapper around the public API of libXfont, not using any private
implementation details - just move it to the Xserver.   It's even already
listed in dixfonts.h as a function the X server exports, so this is just
simplifying the linker work to make it available to callers.

So replace the original [PATCH 1/4] with the following which adds
GetGlyphs() to dixfonts.c, making all platforms export it from the same
binary, instead of differing based on how libXfont is linked.   (For now,
it's left in libXfont as well, to avoid breaking older Xorg servers.
If I do finish converting it to not use weak linking, that will be an
ABI breaking version of libXfont anyway, and it can be removed at the
same time, requiring new Xserver & xfs versions to use the new library
and old ones to use the old.)

	-alan-

>From a1e506729687713f52f46ce6b0c3d0f089d0fd6d Mon Sep 17 00:00:00 2001
From: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Fri, 22 Jun 2012 23:02:47 -0700
Subject: [PATCH] Move GetGlyphs from libXfont to dixfont to simplify linking

No other Xfont consumer used it, and this saves us from having to link
callers against libXfont for one simple function when doing
-no-undefined symbols builds.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 dix/dixfonts.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 19fd31e..4d7259d 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -115,6 +115,15 @@ LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned
nchars, int item_size,
         return Successful;
 }

+void
+GetGlyphs(FontPtr font, unsigned long count, unsigned char *chars,
+          FontEncoding fontEncoding,
+          unsigned long *glyphcount,    /* RETURN */
+          CharInfoPtr *glyphs)          /* RETURN */
+{
+    (*font->get_glyphs) (font, count, chars, fontEncoding, glyphcount, glyphs);
+}
+
 /*
  * adding RT_FONT prevents conflict with default cursor font
  */
-- 
1.7.9.2


More information about the xorg-devel mailing list