Skip to content

Commit 1e4a825

Browse files
committed
Always return SfntName object
1 parent 45df153 commit 1e4a825

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

docstrings/sfntnames.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
5252
Returns
5353
-------
54-
sfnt_name : unicode or None
54+
sfnt_name : `SfntName` object
5555
"""

src/sfntnames.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Py_SfntNames_get_name(Py_SfntNames* self, PyObject* args, PyObject* kwds) {
103103

104104
count = FT_Get_Sfnt_Name_Count(face);
105105

106+
/* Give preference to Unicode names and return those first */
106107
for (i = 0; i < count; ++i) {
107108
if (ftpy_exc(
108109
FT_Get_Sfnt_Name(face, i, &sfnt_name))) {
@@ -124,9 +125,7 @@ Py_SfntNames_get_name(Py_SfntNames* self, PyObject* args, PyObject* kwds) {
124125
}
125126

126127
if (sfnt_name.name_id == name) {
127-
return ftpy_decode(
128-
sfnt_name.platform_id, sfnt_name.encoding_id,
129-
(const char *)sfnt_name.string, sfnt_name.string_len);
128+
return Py_SfntName_cnew((Py_Face *)self->base.owner, i);
130129
}
131130
}
132131

0 commit comments

Comments
 (0)