Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Jan 2, 2024
1 parent 28b21e4 commit b647e0b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ jobs:
vulkan-headers \
wayland-protocols
./ci/build-freebsd.sh
meson test -C build
meson test -v -C build
msys2:
runs-on: windows-latest
Expand Down
1 change: 1 addition & 0 deletions ci/build-freebsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export LDFLAGS="$LDFLAGS -L/usr/local/lib"
meson setup build \
--werror \
-Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
-Db_sanitize=address \
-Diconv=disabled \
-Dlibmpv=true \
-Dlua=enabled \
Expand Down
79 changes: 45 additions & 34 deletions sub/ass_mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "video/out/bitmap_packer.h"
#include "video/mp_image.h"

#include <stdio.h>

// res_y should be track->PlayResY
// It determines scaling of font sizes and more.
void mp_ass_set_style(ASS_Style *style, double res_y,
Expand All @@ -48,43 +50,52 @@ void mp_ass_set_style(ASS_Style *style, double res_y,
if (!style)
return;

if (opts->font) {
if (!style->FontName || strcmp(style->FontName, opts->font) != 0) {
free(style->FontName);
style->FontName = strdup(opts->font);
}
}
printf("%p | %p\n", style, opts);
fflush(stdout);

printf("%f\n", style->FontSize);
fflush(stdout);

printf("%f\n\n", opts->font_size);
fflush(stdout);

// if (opts->font) {
// if (!style->FontName || strcmp(style->FontName, opts->font) != 0) {
// free(style->FontName);
// style->FontName = strdup(opts->font);
// }
// }

// libass_font_size = FontSize * (window_height / res_y)
// scale translates parameters from PlayResY=720 to res_y
double scale = res_y / 720.0;

style->FontSize = opts->font_size * scale;
style->PrimaryColour = MP_ASS_COLOR(opts->color);
style->SecondaryColour = style->PrimaryColour;
style->OutlineColour = MP_ASS_COLOR(opts->border_color);
if (opts->back_color.a) {
style->BackColour = MP_ASS_COLOR(opts->back_color);
style->BorderStyle = 4; // opaque box
} else {
style->BackColour = MP_ASS_COLOR(opts->shadow_color);
style->BorderStyle = 1; // outline
}
style->Outline = opts->border_size * scale;
style->Shadow = opts->shadow_offset * scale;
style->Spacing = opts->spacing * scale;
style->MarginL = opts->margin_x * scale;
style->MarginR = style->MarginL;
style->MarginV = opts->margin_y * scale;
style->ScaleX = 1.;
style->ScaleY = 1.;
style->Alignment = 1 + (opts->align_x + 1) + (opts->align_y + 2) % 3 * 4;
#ifdef ASS_JUSTIFY_LEFT
style->Justify = opts->justify;
#endif
style->Blur = opts->blur;
style->Bold = opts->bold;
style->Italic = opts->italic;
// double scale = res_y / 720.0;

// style->FontSize = opts->font_size * scale;
// style->PrimaryColour = MP_ASS_COLOR(opts->color);
// style->SecondaryColour = style->PrimaryColour;
// style->OutlineColour = MP_ASS_COLOR(opts->border_color);
// if (opts->back_color.a) {
// style->BackColour = MP_ASS_COLOR(opts->back_color);
// style->BorderStyle = 4; // opaque box
// } else {
// style->BackColour = MP_ASS_COLOR(opts->shadow_color);
// style->BorderStyle = 1; // outline
// }
// style->Outline = opts->border_size * scale;
// style->Shadow = opts->shadow_offset * scale;
// style->Spacing = opts->spacing * scale;
// style->MarginL = opts->margin_x * scale;
// style->MarginR = style->MarginL;
// style->MarginV = opts->margin_y * scale;
// style->ScaleX = 1.;
// style->ScaleY = 1.;
// style->Alignment = 1 + (opts->align_x + 1) + (opts->align_y + 2) % 3 * 4;
// #ifdef ASS_JUSTIFY_LEFT
// style->Justify = opts->justify;
// #endif
// style->Blur = opts->blur;
// style->Bold = opts->bold;
// style->Italic = opts->italic;
}

void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts,
Expand Down

0 comments on commit b647e0b

Please sign in to comment.