codecVis: support Homebrew installed DejaVu font on macOS

This commit is contained in:
Hannes Braun 2023-01-01 18:43:07 +01:00
parent 251859e989
commit 18038e02f0
Signed by: hannesbraun
GPG Key ID: 7B6557E1DFD685BE
1 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@
"""
import os
import platform
import sys
import time
import subprocess
@ -55,6 +56,12 @@ def extract_frame(video_file, time_offset, output_file):
subprocess.call(shlex.split(cmd),stdout=devnull, stderr=devnull)
def get_font_path():
if platform.system() == "Darwin":
# Assume DejaVu to be installed via Homebrew
path = "~/Library/Fonts/DejaVuSans-Bold.ttf"
return os.path.expanduser(path)
# Default platform: Linux
path = "/usr/share/fonts"
files = glob.glob(path + "/**/DejaVuSans-Bold.ttf", recursive = True)
return files[0]