Skip to content

Commit

Permalink
Merge pull request #49 from dmitrylyzo/WeebDataHoarder/embedded-fonts
Browse files Browse the repository at this point in the history
[WeebDataHoarder] Enable embedded fonts
  • Loading branch information
dmitrylyzo authored Jun 6, 2023
2 parents d51494c + 7b1e24a commit 3df655a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/SubtitleOctopus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ class SubtitleOctopus {
}

ass_set_message_cb(ass_library, msg_callback, NULL);
ass_set_extract_fonts(ass_library, 1);

ass_renderer = ass_renderer_init(ass_library);
if (!ass_renderer) {
Expand All @@ -335,7 +336,7 @@ class SubtitleOctopus {

/* TRACK */
void createTrack(char* subfile) {
removeTrack();
reloadLibrary();
track = ass_read_file(ass_library, subfile, NULL);
if (!track) {
fprintf(stderr, "jso: Failed to start a track\n");
Expand All @@ -345,7 +346,7 @@ class SubtitleOctopus {
}

void createTrackMem(char *buf, unsigned long bufsize) {
removeTrack();
reloadLibrary();
track = ass_read_memory(ass_library, buf, (size_t)bufsize, NULL);
if (!track) {
fprintf(stderr, "jso: Failed to start a track\n");
Expand Down Expand Up @@ -378,7 +379,7 @@ class SubtitleOctopus {
/* CANVAS */

void quitLibrary() {
ass_free_track(track);
removeTrack();
ass_renderer_done(ass_renderer);
ass_library_done(ass_library);
m_blend.clear();
Expand Down
2 changes: 2 additions & 0 deletions src/post-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ self.setTrack = function (content) {
// Tell libass to render the new track
self.octObj.createTrack("/sub.ass");
self.ass_track = self.octObj.track;
self.ass_renderer = self.octObj.ass_renderer;
self.ass_library = self.octObj.ass_library;
if (!self.renderOnDemand) {
self.getRenderMethod()();
}
Expand Down

0 comments on commit 3df655a

Please sign in to comment.