Files
o2o-castad-backend/app/p2v/utils/font.py
skkim b16d4a8f1b feat: P2V 파이프라인 연동 및 좋아요·댓글·공유 지원
- 무빙 포스터(p2v_video)·롱컷(p2v_playreel) 파이프라인과 워커, 갤러리·내 콘텐츠 노출
- 좋아요·댓글: comment/video_reaction에 p2v_playreel_id 추가, 종류별 CHECK 확장
- P2V 소프트 삭제(is_deleted), queued/running 삭제 차단
- 공개 상세·공유 OG 페이지 추가
- 삭제된 부모 댓글이 목록에서 사라지던 has_live_reply 서브쿼리 버그 수정
- 마이그레이션: migration_2026-10-15_p2v_reactions.sql
2026-10-15 10:42:30 +09:00

26 lines
861 B
Python

"""동봉 폰트 로더. 없으면 그 자리에서 죽는다 — 기본 폰트로 떨어지면 타이포가 어긋난다."""
from functools import lru_cache
from pathlib import Path
from PIL import ImageFont
FONT_DIR = Path(__file__).resolve().parent.parent / "assets" / "fonts"
PRETENDARD = "Pretendard-{weight}.otf"
GYEONGGI = "GyeonggiTitleVOTF-Bold.otf"
@lru_cache(maxsize=32)
def font(weight: str, size: int) -> ImageFont.FreeTypeFont:
path = FONT_DIR / PRETENDARD.format(weight=weight)
if not path.exists():
raise RuntimeError(f"폰트 없음: {path}")
return ImageFont.truetype(str(path), size)
@lru_cache(maxsize=8)
def title_font(size: int) -> ImageFont.FreeTypeFont:
path = FONT_DIR / GYEONGGI
if not path.exists():
raise RuntimeError(f"폰트 없음: {path}")
return ImageFont.truetype(str(path), size)