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

Code before:
    eRoot->InsertEndChild(elem);
  };

  // Add Android system font directories
  // Note: USER and SYSTEM dirs are handled by ass_set_fonts_dir below
  const std::vector<std::string> fontDirs = {
      "/system/fonts",     // AOSP standard
      "/product/fonts",    // AOSP vendor-specific
      "/system_ext/fonts"  // OEM-specific (may not exist on all devices)
  };

  for (const auto& dir : fontDirs)
  {
    if (XFILE::CDirectory::Exists(dir))
      addRootChildText("dir", dir);
  }

  addRootChildText("cachedir", fontconfigCacheDir);

  // Write fontconfig configuration to temp directory
  fontconfigPath = CSpecialProtocol::TranslatePath("special://temp/fonts.conf");

  if (xmlDoc.SaveFile(fontconfigPath))
  {
    fontconfigConfig = fontconfigPath.c_str();
    CLog::LogF(LOGINFO, "Created fontconfig configuration at {}", fontconfigPath);
  }
  else
  {
    CLog::LogF(LOGERROR,
               "Failed to create fontconfig configuration, falling back to "
               "ASS_FONTPROVIDER_AUTODETECT");
    fontProvider = ASS_FONTPROVIDER_AUTODETECT;
    fontconfigConfig = nullptr;
  }
#endif

  // Set additional fonts directory for libass to scan. This provides font lookup
  // on platforms without a font provider, and supplements fontconfig on platforms that use it.
  ass_set_fonts_dir(m_library, CSpecialProtocol::TranslatePath(FONT::FONTPATH::USER).c_str());

  // Load additional fonts into Libass memory
  CFileItemList items;
  // Get fonts from system directory
  if (XFILE::CDirectory::Exists(FONT::FONTPATH::SYSTEM))
  {
    XFILE::CDirectory::GetDirectory(FONT::FONTPATH::SYSTEM, items, FONT::SUPPORTED_EXTENSIONS_MASK,
                                    XFILE::DIR_FLAG_NO_FILE_DIRS | XFILE::DIR_FLAG_NO_FILE_INFO);
  }

  const std::shared_ptr<CSettings> settings = CServiceBroker::GetSettingsComponent()->GetSettings();

Review comment (suggestion):
now that im testing this was better as
```suggestion
     CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Created fontconfig configuration at {}", fontconfigPath);
```

Code after:
    tinyxml2::XMLElement* eRoot = xmlDoc.NewElement("fontconfig");
    xmlDoc.InsertEndChild(eRoot);

    auto addRootChildText = [&](const char* name, const std::string& value)
    {
      tinyxml2::XMLElement* elem = xmlDoc.NewElement(name);
      elem->SetText(value.c_str());
      eRoot->InsertEndChild(elem);
    };

    // Add Android system font directories
    // Note: USER and SYSTEM dirs are handled by ass_set_fonts_dir below
    const std::vector<std::string> fontDirs = {
        "/system/fonts", // AOSP standard
        "/product/fonts", // AOSP vendor-specific
        "/system_ext/fonts" // OEM-specific (may not exist on all devices)
    };

    for (const auto& dir : fontDirs)
    {
      if (XFILE::CDirectory::Exists(dir))
        addRootChildText("dir", dir);
    }

    addRootChildText("cachedir", fontconfigCacheDir);

    if (xmlDoc.SaveFile(fontconfigPath))
    {
      fontconfigConfig = fontconfigPath.c_str();
      CLog::Log(LOGINFO, "CDVDSubtitlesLibass: Created fontconfig configuration at {}",
                fontconfigPath);
    }
    else
    {
      CLog::LogF(LOGERROR, "Failed to create fontconfig configuration, falling back to "
                           "ASS_FONTPROVIDER_AUTODETECT");
      fontProvider = ASS_FONTPROVIDER_AUTODETECT;
      fontconfigConfig = nullptr;
    }
  }
  else
  {
    fontconfigConfig = fontconfigPath.c_str();
  }
#endif

  // Set additional fonts directory for libass to scan. This provides font lookup
  // on platforms without a font provider, and supplements fontconfig on platforms that use it.
  ass_set_fonts_dir(m_library, CSpecialProtocol::TranslatePath(FONT::FONTPATH::USER).c_str());

  // Load additional fonts into Libass memory