diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-27 13:11:33 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-02-27 13:11:33 +0100 |
commit | 5e68c1283c297fb428a9347517ea02576bd55546 (patch) | |
tree | f7395115b90efd6c0239d6d72c5bca49168f6380 | |
parent | 0a5d26d121a8420feb25bd68c8f1623edf50e0a8 (diff) | |
parent | 3e8d98f3337a21cd9147c1ac4f27258c95bf41b0 (diff) | |
download | nx-libs-5e68c1283c297fb428a9347517ea02576bd55546.tar.gz nx-libs-5e68c1283c297fb428a9347517ea02576bd55546.tar.bz2 nx-libs-5e68c1283c297fb428a9347517ea02576bd55546.zip |
Merge branch 'sunweaver-pr/support-builtin-fonts' into 3.6.x
Attributes GH PR #316: https://github.com/ArcticaProject/nx-libs/pull/316
Reviewed by Mihai Moldovan <ionic@ionic.de> -- Fri, 17 Feb 2017 22:00:58 -0800
Ulrich Sibiller <uli42@gmx.de> -- Mon, 27 Feb 2017 03:11:55 -0800
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/nx-x11-common.dirs | 2 | ||||
-rw-r--r-- | debian/nx-x11-common.links | 1 | ||||
-rw-r--r-- | nx-X11/config/cf/X11.tmpl | 4 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/dix/dixfonts.c | 34 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/dix/main.c | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Font.c | 58 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 47 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/include/dixfont.h | 2 | ||||
-rw-r--r-- | nx-libs.spec | 24 |
10 files changed, 107 insertions, 69 deletions
diff --git a/debian/control b/debian/control index a98f7f6f0..c00550dc2 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,7 @@ Build-Depends: libxmltok1-dev, libxml2-dev, libxpm-dev, - libxfont1-dev | libxfont-dev, + libxfont1-dev | libxfont-dev (>= 1.4.2), libxdmcp-dev, libxdamage-dev, libxext-dev, diff --git a/debian/nx-x11-common.dirs b/debian/nx-x11-common.dirs new file mode 100644 index 000000000..07c657e09 --- /dev/null +++ b/debian/nx-x11-common.dirs @@ -0,0 +1,2 @@ +# we symlink to this dir, so make sure it exists +usr/share/fonts/X11
\ No newline at end of file diff --git a/debian/nx-x11-common.links b/debian/nx-x11-common.links new file mode 100644 index 000000000..1c181aa84 --- /dev/null +++ b/debian/nx-x11-common.links @@ -0,0 +1 @@ +usr/share/fonts/X11 usr/share/nx/fonts
\ No newline at end of file diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index 54f94355d..d5527cdc7 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -856,10 +856,10 @@ FCHOWN_DEFINES = -DHAS_FCHOWN #define DocPdfDir $(DOCDIR)/PDF #endif #ifndef FontDir -#define FontDir $(LIBDIR)/fonts +#define FontDir $(USRDATADIR)/fonts #endif #ifndef FontEncDir -#define FontEncDir $(LIBDIR)/fonts/encodings +#define FontEncDir $(USRDATADIR)/fonts/encodings #endif #ifndef AdmDir #define AdmDir /usr/adm diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c index f7d047c2d..c8e5f6cf0 100644 --- a/nx-X11/programs/Xserver/dix/dixfonts.c +++ b/nx-X11/programs/Xserver/dix/dixfonts.c @@ -1824,6 +1824,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error) int SetDefaultFontPath(char *path) { + char *temp_path, + *start, + *end; unsigned char *cp, *pp, *nump, @@ -1834,12 +1837,36 @@ SetDefaultFontPath(char *path) size = 0, bad; + /* ensure temp_path contains "built-ins" */ + start = path; + 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(path) + 1; + len = strlen(temp_path) + 1; nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); - if (!newpath) + if (!newpath) { + free(temp_path); return BadAlloc; - pp = (unsigned char *) path; + } + pp = (unsigned char *) temp_path; cp++; while (*pp) { if (*pp == ',') { @@ -1858,6 +1885,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/dix/main.c b/nx-X11/programs/Xserver/dix/main.c index 553ad6c03..7bd41d865 100644 --- a/nx-X11/programs/Xserver/dix/main.c +++ b/nx-X11/programs/Xserver/dix/main.c @@ -388,7 +388,7 @@ main(int argc, char *argv[], char *envp[]) SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error); } else { if (SetDefaultFontPath(defaultFontPath) != Success) - ErrorF("failed to set default font path '%s'", + ErrorF("failed to set default font path '%s'\n", defaultFontPath); } if (!SetDefaultFont(defaultTextFont)) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 5b9c31106..c9b9e3f75 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -69,38 +69,30 @@ is" without express or implied warranty. #undef TEST #undef DEBUG -#define NXAGENT_DEFAULT_FONT_DIR "/usr/X11R6/lib/X11/fonts" +#define NXAGENT_DEFAULT_FONT_DIR "/usr/share/nx/fonts" #define NXAGENT_ALTERNATE_FONT_DIR "/usr/share/X11/fonts" #define NXAGENT_ALTERNATE_FONT_DIR_2 "/usr/share/fonts/X11" -#define NXAGENT_ALTERNATE_FONT_DIR_3 "/usr/share/fonts" -#define NXAGENT_ALTERNATE_FONT_DIR_4 "/usr/NX/share/fonts" +#define NXAGENT_ALTERNATE_FONT_DIR_3 "/usr/X11R6/lib/X11/fonts" #define NXAGENT_DEFAULT_FONT_PATH \ -"/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/Speedo/,\ -/usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/75dpi/,\ -/usr/X11R6/lib/X11/fonts/100dpi/,/usr/X11R6/lib/X11/fonts/TTF/,\ -/usr/NX/share/fonts/base" +"/usr/share/nx/fonts/misc/,/usr/share/nx/fonts/Speedo/,\ +/usr/share/nx/fonts/Type1/,/usr/share/nx/fonts/75dpi/,\ +/usr/share/nx/fonts/100dpi/,/usr/share/nx/fonts/TTF/" #define NXAGENT_ALTERNATE_FONT_PATH \ "/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Speedo/,\ /usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,\ -/usr/share/X11/fonts/100dpi/,/usr/share/X11/fonts/TTF/,\ -/usr/NX/share/fonts/base" +/usr/share/X11/fonts/100dpi/,/usr/share/X11/fonts/TTF/" #define NXAGENT_ALTERNATE_FONT_PATH_2 \ "/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Speedo/,\ /usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,\ -/usr/share/fonts/X11/100dpi/,/usr/share/fonts/X11/TTF/,\ -/usr/NX/share/fonts/base" +/usr/share/fonts/X11/100dpi/,/usr/share/fonts/X11/TTF/" #define NXAGENT_ALTERNATE_FONT_PATH_3 \ -"/usr/share/fonts/misc/,/usr/share/fonts/Speedo/,\ -/usr/share/fonts/Type1/,/usr/share/fonts/75dpi/,\ -/usr/share/fonts/100dpi/,/usr/share/fonts/TTF/,\ -/usr/NX/share/fonts/base" - -#define NXAGENT_ALTERNATE_FONT_PATH_4 \ -"/usr/NX/share/fonts/base" +"/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/Speedo/,\ +/usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/75dpi/,\ +/usr/X11R6/lib/X11/fonts/100dpi/,/usr/X11R6/lib/X11/fonts/TTF/" #undef NXAGENT_FONTCACHE_DEBUG #undef NXAGENT_RECONNECT_FONT_DEBUG @@ -1479,7 +1471,7 @@ void nxagentVerifyDefaultFontPath(void) S_ISDIR(dirStat.st_mode) != 0) { /* - * Let's use the old "/usr/X11R6/lib/X11/fonts" style. + * Let's use the old "/usr/share/nx/fonts" style. */ #ifdef TEST @@ -1554,7 +1546,7 @@ void nxagentVerifyDefaultFontPath(void) S_ISDIR(dirStat.st_mode) != 0) { /* - * Let's use the "/usr/share/fonts" path. + * Let's use the "/usr/X11R6/lib/X11/fonts" path. */ #ifdef TEST @@ -1574,32 +1566,6 @@ void nxagentVerifyDefaultFontPath(void) strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH_3); } - - if (stat(NXAGENT_ALTERNATE_FONT_DIR_4, &dirStat) == 0 && - S_ISDIR(dirStat.st_mode) != 0) - { - /* - * Let's use the "/usr/NX/share/fonts" path. - */ - - #ifdef TEST - fprintf(stderr, "nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].\n", - validateString(NXAGENT_ALTERNATE_FONT_DIR_4)); - #endif - - if (*fontPath != '\0') - { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_4) + 2); - strcat(fontPath, ","); - } - else - { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_4) + 1); - } - - strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH_4); - } - if (*fontPath == '\0') { #ifdef WARNING 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..6149d2160 100644 --- a/nx-X11/programs/Xserver/include/dixfont.h +++ b/nx-X11/programs/Xserver/include/dixfont.h @@ -150,4 +150,6 @@ extern void InitGlyphCaching(void); extern void SetGlyphCachingMode(int /*newmode*/); +extern void register_fpe_functions(void); + #endif /* DIXFONT_H */ diff --git a/nx-libs.spec b/nx-libs.spec index 7e3ca4796..7e25b7e81 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -26,6 +26,10 @@ BuildRequires: gpg-offline %endif %if 0%{?suse_version} BuildRequires: fdupes + +# This is what provides /usr/share/fonts on SUSE systems... +BuildRequires: filesystem + %if 0%{?suse_version} >= 1130 BuildRequires: pkgconfig(expat) BuildRequires: pkgconfig(libpng) @@ -34,7 +38,7 @@ BuildRequires: pkgconfig(pixman-1) >= 0.13.2 BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(xext) BuildRequires: pkgconfig(xpm) -BuildRequires: pkgconfig(xfont) +BuildRequires: pkgconfig(xfont) >= 1.4.2 BuildRequires: pkgconfig(xdmcp) BuildRequires: pkgconfig(xdamage) BuildRequires: pkgconfig(xcomposite) @@ -50,7 +54,7 @@ BuildRequires: pixman-devel >= 0.13.2 BuildRequires: xorg-x11-libX11-devel BuildRequires: xorg-x11-libXext-devel BuildRequires: xorg-x11-libXpm-devel -BuildRequires: xorg-x11-libXfont-devel +BuildRequires: xorg-x11-libXfont-devel >= 1.4.2 BuildRequires: xorg-x11-libXdmcp-devel BuildRequires: xorg-x11-libXdamage-devel BuildRequires: xorg-x11-libXcomposite-devel @@ -70,7 +74,7 @@ BuildRequires: pixman-devel >= 0.13.2 BuildRequires: libX11-devel BuildRequires: libXext-devel BuildRequires: libXpm-devel -BuildRequires: libXfont-devel +BuildRequires: libXfont-devel >= 1.4.2 BuildRequires: libXdmcp-devel BuildRequires: libXdamage-devel BuildRequires: libXcomposite-devel @@ -78,6 +82,7 @@ BuildRequires: libXrandr-devel BuildRequires: libXfixes-devel BuildRequires: libXtst-devel BuildRequires: libXinerama-devel +BuildRequires: xorg-x11-font-utils %endif # For imake @@ -272,8 +277,9 @@ Obsoletes: nx < 3.5.0-19 Provides: nx = %{version}-%{release} Provides: nx%{?_isa} = %{version}-%{release} Obsoletes: nxauth < 3.5.99.1 -%if 0%{?suse_version} -Requires: xorg-x11-fonts-core +%if 0%{?fedora} || 0%{?rhel} +# For /usr/share/X11/fonts +Requires: xorg-x11-font-utils %endif %description -n nxagent @@ -357,6 +363,13 @@ make install \ INSTALL_FILE="install -pm0644" \ INSTALL_PROGRAM="install -pm0755" +# this needs to be adapted distribution-wise... +%if 0%{?suse_version} +ln -s ../fonts %{buildroot}%{_datadir}/nx/fonts +%elif 0%{?fedora} || 0%{?rhel} +ln -s ../X11/fonts %{buildroot}%{_datadir}/nx/fonts +%endif + # Remove static libs (they don't exist on SLES, so using -f here) rm -f %{buildroot}%{_libdir}/*.a @@ -520,6 +533,7 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %dir %{_datadir}/nx %{_datadir}/nx/VERSION.nxagent %{_datadir}/man/man1/nxagent.1* +%{_datadir}/nx/fonts %files -n nxproxy %defattr(-,root,root) |