summaryrefslogtreecommitdiffstats
path: root/libass/ass_fontselect.c
diff options
context:
space:
mode:
authorGrigori Goronzy <greg@chown.ath.cx>2011-08-15 22:04:02 +0200
committerGrigori Goronzy <greg@chown.ath.cx>2015-07-10 10:42:40 +0200
commit1fbe520d41d8a92082826b15dbd1cc54a067fa48 (patch)
tree9580e0cab8e4170caf0f4b2f1971bb50d5143fbe /libass/ass_fontselect.c
parentc22a4ff9a395546637dbe0f1e9d0ee549dd0069a (diff)
downloadlibass-1fbe520d41d8a92082826b15dbd1cc54a067fa48.tar.bz2
libass-1fbe520d41d8a92082826b15dbd1cc54a067fa48.tar.xz
Trim spaces of font family strings
This adds a trimming utility function that is used for trimming strings of font requests in the font sorter.
Diffstat (limited to 'libass/ass_fontselect.c')
-rw-r--r--libass/ass_fontselect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libass/ass_fontselect.c b/libass/ass_fontselect.c
index 481d4c9..2ca6f9d 100644
--- a/libass/ass_fontselect.c
+++ b/libass/ass_fontselect.c
@@ -263,8 +263,8 @@ static char *select_font(ASS_FontSelector *priv, ASS_Library *library,
req.weight = bold;
req.n_fullname = 1;
req.fullnames = &req_fullname;
- req.fullnames[0] = (char *)family;
- req.family = strdup(family);
+ req.fullnames[0] = trim_space(strdup(family));
+ req.family = trim_space(strdup(family));
char *p = strchr(req.family, ' ');
if (p) *p = 0;
@@ -281,6 +281,7 @@ static char *select_font(ASS_FontSelector *priv, ASS_Library *library,
&& font_infos[info_index].funcs.check_glyph(font_infos[info_index].priv, code) == 0)
info_index++;
+ free(req.fullnames[0]);
free(req.family);
// return best match