Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
f6177d2a
Unverified
Commit
f6177d2a
authored
May 10, 2019
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uli42-pr/short_font_code' into 3.6.x
Attributes GH PR #795:
https://github.com/ArcticaProject/nx-libs/pull/795
parents
d94e9ba2
453edbd2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
128 deletions
+105
-128
Makefile
Makefile
+5
-0
Imake.tmpl
nx-X11/config/cf/Imake.tmpl
+5
-0
host.def
nx-X11/config/cf/host.def
+3
-3
Font.c
nx-X11/programs/Xserver/hw/nxagent/Font.c
+91
-125
Imakefile
nx-X11/programs/Xserver/hw/nxagent/Imakefile
+1
-0
No files found.
Makefile
View file @
f6177d2a
...
...
@@ -30,6 +30,9 @@ CONFIGURE ?= ./configure --prefix="$(PREFIX)"
ifneq
($(shell
pkg-config
--exists
xkbcomp
&&
echo
yes),
yes)
$(warning
xkbcomp
devel
package
missing,
using
imake
default
values)
endif
ifneq
($(shell
pkg-config
--exists
fontutil
&&
echo
yes),
yes)
$(warning
fontutil
devel
package
missing,
using
imake
default
values)
endif
IMAKE_DEFINES
?=
...
...
@@ -112,6 +115,8 @@ imakeconfig:
(pkg-config --exists xkbcomp && echo "#define SystemXkbConfigDir `pkg-config xkbcomp --variable=xkbconfigdir`";
:
) >>nx-X11/config/cf/nxconfig.def
(
pkg-config
--exists
xkbcomp
&&
echo
"#define SystemXkbBinDir
`
pkg-config xkbcomp
--variable
=
prefix
`
/bin"
;
:
)
>>
nx-X11/config/cf/nxconfig.def
(pkg-config --exists fontutil && echo "#define SystemFontRootDir `pkg-config fontutil --variable=fontrootdir`";
:
) >>nx-X11/config/cf/nxconfig.def
# let's create the nx-X11 Makefiles now, once everything has been defined
$(MAKE)
-j1
-C
nx-X11
Makefiles
IMAKE_DEFINES
=
"
$(IMAKE_DEFINES)
"
...
...
nx-X11/config/cf/Imake.tmpl
View file @
f6177d2a
...
...
@@ -791,6 +791,10 @@ TCLIBDIR = TclLibDir
#define SystemXkbBinDir /usr/bin
#endif
#ifndef SystemFontDir
#define SystemFontDir /usr/share/fonts/X11
#endif
#ifndef ShLibDir
#define ShLibDir UsrLibDir
#endif
...
...
@@ -1668,6 +1672,7 @@ TCLIBDIR = TclLibDir
SYSTEMUSRINCDIR = SystemUsrIncDir /* system's "/usr/include" */
SYSTEMXKBCONFDIR = SystemXkbConfigDir /* system's "/usr/share/xkb" */
SYSTEMXKBBINDIR = SystemXkbBinDir /* system's "/usr/bin" */
SYSTEMFONTDIR = SystemFontDir /* system's "/usr/share/fonts/X11" */
SHLIBDIR = ShLibDir /* shared libraries */
LINTLIBDIR = LintlibDir /* lint libraries */
MANPATH = ManPath /* top of manual page tree */
...
...
nx-X11/config/cf/host.def
View file @
f6177d2a
...
...
@@ -156,15 +156,15 @@
* this by default as NX intaller carries only misc and TTF in the
* basic set of fonts installed under Windows.
*
#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/
Speedo/,$(FONTDIR)/
Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/
#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/
*/
#if defined(LinuxArchitecture) || defined(SunArchitecture) || defined(FreeBSDArchitecture)
#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/
Speedo/,$(FONTDIR)/
Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/,$(FONTDIR)/TTF/
#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/,$(FONTDIR)/TTF/
#endif /* #if defined(LinuxArchitecture) || defined(SunArchitecture) */
#if defined(cygwinArchitecture)
#define DefaultFontPath /mnt/NX/fonts/base/,/mnt/NX/fonts/misc/,/mnt/NX/fonts/
Speedo/,/mnt/NX/fonts/
Type1/,/mnt/NX/fonts/75dpi/,/mnt/NX/fonts/100dpi/,/mnt/NX/fonts/TTF/
#define DefaultFontPath /mnt/NX/fonts/base/,/mnt/NX/fonts/misc/,/mnt/NX/fonts/Type1/,/mnt/NX/fonts/75dpi/,/mnt/NX/fonts/100dpi/,/mnt/NX/fonts/TTF/
#endif /* #if defined(cygwinArchitecture) */
/*
...
...
nx-X11/programs/Xserver/hw/nxagent/Font.c
View file @
f6177d2a
...
...
@@ -71,30 +71,22 @@ is" without express or implied warranty.
#undef TEST
#undef DEBUG
#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/X11R6/lib/X11/fonts"
#define NXAGENT_DEFAULT_FONT_PATH \
"/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/"
#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/"
#define NXAGENT_ALTERNATE_FONT_PATH_3 \
"/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/"
const
char
*
nxagentFontDirs
[]
=
{
SYSTEMFONTDIR
,
"/usr/share/nx/fonts"
,
"/usr/share/X11/fonts"
,
"/usr/share/fonts/X11"
,
"/usr/X11R6/lib/X11/fonts"
,
NULL
};
const
char
*
nxagentFontSubdirs
[]
=
{
"Type1"
,
"75dpi"
,
"100dpi"
,
"TTF"
,
NULL
};
#undef NXAGENT_FONTCACHE_DEBUG
#undef NXAGENT_RECONNECT_FONT_DEBUG
...
...
@@ -711,7 +703,7 @@ Bool nxagentUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
int
nxagentDestroyNewFontResourceType
(
void
*
p
,
XID
id
)
{
#ifdef TEST
fprintf
(
stderr
,
"
nxagentDestroyNewFontResourceType: Destroying mirror id [%ld] for font at [%p].
\n
"
,
fprintf
(
stderr
,
"
%s: Destroying mirror id [%ld] for font at [%p].
\n
"
,
__func__
,
nxagentFontPriv
((
FontPtr
)
p
)
->
mirrorID
,
(
void
*
)
p
);
#endif
...
...
@@ -1418,14 +1410,14 @@ static Bool nxagentGetFontServerPath(char * fontServerPath, int size)
snprintf
(
fontServerPath
,
min
(
size
,
len
+
1
),
"%s"
,
path
+
1
);
#ifdef TEST
fprintf
(
stderr
,
"
nxagentGetFontServerPath: Got path [%s].
\n
"
,
fprintf
(
stderr
,
"
%s: Got path [%s].
\n
"
,
__func__
,
fontServerPath
);
#endif
}
else
{
#ifdef TEST
fprintf
(
stderr
,
"
nxagentGetFontServerPath: WARNING! Font server tunneling not enabled.
\n
"
);
fprintf
(
stderr
,
"
%s: WARNING! Font server tunneling not enabled.
\n
"
,
__func__
);
#endif
return
False
;
...
...
@@ -1434,7 +1426,7 @@ static Bool nxagentGetFontServerPath(char * fontServerPath, int size)
else
{
#ifdef TEST
fprintf
(
stderr
,
"
nxagentGetFontServerPath: WARNING! Failed to get path for font server tunneling.
\n
"
);
fprintf
(
stderr
,
"
%s: WARNING! Failed to get path for font server tunneling.
\n
"
,
__func__
);
#endif
return
False
;
...
...
@@ -1443,144 +1435,118 @@ static Bool nxagentGetFontServerPath(char * fontServerPath, int size)
return
True
;
}
void
nxagentVerify
DefaultFontPath
(
void
)
void
nxagentVerify
SingleFontPath
(
char
**
dest
,
const
char
*
fontDir
)
{
struct
stat
dirStat
;
static
char
*
fontPath
;
if
(
!
dest
||
!*
dest
)
return
;
#ifdef TEST
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: Going to search for one or more valid font paths.
\n
"
);
fprintf
(
stderr
,
"%s: Assuming fonts in directory [%s].
\n
"
,
__func__
,
validateString
(
fontDir
));
#endif
/*
* Set the default font path as the first choice.
*/
if
((
fontPath
=
strdup
(
defaultFontPath
))
==
NULL
)
for
(
int
i
=
0
;
;
i
++
)
{
#ifdef WARNING
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: WARNING! Unable to allocate memory for a new font path. "
"Using the default font path [%s].
\n
"
,
validateString
(
defaultFontPath
));
#endif
char
*
tmppath
=
NULL
;
int
rc
;
return
;
}
const
char
*
subdir
=
nxagentFontSubdirs
[
i
];
if
(
stat
(
NXAGENT_DEFAULT_FONT_DIR
,
&
dirStat
)
==
0
&&
S_ISDIR
(
dirStat
.
st_mode
)
!=
0
)
{
/*
* Let's use the old "/usr/share/nx/fonts" style.
*/
#ifdef TEST
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].
\n
"
,
validateString
(
NXAGENT_DEFAULT_FONT_DIR
));
#endif
if
(
subdir
==
NULL
)
return
;
if
(
*
fontPath
!=
'\0'
)
if
(
*
*
dest
!=
'\0'
)
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_DEFAULT_FONT_PATH
)
+
2
);
strcat
(
fontPath
,
","
);
rc
=
asprintf
(
&
tmppath
,
"%s,%s/%s"
,
*
dest
,
fontDir
,
subdir
);
}
else
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_DEFAULT_FONT_PATH
)
+
1
);
rc
=
asprintf
(
&
tmppath
,
"%s/%s"
,
fontDir
,
subdir
);
}
strcat
(
fontPath
,
NXAGENT_DEFAULT_FONT_PATH
);
}
if
(
rc
==
-
1
)
return
;
if
(
stat
(
NXAGENT_ALTERNATE_FONT_DIR
,
&
dirStat
)
==
0
&&
S_ISDIR
(
dirStat
.
st_mode
)
!=
0
)
{
/*
* Let's use the new "/usr/share/X11/fonts" path.
*/
free
(
*
dest
);
*
dest
=
tmppath
;
tmppath
=
NULL
;
}
}
#ifdef TEST
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].
\n
"
,
validateString
(
NXAGENT_ALTERNATE_FONT_DIR
));
#endif
void
nxagentVerifyDefaultFontPath
(
void
)
{
static
char
*
fontPath
;
if
(
*
fontPath
!=
'\0'
)
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_ALTERNATE_FONT_PATH
)
+
2
);
strcat
(
fontPath
,
","
);
}
else
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_ALTERNATE_FONT_PATH
)
+
1
);
}
#ifdef TEST
fprintf
(
stderr
,
"%s: Going to search for one or more valid font paths.
\n
"
,
__func__
);
#endif
strcat
(
fontPath
,
NXAGENT_ALTERNATE_FONT_PATH
);
}
/*
* Set the default font path as the first choice.
*/
if
(
stat
(
NXAGENT_ALTERNATE_FONT_DIR_2
,
&
dirStat
)
==
0
&&
S_ISDIR
(
dirStat
.
st_mode
)
!=
0
)
if
((
fontPath
=
strdup
(
defaultFontPath
))
==
NULL
)
{
/*
* Let's use the "/usr/share/fonts/X11" path.
*/
#ifdef TEST
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].
\n
"
,
validateString
(
NXAGENT_ALTERNATE_FONT_DIR_2
));
#ifdef WARNING
fprintf
(
stderr
,
"%s: WARNING! Unable to allocate memory for a new font path. "
"Using the default font path [%s].
\n
"
,
__func__
,
validateString
(
defaultFontPath
));
#endif
if
(
*
fontPath
!=
'\0'
)
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_ALTERNATE_FONT_PATH_2
)
+
2
);
strcat
(
fontPath
,
","
);
}
else
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_ALTERNATE_FONT_PATH_2
)
+
1
);
}
strcat
(
fontPath
,
NXAGENT_ALTERNATE_FONT_PATH_2
);
return
;
}
if
(
stat
(
NXAGENT_ALTERNATE_FONT_DIR_3
,
&
dirStat
)
==
0
&&
S_ISDIR
(
dirStat
.
st_mode
)
!=
0
)
for
(
int
i
=
0
;
;
i
++
)
{
/*
* Let's use the "/usr/X11R6/lib/X11/fonts" path.
*/
int
j
;
const
char
*
dir
=
nxagentFontDirs
[
i
];
#ifdef TEST
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].
\n
"
,
validateString
(
NXAGENT_ALTERNATE_FONT_DIR_3
));
#endif
if
(
*
fontPath
!=
'\0'
)
if
(
dir
==
NULL
)
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_ALTERNATE_FONT_PATH_3
)
+
2
);
strcat
(
fontPath
,
","
);
break
;
}
else
{
fontPath
=
realloc
(
fontPath
,
strlen
(
fontPath
)
+
strlen
(
NXAGENT_ALTERNATE_FONT_PATH_3
)
+
1
);
}
for
(
j
=
0
;
j
<=
i
;
j
++
)
{
//if (strcmp(nxagentFontDirs[j], dir) == 0)
if
(
nxagentFontDirs
[
j
]
==
dir
)
{
break
;
}
}
strcat
(
fontPath
,
NXAGENT_ALTERNATE_FONT_PATH_3
);
if
(
j
==
i
)
{
nxagentVerifySingleFontPath
(
&
fontPath
,
dir
);
}
#ifdef TEST
else
{
fprintf
(
stderr
,
"%s: Skipping duplicate font dir [%s].
\n
"
,
__func__
,
validateString
(
dir
));
}
#endif
}
}
if
(
*
fontPath
==
'\0'
)
if
(
*
fontPath
==
'\0'
)
{
#ifdef WARNING
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: WARNING! Can't find a valid font directory.
\n
"
);
fprintf
(
stderr
,
"nxagentVerifyDefaultFontPath: WARNING! Using font path [%s].
\n
"
,
validateString
(
defaultFontPath
));
fprintf
(
stderr
,
"%s: WARNING! Can't find a valid font directory.
\n
"
,
__func__
);
fprintf
(
stderr
,
"%s: WARNING! Using font path [%s].
\n
"
,
__func__
,
validateString
(
defaultFontPath
));
#endif
}
else
{
/* do _not_ free defaultFontPath here - it's either set at compile time or
part of argv */
defaultFontPath
=
fontPath
;
#ifdef TEST
fprintf
(
stderr
,
"
nxagentVerifyDefaultFontPath: Using font path [%s].
\n
"
,
validateString
(
defaultFontPath
));
fprintf
(
stderr
,
"
%s: Using font path [%s].
\n
"
,
__func__
,
validateString
(
defaultFontPath
));
#endif
}
...
...
nx-X11/programs/Xserver/hw/nxagent/Imakefile
View file @
f6177d2a
...
...
@@ -255,6 +255,7 @@ DEFINES = \
-DRANDR_15_INTERFACE=1 \
-DPANORAMIX \
-UDEBUG_TREE \
-DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \
$(NULL)
all:: $(OBJS)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment