Skip to content

Commit 79ddced

Browse files
committed
Add option to add font path
1 parent 9bde7a8 commit 79ddced

File tree

4 files changed

+41
-15
lines changed

4 files changed

+41
-15
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
vncdesk/font_path.py
2+
13
# Byte-compiled / optimized / DLL files
24
__pycache__/
35
*.py[cod]

README.rst

+11-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ with::
1515

1616
vncdesk 2 drawing.fig
1717

18-
The optional argument ``drawing.fig`` is passed to the startup script.
18+
Optional arguments, here ``drawing.fig``, are passed to the startup script.
1919

2020
Files:
2121

@@ -75,11 +75,19 @@ Installation
7575

7676
- Python 3
7777

78-
- TigerVNC_ 1.4 or a compatible VNC server
78+
- A compatible VNC server such as TigerVNC_ 1.4 or TightVNC_
7979

8080
- gtk-vnc_ 0.5 or compatible
8181

82-
3. Run with sufficient permissions::
82+
3. If you want to set up an explicit font path for the VNC server, at the same
83+
level as ``__init__.py`` create ``font_path.py``. Example contents::
84+
85+
font_path = ','.join('/usr/share/fonts/misc/',
86+
'/usr/share/fonts/75dpi/',
87+
'/usr/share/fonts/100dpi/',
88+
'/usr/share/fonts/Type1/')
89+
90+
4. Run with sufficient permissions::
8391

8492
python setup.py install
8593

setup.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from distutils.core import setup
1+
from setuptools import setup
2+
23
exec(open('vncdesk/version.py').read())
34

45
setup(
@@ -11,5 +12,6 @@
1112
scripts = ["bin/vncdesk"],
1213
license = "WTFPL",
1314
description = "Runs applications via VNC. Allows scaling applications.",
14-
long_description = open('README.rst').read()
15+
long_description = open('README.rst').read(),
16+
zip_safe = True
1517
)

vncdesk/vnc_server.py

+24-10
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,36 @@ def wait_for_xvnc():
2626
while not path.isfile(_xvnc_lock_filename):
2727
sleep(0.1)
2828

29-
def start_xvnc():
29+
def font_path():
30+
try:
31+
from .font_path import font_path
32+
return font_path
33+
except:
34+
return None
35+
36+
def xvnc_cmd():
3037
global _display, _number, port
3138

3239
geometry = settings['desktop']['width'] + "x" + \
3340
settings['desktop']['height']
3441
port = 5900 + _number
35-
cmd = " ".join(["Xvnc",
36-
_display,
37-
"-desktop xfig",
38-
"-geometry " + geometry,
39-
"-rfbauth " + _password_filename,
40-
"-rfbport " + str(port),
41-
"-pn",
42-
"&"])
42+
fp = font_path()
43+
a = ["Xvnc",
44+
_display,
45+
"-desktop xfig",
46+
"-geometry " + geometry,
47+
"-rfbauth " + _password_filename,
48+
"-rfbport " + str(port),
49+
"-pn"]
50+
if fp:
51+
a.append("-fp " + fp)
52+
a.append("&")
53+
54+
return " ".join(a)
55+
56+
def start_xvnc():
4357
terminate()
44-
system(cmd)
58+
system(xvnc_cmd())
4559
wait_for_xvnc()
4660

4761
def write_password_to_file():

0 commit comments

Comments
 (0)