Repository: xbmc/xbmc
File: xbmc/cores/VideoPlayer/DVDSubtitles/DVDSubtitlesLibass.cpp (C++)

Code before:
    style->Spacing = 0;

    bool isFontBold =
        (subStyle->fontStyle == FontStyle::BOLD || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
    bool isFontItalic =
        (subStyle->fontStyle == FontStyle::ITALIC || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
    style->Bold = isFontBold * -1;
    style->Italic = isFontItalic * -1;

    //! @todo Libass has a problem with color transparencies when set to:
    //! PrimaryColour/SecondaryColour/OutlineColour by causing a gap between border
    //! and text color. As workaround the SecondaryColour must have no transparency
    //! this will fix just use cases without transparencies, for a full fix will be
    //! needed in future update libass library having the gap fix.

    // Set default subtitles color
    style->PrimaryColour = ConvColor(subStyle->fontColor, subStyle->fontOpacity);
    // Set secondary colour for karaoke
    // left part is filled with PrimaryColour, right one with SecondaryColour
    //! @bug in libass - force secondary color without transparency otherwise
    //! cause a visible color gap, we also avoid reusing the same primary
    //! color otherwise the karaoke effect will not be visible.
    style->SecondaryColour = ConvColor(COLOR::BLACK);

    // Configure the effects
    double lineSpacing = subStyle->lineSpacing * scale;
    if (subStyle->borderStyle == BorderType::OUTLINE ||
        subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
    {
      style->BorderStyle = ASS_BORDER_STYLE_OUTLINE;
      style->Outline = (10.00 / 100 * subStyle->fontBorderSize) * scale;
      style->OutlineColour = ConvColor(subStyle->fontBorderColor, subStyle->fontOpacity);
      if (subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
      {
        style->BackColour = ConvColor(COLOR::NONE, 0); // Set the shadow color
        style->Shadow = 0; // Set the shadow size
      }
      else
      {
        style->BackColour =
            ConvColor(subStyle->shadowColor, subStyle->shadowOpacity); // Set the shadow color
        style->Shadow = (10.00 / 100 * subStyle->shadowSize) * scale; // Set the shadow size
      }
    }
    else if (subStyle->borderStyle == BorderType::BOX)
    {
      // This BorderStyle not support outline color/size
      style->BorderStyle = ASS_BORDER_STYLE_BOX;
      style->Outline = 4 * scale; // Space between the text and the box edges
      style->OutlineColour =
          ConvColor(subStyle->backgroundColor,

Review comment (bug):
this must be changed.
you have changed scaling by using `scale` and this is wrong, with overrided fonts will cause a wrong scaling.

this has more sense change as:
```c++
    double lineSpacing;
    if (subStyle->assOverrideFont)
      lineSpacing = subStyle->lineSpacing * scaleDefault;
    else
      lineSpacing = subStyle->lineSpacing * scale;
```
and move this code just above the `ass_set_line_spacing` call, since lineSpacing var is never used before it

Code after:
    style->Spacing = 0;

    bool isFontBold =
        (subStyle->fontStyle == FontStyle::BOLD || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
    bool isFontItalic =
        (subStyle->fontStyle == FontStyle::ITALIC || subStyle->fontStyle == FontStyle::BOLD_ITALIC);
    style->Bold = isFontBold * -1;
    style->Italic = isFontItalic * -1;

    //! @todo Libass has a problem with color transparencies when set to:
    //! PrimaryColour/SecondaryColour/OutlineColour by causing a gap between border
    //! and text color. As workaround the SecondaryColour must have no transparency
    //! this will fix just use cases without transparencies, for a full fix will be
    //! needed in future update libass library having the gap fix.

    // Set default subtitles color
    style->PrimaryColour = ConvColor(subStyle->fontColor, subStyle->fontOpacity);
    // Set secondary colour for karaoke
    // left part is filled with PrimaryColour, right one with SecondaryColour
    //! @bug in libass - force secondary color without transparency otherwise
    //! cause a visible color gap, we also avoid reusing the same primary
    //! color otherwise the karaoke effect will not be visible.
    style->SecondaryColour = ConvColor(COLOR::BLACK);

    // Configure the effects
    if (subStyle->borderStyle == BorderType::OUTLINE ||
        subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
    {
      style->BorderStyle = ASS_BORDER_STYLE_OUTLINE;
      style->Outline = (10.00 / 100 * subStyle->fontBorderSize) * scale;
      style->OutlineColour = ConvColor(subStyle->fontBorderColor, subStyle->fontOpacity);
      if (subStyle->borderStyle == BorderType::OUTLINE_NO_SHADOW)
      {
        style->BackColour = ConvColor(COLOR::NONE, 0); // Set the shadow color
        style->Shadow = 0; // Set the shadow size
      }
      else
      {
        style->BackColour =
            ConvColor(subStyle->shadowColor, subStyle->shadowOpacity); // Set the shadow color
        style->Shadow = (10.00 / 100 * subStyle->shadowSize) * scale; // Set the shadow size
      }
    }
    else if (subStyle->borderStyle == BorderType::BOX)
    {
      // This BorderStyle not support outline color/size
      style->BorderStyle = ASS_BORDER_STYLE_BOX;
      style->Outline = 4 * scale; // Space between the text and the box edges
      style->OutlineColour =
          ConvColor(subStyle->backgroundColor,
                    subStyle->backgroundOpacity); // Set the background border color