Skip to content

Commit

Permalink
{dix/,hw/nxagent/NX}dixfont.{c,h}: Support using builtin-fonts. Makes…
Browse files Browse the repository at this point in the history
… dependency on X11's misc fonts package obsolete.

 Fixes ArcticaProject#84.
 Fixes ArcticaProject#285.
  • Loading branch information
sunweaver committed Feb 5, 2017
1 parent d6f475f commit 3b6d64c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
4 changes: 4 additions & 0 deletions nx-X11/programs/Xserver/dix/dixfonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,11 @@ InitFonts ()
{
patternCache = MakeFontPatternCache();

#if defined(BUILTIN_FONTS) || defined(NXAGENT_SERVER)
BuiltinRegisterFpeFunctions();
#else
register_fpe_functions();
#endif
}

int
Expand Down
31 changes: 27 additions & 4 deletions nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,9 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
int
SetDefaultFontPath(char *path)
{
char *temp_path,
*start,
*end;
unsigned char *cp,
*pp,
*nump,
Expand All @@ -936,19 +939,38 @@ 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) {
temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
} else {
temp_path = strdup(path);
}
if (!temp_path)
return BadAlloc;

/* get enough for string, plus values -- use up commas */
#ifdef NX_TRANS_SOCKET
len = strlen(_NXGetFontPath(path)) + 1;
len = strlen(_NXGetFontPath(temp_path)) + 1;
#else
len = strlen(path) + 1;
len = strlen(temp_path) + 1;
#endif
nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len);
if (!newpath)
return BadAlloc;
#ifdef NX_TRANS_SOCKET
pp = (unsigned char *) _NXGetFontPath(path);
pp = (unsigned char *) _NXGetFontPath(temp_path);
#else
pp = (unsigned char *) path;
pp = (unsigned char *) temp_path;
#endif
cp++;
while (*pp) {
Expand All @@ -968,6 +990,7 @@ SetDefaultFontPath(char *path)
err = SetFontPathElements(num, newpath, &bad, TRUE);

DEALLOCATE_LOCAL(newpath);
DEALLOCATE_LOCAL(temp_path);

return err;
}
Expand Down
5 changes: 5 additions & 0 deletions nx-X11/programs/Xserver/include/dixfont.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit 3b6d64c

Please sign in to comment.