]> granicus.if.org Git - handbrake/commitdiff
text subs: use generic font family names (#614)
authorJohn Stebbins <jstebbins.hb@gmail.com>
Fri, 10 Mar 2017 19:47:50 +0000 (12:47 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Sun, 12 Mar 2017 17:49:13 +0000 (11:49 -0600)
* text subs: use generic font family names

Allows the platform more flexibility in choosing the "best" font for the
platform.

* rendersub: make font configurable per platform

Use Lucida Console for mono font on windows since it chooses ugly,
difficult to read Courier New when using monospace family name.

(cherry picked from commit 65e24973e7deff59f93caabd1d561c8d0d2e9163)

libhb/deccc608sub.c
libhb/decsrtsub.c
libhb/dectx3gsub.c
libhb/decutf8sub.c
libhb/internal.h
libhb/rendersub.c

index 903ff2d79c3cccb102a7fa2915860a78a55a15e3..ff044d28f39fdd18ec5a0ba823e21295d4655054 100644 (file)
@@ -1799,7 +1799,7 @@ static int decccInit( hb_work_object_t * w, hb_job_t * job )
         int height = job->title->geometry.height - job->crop[0] - job->crop[1];
         int width = job->title->geometry.width - job->crop[2] - job->crop[3];
         int safe_height = 0.8 * job->title->geometry.height;
-        hb_subtitle_add_ssa_header(w->subtitle, "Courier New",
+        hb_subtitle_add_ssa_header(w->subtitle, HB_FONT_MONO,
                                    .08 * safe_height, width, height);
     }
     // When rendering subs, we need to push rollup subtitles out
index 6835e2e16bcc7db457ae1a4c6600aaec2369dade..a3646120390b939dbf0d5f1081e56dcb77648b90 100644 (file)
@@ -675,7 +675,7 @@ static int decsrtInit( hb_work_object_t * w, hb_job_t * job )
         // Generate generic SSA Script Info.
         int height = job->title->geometry.height - job->crop[0] - job->crop[1];
         int width = job->title->geometry.width - job->crop[2] - job->crop[3];
-        hb_subtitle_add_ssa_header(w->subtitle, "Arial",
+        hb_subtitle_add_ssa_header(w->subtitle, HB_FONT_SANS,
                                    .066 * job->title->geometry.height,
                                    width, height);
     }
index 3029aeca31542d42d17645c51ca41f50e607de02..74cad64475b3562a67f664c5012024a4f6cf9a95 100644 (file)
@@ -251,7 +251,7 @@ static int dectx3gInit( hb_work_object_t * w, hb_job_t * job )
     // For now we just create a generic SSA Script Info.
     int height = job->title->geometry.height - job->crop[0] - job->crop[1];
     int width = job->title->geometry.width - job->crop[2] - job->crop[3];
-    hb_subtitle_add_ssa_header(w->subtitle, "Arial",
+    hb_subtitle_add_ssa_header(w->subtitle, HB_FONT_SANS,
                                .066 * job->title->geometry.height,
                                width, height);
 
index 8df310a92fe1b2c91959d4e3bc4be27c3525db47..ad6787ad0225e9a3eb385034f99c858e956aea6f 100644 (file)
@@ -37,7 +37,7 @@ static int decutf8Init(hb_work_object_t *w, hb_job_t *job)
     // Generate generic SSA Script Info.
     int height = job->title->geometry.height - job->crop[0] - job->crop[1];
     int width = job->title->geometry.width - job->crop[2] - job->crop[3];
-    hb_subtitle_add_ssa_header(w->subtitle, "Arial",
+    hb_subtitle_add_ssa_header(w->subtitle, HB_FONT_SANS,
                                .066 * job->title->geometry.height,
                                width, height);
 
index 1a709442934ddb0c01acfdb1be65a6cc780001f9..30db9783339f8c92a50b94942661434be267ddff 100644 (file)
@@ -520,3 +520,12 @@ void                 hb_chapter_queue_close(hb_chapter_queue_t **_q);
 void                 hb_chapter_enqueue(hb_chapter_queue_t *q, hb_buffer_t *b);
 void                 hb_chapter_dequeue(hb_chapter_queue_t *q, hb_buffer_t *b);
 
+/* Font names used for rendering subtitles */
+#if defined(SYS_MINGW)
+#define HB_FONT_MONO "Lucida Console"
+#define HB_FONT_SANS "sans-serif"
+#else
+#define HB_FONT_MONO "monospace"
+#define HB_FONT_SANS "sans-serif"
+#endif
+
index 763cdfa4d2770dbd3d6dba6935c1a74ba500f84a..26d1058c54eb31b9fcad8e8a1edb70a856eadf3f 100644 (file)
@@ -675,7 +675,7 @@ static int cc608sub_post_init( hb_filter_object_t * filter, hb_job_t * job )
     int width = job->title->geometry.width - job->crop[2] - job->crop[3];
     int safe_height = 0.8 * job->title->geometry.height;
     // Use fixed widht font for CC
-    hb_subtitle_add_ssa_header(filter->subtitle, "Courier New",
+    hb_subtitle_add_ssa_header(filter->subtitle, HB_FONT_MONO,
                                .08 * safe_height, width, height);
     return ssa_post_init(filter, job);
 }
@@ -686,7 +686,7 @@ static int textsub_post_init( hb_filter_object_t * filter, hb_job_t * job )
     // to have the header rewritten with the correct dimensions.
     int height = job->title->geometry.height - job->crop[0] - job->crop[1];
     int width = job->title->geometry.width - job->crop[2] - job->crop[3];
-    hb_subtitle_add_ssa_header(filter->subtitle, "Arial",
+    hb_subtitle_add_ssa_header(filter->subtitle, HB_FONT_SANS,
                                .066 * job->title->geometry.height,
                                width, height);
     return ssa_post_init(filter, job);