Skip to content

Commit 8b8c913

Browse files
committed
Minor doc fixes
1 parent 2b3a3be commit 8b8c913

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

Diff for: doc/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
21-
sys.path.insert(0, os.path.abspath('.'))
21+
sys.path.insert(0, os.path.abspath('..'))
2222

2323
# -- General configuration -----------------------------------------------------
2424

Diff for: doc/source/intro.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ The bitmap data can be converted to a list::
3535
[[0L, 0L, 0L, 0L, 0L, 0L, 10L, 85L, 142L, 195L, 222L, 238L, 252L,
3636
243L, 230L, 207L, 170L, 132L, 76L, 17L, 0L, 0L, 0L, 0L, 0L, 0L] ...
3737

38-
However, two display it at the console, it's usually nicer to use the
39-
`freetypy.util.draw_glyph_to_console` helper function::
38+
However, to display it at the console, it's usually nicer to use the
39+
`freetypy.util.bitmap_to_ascii` helper function::
4040

41-
>>> ft.util.draw_glyph_to_console(bitmap.to_list())
41+
>>> ft.util.bitmap_to_ascii(bitmap)
4242
.+*******++.
4343
+*############**.
4444
.*##################
@@ -78,7 +78,7 @@ However, two display it at the console, it's usually nicer to use the
7878
.++*******+.
7979

8080
This `~freetypy.Bitmap` is a Python buffer object. If you have Numpy,
81-
that provides the most efficient way to access the data in the bitmap::
81+
you can easily convert this data to an array::
8282

8383
>>> import numpy as np
8484
>>> array = np.array(bitmap)

Diff for: lib/freetypy/tests/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from nose.tools import raises
4141

4242

43-
from ..util import vera_path, draw_glyph_to_console
43+
from ..util import vera_path, bitmap_to_ascii
4444

4545

4646
try:
@@ -55,7 +55,7 @@ class SkipTest(Exception):
5555

5656

5757
__all__ = ['skip_if', 'vera_path', 'make_assert', 'raises',
58-
'draw_glyph_to_console']
58+
'bitmap_to_ascii']
5959

6060

6161
def skip_if(predicate):

Diff for: lib/freetypy/util.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,31 @@
3535

3636

3737
import os
38+
import sys
3839

3940

4041
__all__ = ['vera_path', 'draw_glyph_to_console']
4142

4243

4344
def vera_path():
45+
"""
46+
Returns the path to the copy of Bitstream Vera Sans that ships
47+
with freetypy for testing purposes.
48+
"""
4449
return os.path.join(os.path.dirname(__file__), 'data', 'Vera.ttf')
4550

4651

47-
def draw_glyph_to_console(a):
52+
def glyph_to_ascii(a):
4853
"""
49-
Draws a single glyph, as either a nested list or a Numpy array, to
50-
the console.
54+
Converts a single glyph to a string with an ASCII drawing of that
55+
glyph.
5156
"""
5257
shades = ' .+*#'
5358

54-
for row in a:
59+
lines = []
60+
for row in a.to_list():
5561
for col in row:
5662
col = int(float(col) / 255. * 4.)
5763
c = shades[col]
58-
print(c, end='')
59-
print()
64+
lines.append(c)
65+
return '\n'.join(lines)

0 commit comments

Comments
 (0)