Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Commit

Permalink
Fix font face patch with no -font option
Browse files Browse the repository at this point in the history
  • Loading branch information
sttz committed Jan 1, 2018
1 parent 2127db5 commit 499e84b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions patches/font_face.patch
Expand Up @@ -14,20 +14,22 @@ Index: sub/font_load_ft.c
font_desc_t *vo_font = *fontp;
vo_image_width = width;
vo_image_height = height;
@@ -1160,5 +1160,17 @@
@@ -1160,5 +1160,19 @@
mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_FontconfigNoMatch);
}
#endif
- *fontp=read_font_desc_ft(font_name, 0, width, height, font_scale_factor);
+
+ // Extract index from hash suffix in pah, e.g. "~/myfont.ttc#3"
+ char *hash = strrchr(font_name, '#');
+ if (hash && *(hash + 1) != '\0') {
+ face_index = atoi(hash + 1);
+ if (face_index < 0) {
+ face_index = 0;
+ } else {
+ *hash = '\0';
+ if (font_name) {
+ char *hash = strrchr(font_name, '#');
+ if (hash && *(hash + 1) != '\0') {
+ face_index = atoi(hash + 1);
+ if (face_index < 0) {
+ face_index = 0;
+ } else {
+ *hash = '\0';
+ }
+ }
+ }
+
Expand Down

0 comments on commit 499e84b

Please sign in to comment.