aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-02-05 17:06:55 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-02-27 12:20:53 +0100
commited40c3db1d5d6a58523c49d733678af10515460d (patch)
tree5ef3caccbc18e678608af80d2bbf63dde946a7dc
parent82a7f72ca53054d3c1be1cf0b83d7e6245ed7ca6 (diff)
downloadnx-libs-ed40c3db1d5d6a58523c49d733678af10515460d.tar.gz
nx-libs-ed40c3db1d5d6a58523c49d733678af10515460d.tar.bz2
nx-libs-ed40c3db1d5d6a58523c49d733678af10515460d.zip
{dix/,hw/nxagent/NX}dixfont.{c,h}: Support using builtin-fonts. Makes dependency on X11's misc fonts package obsolete.
This backports a mixture of these X.org commits (only focusing on SetDefaultFontPath() function): commit 03e8bfa1d122f7dea905d48c93cfd54afd991dfd Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Nov 27 20:09:04 2010 -0800 Convert existing Xprintf style calls to asprintf style Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> commit 12e46e83733b47d2704e1509960192365102af46 Author: Tiago Vignatti <tiago.vignatti@nokia.com> Date: Fri Mar 25 22:07:31 2011 +0200 dix: fix memory leak in SetDefaultFontPath Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> commit 6592db6bb526f0c43b4c7b55859c629709e039b4 Author: Mikhail Gusarov <dottedmag@dottedmag.net> Date: Fri Jun 4 16:58:58 2010 +0700 Get rid of xstrdup when argument is definitely non-NULL Replace xstrdup with strdup when either constant string is being duplicated or argument is guarded by conditionals and obviously can't be NULL Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> commit f56cbe1ef24415d0142b9a7d0ab0a031069ccb52 Author: Rémi Cardona <remi@gentoo.org> Date: Mon Sep 14 17:09:59 2009 +0200 dix: append "built-ins" to the font path in SetDefaultFontPath 49b93df8a3002db7196aa3fc1fd8dca1c12a55d6 made the hard dependency on a "fixed" font go away but only Xorg could use the built-ins fonts by default. With this commit, all DDXs get "built-ins" appended to their FontPath, not just Xorg. Tested with Xorg, Xvfb and Xnest. Signed-off-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> commit 49b93df8a3002db7196aa3fc1fd8dca1c12a55d6 Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> Date: Wed Jan 7 19:37:03 2009 -0200 Default to use standard bitmap fonts, with builtins as fallback The builtin-fonts configure option was removed, as it at best should have been a runtime option. Instead, now it always register all "font path element" backends, and adds built-ins fonts at the end of the default font path. This should be a more reasonable solution, to "correct" the most common Xorg FAQ (could not open default font 'fixed'), and also don't break by default applications that use only the standard/historical X Font rendering. Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fixes ArcticaProject/nx-libs#84. Fixes ArcticaProject/nx-libs#285.
-rw-r--r--nx-X11/programs/Xserver/dix/dixfonts.c4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c47
-rw-r--r--nx-X11/programs/Xserver/include/dixfont.h5
3 files changed, 45 insertions, 11 deletions
diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c
index f7d047c2d..bbce105e3 100644
--- a/nx-X11/programs/Xserver/dix/dixfonts.c
+++ b/nx-X11/programs/Xserver/dix/dixfonts.c
@@ -1925,7 +1925,11 @@ InitFonts ()
{
patternCache = MakeFontPatternCache();
+#if defined(BUILTIN_FONTS) || defined(NXAGENT_SERVER)
+ BuiltinRegisterFpeFunctions();
+#else
register_fpe_functions();
+#endif
}
int
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
index 294a5727d..b3d7cc9d7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
@@ -926,6 +926,9 @@ bail:
int
SetDefaultFontPath(char *path)
{
+ char *temp_path,
+ *start,
+ *end;
unsigned char *cp,
*pp,
*nump,
@@ -936,20 +939,41 @@ SetDefaultFontPath(char *path)
size = 0,
bad;
- /* get enough for string, plus values -- use up commas */
#ifdef NX_TRANS_SOCKET
- len = strlen(_NXGetFontPath(path)) + 1;
-#else
- len = strlen(path) + 1;
-#endif
+ path = (char *) _NXGetFontPath(path);
+#endif /* NX_TRANS_SOCKET */
+
+ start = path;
+
+ /* ensure temp_path contains "built-ins" */
+ while (1) {
+ start = strstr(start, "built-ins");
+ if (start == NULL)
+ break;
+ end = start + strlen("built-ins");
+ if ((start == path || start[-1] == ',') && (!*end || *end == ','))
+ break;
+ start = end;
+ }
+ if (!start) {
+ if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "")
+ == -1)
+ temp_path = NULL;
+ }
+ else {
+ temp_path = strdup(path);
+ }
+ if (!temp_path)
+ return BadAlloc;
+
+ /* get enough for string, plus values -- use up commas */
+ len = strlen(temp_path) + 1;
nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
- if (!newpath)
+ if (!newpath) {
+ free(temp_path);
return BadAlloc;
-#ifdef NX_TRANS_SOCKET
- pp = (unsigned char *) _NXGetFontPath(path);
-#else
- pp = (unsigned char *) path;
-#endif
+ }
+ pp = (unsigned char *) temp_path;
cp++;
while (*pp) {
if (*pp == ',') {
@@ -968,6 +992,7 @@ SetDefaultFontPath(char *path)
err = SetFontPathElements(num, newpath, &bad, TRUE);
DEALLOCATE_LOCAL(newpath);
+ free(temp_path);
return err;
}
diff --git a/nx-X11/programs/Xserver/include/dixfont.h b/nx-X11/programs/Xserver/include/dixfont.h
index 6582be24c..1303d0e0f 100644
--- a/nx-X11/programs/Xserver/include/dixfont.h
+++ b/nx-X11/programs/Xserver/include/dixfont.h
@@ -150,4 +150,9 @@ extern void InitGlyphCaching(void);
extern void SetGlyphCachingMode(int /*newmode*/);
+/*
+ * libXfont/src/builtins/builtin.h
+ */
+extern _X_EXPORT void BuiltinRegisterFpeFunctions(void);
+
#endif /* DIXFONT_H */